diff options
author | Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> | 2019-04-29 15:43:53 +0300 |
---|---|---|
committer | Olivier Hallot <olivier.hallot@libreoffice.org> | 2019-04-29 16:54:06 +0200 |
commit | de68dd22d495f86837eda91277af0961c57696e2 (patch) | |
tree | 658927c74225de68eb3159c8ac312deccaefc070 /help3xsl | |
parent | 0615e893e70bfb8a0f3fe9d86361da5faaa3dd72 (diff) |
Limit the scope of getting class names for index titles
Change-Id: I2d586605118032aaf38ff70d420bc7c2bf4979ae
Reviewed-on: https://gerrit.libreoffice.org/71529
Tested-by: Jenkins
Reviewed-by: Olivier Hallot <olivier.hallot@libreoffice.org>
Diffstat (limited to 'help3xsl')
-rw-r--r-- | help3xsl/help.js | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/help3xsl/help.js b/help3xsl/help.js index 59dd378c73..2767b157f8 100644 --- a/help3xsl/help.js +++ b/help3xsl/help.js @@ -22,7 +22,8 @@ if(url.indexOf('explorer/database/') !== -1) { var results = null; var fullLinkified = ''; var modules = ['CALC', 'WRITER', 'IMPRESS', 'DRAW', 'BASE', 'MATH', 'CHART', 'BASIC', 'SHARED']; -var indexkids = function() { document.getElementsByClassName("index")[0].children; }; +var index = document.getElementsByClassName("index")[0]; +var indexkids = index.children; // if user is not on a shared category page, limit the index to the current module + shared if(currentModule !== 'HARED') { bookmarks = bookmarks.filter(function(obj) { @@ -33,9 +34,9 @@ bookmarks.forEach(function(obj) { fullLinkified += '<a href="' + obj['url'] + '" class="' + obj['app'] + '">' + obj['text'] + '</a>'; }); function fullList() { - document.getElementsByClassName("index")[0].innerHTML = fullLinkified; + index.innerHTML = fullLinkified; addIds(); - Paginator(document.getElementsByClassName("index")[0]); + Paginator(index); } // add id to the first items of each category in the index. CSS ::before rule adds the heading text function addIds() { @@ -43,7 +44,7 @@ function addIds() { indexkids[i].removeAttribute("id"); } modules.forEach(function(module) { - var moduleHeader = document.getElementsByClassName(module)[0]; + var moduleHeader = index.getElementsByClassName(module)[0]; if (typeof moduleHeader !== 'undefined') { // let's wrap the header in a span, so the ::before element will not become a link moduleHeader.outerHTML = '<span id="' + module + '" class="' + module + '">' + moduleHeader.outerHTML + '</span>'; @@ -65,9 +66,9 @@ var filter = function() { results.forEach(function(result) { filtered += '<a href="' + result.obj['url'] + '" class="' + result.obj['app'] + '">' + fuzzysort.highlight(result) + '</a>'; }); - document.getElementsByClassName("index")[0].innerHTML = filtered; + index.innerHTML = filtered; addIds(); - Paginator(document.getElementsByClassName("index")[0]); + Paginator(index); }; function debounce(fn, wait) { var timeout; |