[Libreoffice-commits] help.git: help3xsl/help.js
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Apr 29 14:54:27 UTC 2019
help3xsl/help.js | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
New commits:
commit de68dd22d495f86837eda91277af0961c57696e2
Author: Ilmari Lauhakangas <ilmari.lauhakangas at libreoffice.org>
AuthorDate: Mon Apr 29 15:43:53 2019 +0300
Commit: Olivier Hallot <olivier.hallot at libreoffice.org>
CommitDate: Mon Apr 29 16:54:06 2019 +0200
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 at libreoffice.org>
diff --git a/help3xsl/help.js b/help3xsl/help.js
index 59dd378c7..2767b157f 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;
More information about the Libreoffice-commits
mailing list