diff options
author | Olivier Hallot <olivier.hallot@libreoffice.org> | 2018-04-15 22:43:17 -0300 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2018-08-07 17:52:30 +0200 |
commit | e5d2c26c54ef04759508f7cd99a6c648f32b6707 (patch) | |
tree | 75c0bb52f9107a1af21a5d27c23d131ee123c705 /help3xsl/help.js | |
parent | 8377d206600f974e8dc83cb07a45c4b44ada2b68 (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 26c9351246..3b4f4a7c00 100644 --- a/help3xsl/help.js +++ b/help3xsl/help.js @@ -8,42 +8,60 @@ */ // 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"); } } } @@ -230,5 +248,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: */ |