From 886cebba80267127e47de6f5dad57745cfe54752 Mon Sep 17 00:00:00 2001 From: Olivier Hallot Date: Mon, 31 Jul 2023 11:14:36 -0300 Subject: tdf#144859 - fix switch javascript logic. Change-Id: I7add8db42f1944052ea5907e24b889cb9e504d3f Reviewed-on: https://gerrit.libreoffice.org/c/help/+/155097 Tested-by: Jenkins Reviewed-by: Olivier Hallot --- help3xsl/help2.js | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'help3xsl') diff --git a/help3xsl/help2.js b/help3xsl/help2.js index 728453134b..7e938b5404 100644 --- a/help3xsl/help2.js +++ b/help3xsl/help2.js @@ -8,19 +8,19 @@ */ // Used to set Application in caseinline=APP function setApplSpan(spanZ) { - var module = getParameterByName("DbPAR"); + let module = getParameterByName("DbPAR"); if (module === null) { - module = "WRITER"; + module = "SHARED"; } - var y = spanZ.getElementsByTagName("SPAN"); - var n = y.length; - var foundAppl = false; + let y = spanZ.getElementsByTagName("SPAN"); + let n = y.length; + let foundAppl = 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"); + y[i].hidden = false; foundAppl=true; } } @@ -29,8 +29,9 @@ function setApplSpan(spanZ) { continue; } else if( y[i].getAttribute("id").startsWith("default")){ + y[i].hidden = true; if(!foundAppl){ - y[i].removeAttribute("hidden"); + y[i].hidden = false; } } } @@ -38,29 +39,31 @@ function setApplSpan(spanZ) { // Used to set system in case, caseinline=SYSTEM function setSystemSpan(spanZ) { // if no System in URL, get browser system - var system = getParameterByName("System"); + let system = getParameterByName("System"); if (system === null) { system = getSystem(); } - var y = spanZ.getElementsByTagName("SPAN"); - var n = y.length; - var foundSystem = false; - for (i = 0; i < n; i++) { + let y = spanZ.getElementsByTagName("SPAN"); + let n = y.length; + let foundSystem = false; + + for (let i = 0; i < n; i++) { if (y[i].getAttribute("id") === null){ continue; } else if( y[i].getAttribute("id").startsWith(system)){ - y[i].removeAttribute("hidden"); + y[i].hidden = false; foundSystem=true; } } - for (i = 0; i < n; i++) { + for (let i = 0; i < n; i++) { if (y[i].getAttribute("id") === null){ continue; } else if( y[i].getAttribute("id").startsWith("default")){ + y[i].hidden = true; if(!foundSystem){ - y[i].removeAttribute("hidden"); + y[i].hidden = false; } } } @@ -187,7 +190,7 @@ function setupModules(lang) { var modulesNav = document.getElementById('modules-nav'); if (!modulesNav.classList.contains('loaded')) { var html = - '
%PRODUCTNAME
' + + '
LibreOfficeDev
' + '
Writer
' + '
Calc
' + '
Impress
' + -- cgit