[Libreoffice-commits] help.git: help3xsl/help2.js

Olivier Hallot (via logerrit) logerrit at kemper.freedesktop.org
Fri Nov 8 18:42:47 UTC 2019


 help3xsl/help2.js |   21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

New commits:
commit d034a998ce691d67778bc5f499c04de7544e0af9
Author:     Olivier Hallot <olivier.hallot at libreoffice.org>
AuthorDate: Fri Nov 8 07:28:03 2019 -0300
Commit:     Olivier Hallot <olivier.hallot at libreoffice.org>
CommitDate: Fri Nov 8 19:42:27 2019 +0100

    Fix switch selection when embedded in other pages
    
    Emebed exerpts with switch tags were unable to perform
    the correct switch because of the use of the same id= in
    several places in the page. The new logic fixes that.
    
    Change-Id: I1e1084170e023c89f3c695c3d1c5a6c7deee7374
    Reviewed-on: https://gerrit.libreoffice.org/82277
    Tested-by: Jenkins
    Reviewed-by: Olivier Hallot <olivier.hallot at libreoffice.org>

diff --git a/help3xsl/help2.js b/help3xsl/help2.js
index 54dd195ab..a1739eeaf 100644
--- a/help3xsl/help2.js
+++ b/help3xsl/help2.js
@@ -7,21 +7,21 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 // Used to set Application in caseinline=APP
-function setApplSpan(SpanID) {
+function setApplSpan(spanZ) {
     var module = getParameterByName("DbPAR");
     if (module === null) {
         module = "WRITER";
     }
-    var y = document.getElementById(SpanID).getElementsByTagName("SPAN");
+    var y = spanZ.getElementsByTagName("SPAN");
     var n = y.length;
-    var foundSystem = false;
+    var 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");
-            foundSystem=true;
+            foundAppl=true;
         }
     }
     for (i = 0; i < n; i++) {
@@ -29,20 +29,20 @@ function setApplSpan(SpanID) {
             continue;
         }
         else if( y[i].getAttribute("id").startsWith("default")){
-            if(!foundSystem){
+            if(!foundAppl){
                 y[i].removeAttribute("hidden");
             }
         }
     }
 }
 // Used to set system in case, caseinline=SYSTEM
-function setSystemSpan(spanID) {
-    var system = getParameterByName("System");
+function setSystemSpan(spanZ) {
     // if no System in URL, get browser system
+    var system = getParameterByName("System");
     if (system === null) {
         system = getSystem();
     }
-    var y = document.getElementById(spanID).getElementsByTagName("SPAN");
+    var y = spanZ.getElementsByTagName("SPAN");
     var n = y.length;
     var foundSystem = false;
     for (i = 0; i < n; i++) {
@@ -65,6 +65,7 @@ function setSystemSpan(spanID) {
         }
     }
 }
+
 // Find spans that need the switch treatment and give it to them
 var spans = document.querySelectorAll("[class^=switch]");
 var n = spans.length;
@@ -74,9 +75,9 @@ for (z = 0; z < n; z++) {
         continue;
     }
     else if (id.startsWith("swlnsys")) {
-        setSystemSpan(id);
+        setSystemSpan(spans[z]);
     } else {
-        setApplSpan(id);
+        setApplSpan(spans[z]);
     }
 }
 /* add &DbPAR= and &System= to the links in DisplayArea div */


More information about the Libreoffice-commits mailing list