You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by le...@apache.org on 2020/07/07 23:44:43 UTC
[incubator-datasketches-website] branch master updated: expand
current toc menu item on page load
This is an automated email from the ASF dual-hosted git repository.
leerho pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-datasketches-website.git
The following commit(s) were added to refs/heads/master by this push:
new 1066025 expand current toc menu item on page load
new c630ac6 Merge pull request #92 from mkaszas/master
1066025 is described below
commit 10660254958a4512bbb9f986393c991c8f5e8cde
Author: Mate Kaszas <ma...@gmail.com>
AuthorDate: Tue Jul 7 13:13:48 2020 +0200
expand current toc menu item on page load
---
_includes/tocScript.html | 27 +++++----------------------
1 file changed, 5 insertions(+), 22 deletions(-)
diff --git a/_includes/tocScript.html b/_includes/tocScript.html
index a9045b7..60194e3 100644
--- a/_includes/tocScript.html
+++ b/_includes/tocScript.html
@@ -26,40 +26,23 @@
return collapseMenus
};
- var findMatchingCollapseMenu = function (collapseItem) {
- return document.querySelector(`[href="#${collapseItem.id}"]`);
- };
-
- var findAllParentMenus = function (element) {
- var parentMenus = []
- var elementPointer = element;
- while (elementPointer !== document.body) {
- if (elementPointer.className.split(' ').indexOf('menu') > -1) {
- parentMenus.push(elementPointer);
- }
- elementPointer = elementPointer.parentElement;
- }
- return parentMenus;
- }
-
var openMenuItem = function (element) {
- element.click();
+ // $(element).collapse('show') would start a transition, adding `in` class instead.
+ element.classList.add('in');
};
var openAllFromList = function (elementList) {
- elementList.forEach(function (element) {
- console.log(element)
- openMenuItem(findMatchingCollapseMenu(element))
- });
+ elementList.forEach(openMenuItem);
};
var highlightAndOpenMenu = function () {
var currentLineItem = findLineItem(document.location.pathname);
highlighLineItem(currentLineItem);
+ openAllFromList(findAllCollapseParents(currentLineItem));
};
$(highlightAndOpenMenu);
}());
</script>
-<!-- End _includes/tocScript.html -->
\ No newline at end of file
+<!-- End _includes/tocScript.html -->
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org