summaryrefslogtreecommitdiffstats
path: root/help3xsl/help2.js
diff options
context:
space:
mode:
authorIlmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>2019-03-12 23:36:46 +0200
committerOlivier Hallot <olivier.hallot@libreoffice.org>2019-03-13 20:11:32 +0100
commit3d0fcf7a37859e0e8b61d4a560042dfef6b3c99b (patch)
treed841577c702391701d5671640b44975f2b11c290 /help3xsl/help2.js
parentCompiler error due to incorrect indentation (diff)
downloadhelp-3d0fcf7a37859e0e8b61d4a560042dfef6b3c99b.tar.gz
help-3d0fcf7a37859e0e8b61d4a560042dfef6b3c99b.zip
New approach to switch cases
My previous JS patch broke the sys and appl switch behaviour. This patch removes the inline function calls from online_transform.xsl. Instead, help2.js now finds the relevant spans and calls the functions for them. Change-Id: I45d5b75bdb70a7c18eaa0b215beb57e3e1b6719a Reviewed-on: https://gerrit.libreoffice.org/69137 Tested-by: Jenkins Reviewed-by: Olivier Hallot <olivier.hallot@libreoffice.org>
Diffstat (limited to 'help3xsl/help2.js')
-rw-r--r--help3xsl/help2.js16
1 files changed, 15 insertions, 1 deletions
diff --git a/help3xsl/help2.js b/help3xsl/help2.js
index 5a48c394fe..0003b72d82 100644
--- a/help3xsl/help2.js
+++ b/help3xsl/help2.js
@@ -65,6 +65,20 @@ 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;
+for (z = 0; z < n; z++) {
+ var id = spans[z].getAttribute("id");
+ if (id === null) {
+ continue;
+ }
+ else if (id.startsWith("swlnsys")) {
+ setSystemSpan(id);
+ } else {
+ setApplSpan(id);
+ }
+}
/* add &DbPAR= and &System= to the links in DisplayArea div */
/* skip for object files */
function fixURL(module, system) {
@@ -168,7 +182,7 @@ function setupLanguages(target, page) {
}
// Test, if we are online
-if (document.body.getElementsByTagName('meta')[0].getAttribute('itemprop') === 'version') {
+if (document.body.getElementsByTagName('meta')) {
var _paq = _paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['disableCookies']);