diff options
author | Marcin Aman <maman@virtuslab.com> | 2020-05-27 13:00:08 +0200 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-05-28 16:32:09 +0200 |
commit | 6a907269a96130e798815ba1723a2789fc158f3d (patch) | |
tree | bef34aad0315688d2e88ae6418cd0512f36f47d5 /plugins/base/src | |
parent | 0f1c461d20336444bc667713954ea2879cc0a396 (diff) | |
download | dokka-6a907269a96130e798815ba1723a2789fc158f3d.tar.gz dokka-6a907269a96130e798815ba1723a2789fc158f3d.tar.bz2 dokka-6a907269a96130e798815ba1723a2789fc158f3d.zip |
Initially show only the default chosen tab body
Diffstat (limited to 'plugins/base/src')
-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")) { |