diff options
author | Olivier Hallot <olivier.hallot@libreoffice.org> | 2018-04-15 22:43:17 -0300 |
---|---|---|
committer | Olivier Hallot <olivier.hallot@libreoffice.org> | 2018-04-16 13:17:35 +0200 |
commit | d5ca87f12819b669646bb6f0978f79ebb5d3f035 (patch) | |
tree | 1c08e27ecc4c0e7b89fca2ffa37fe6f1d7c911c0 /help3xsl/help.js | |
parent | 934da888b80ebbf654e6cff797727d332eebaf6a (diff) |
tdf#116150 Review XHP <switch> style transform
implement <switch> and <switchinline> with HTML and
Javascript, for 'sys' and 'appl'.
Change-Id: I6056e787146bb92617c2ce639acab16d16d6f765
Reviewed-on: https://gerrit.libreoffice.org/52929
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Olivier Hallot <olivier.hallot@libreoffice.org>
Tested-by: Olivier Hallot <olivier.hallot@libreoffice.org>
Diffstat (limited to 'help3xsl/help.js')
-rw-r--r-- | help3xsl/help.js | 65 |
1 files changed, 41 insertions, 24 deletions
diff --git a/help3xsl/help.js b/help3xsl/help.js index cd454e6fbe..585ff2ef80 100644 --- a/help3xsl/help.js +++ b/help3xsl/help.js @@ -7,42 +7,60 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // Used to set Application in caseinline=APP -function setModule(module) { +function setApplSpan(SpanID) { + var module = getParameterByName("DbPAR"); if (module === null) { module = "WRITER"; } - var itemspan = document.getElementsByTagName("span"); - var n = itemspan.length; - for (var i = 0; i < n; i++) { - if (itemspan[i].getAttribute("value") == module) { - itemspan[i].removeAttribute("hidden"); + var y = document.getElementById(SpanID).getElementsByTagName("SPAN"); + var n = y.length; + var foundSystem = false; + for (i = 0; i < n; i++) { + if (y[i].getAttribute("id") === null){ + continue; + } + else if( y[i].getAttribute("id").startsWith(module)){ + y[i].removeAttribute("hidden"); + foundSystem=true; + } + } + for (i = 0; i < n; i++) { + if (y[i].getAttribute("id") === null){ + continue; + } + else if( y[i].getAttribute("id").startsWith("default")){ + if(!foundSystem){ + y[i].removeAttribute("hidden"); + } } } } // Used to set system in case, caseinline=SYSTEM -function setSystem(system) { - var hasSystem; +function setSystemSpan(spanID) { + var system = getParameterByName("System"); // if no System in URL, get browser system if (system === null) { system = getSystem(); } - // on loading page, DEFAULTSYS visible, sys is hidden - // when hasSystem, show sys, hide DEFAULTSYS - var itemspan = document.getElementsByTagName("span"); - var n = itemspan.length; - //Show when system is found in page - hasSystem = false; - for (var i = 0; i < n; i++) { - if (itemspan[i].getAttribute("value") == system) { - itemspan[i].removeAttribute("hidden"); - hasSystem = true; + var y = document.getElementById(spanID).getElementsByTagName("SPAN"); + var n = y.length; + var foundSystem = false; + for (i = 0; i < n; i++) { + if (y[i].getAttribute("id") === null){ + continue; + } + else if( y[i].getAttribute("id").startsWith(system)){ + y[i].removeAttribute("hidden"); + foundSystem=true; } } - //it hasSystem, then hide all DEFAULTSYS - if (hasSystem){ - for (var i = 0; i < n; i++) { - if (itemspan[i].getAttribute("value") == "DEFAULTSYS") { - itemspan[i].setAttribute("hidden",true); + for (i = 0; i < n; i++) { + if (y[i].getAttribute("id") === null){ + continue; + } + else if( y[i].getAttribute("id").startsWith("default")){ + if(!foundSystem){ + y[i].removeAttribute("hidden"); } } } @@ -229,5 +247,4 @@ if (typeof linkIndex !== "undefined") { } current.classList.add('contents-current'); } - /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |