diff options
-rw-r--r-- | plugins/base/src/main/resources/dokka/scripts/platformContentHandler.js | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/plugins/base/src/main/resources/dokka/scripts/platformContentHandler.js b/plugins/base/src/main/resources/dokka/scripts/platformContentHandler.js index cd993587..335bb230 100644 --- a/plugins/base/src/main/resources/dokka/scripts/platformContentHandler.js +++ b/plugins/base/src/main/resources/dokka/scripts/platformContentHandler.js @@ -10,10 +10,23 @@ window.addEventListener('load', () => { document.querySelectorAll("div[tabs-section]") .forEach(elem => elem.addEventListener('click', (event) => toggleSections(event))) document.getElementById('filter-section').addEventListener('click', (event) => filterButtonHandler(event)) + initTabs() +}) + +function initTabs(){ + document.querySelectorAll("div[tabs-section]") + .forEach(element => { + showCorrespondingTabBody(element) + element.addEventListener('click', (event) => toggleSections(event)) + }) +} + +function showCorrespondingTabBody(element){ + const key = element.querySelector("button[data-active]").getAttribute("data-togglable") document.querySelector(".tabs-section-body") - .querySelector("div[data-togglable]") + .querySelector("div[data-togglable='" + key + "']") .setAttribute("data-active", "") -}) +} function filterButtonHandler(event) { if(event.target.tagName == "BUTTON" && event.target.hasAttribute("data-filter")) { |