aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main
diff options
context:
space:
mode:
authorMarcin Aman <maman@virtuslab.com>2020-05-27 13:00:08 +0200
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-05-28 16:32:09 +0200
commit6a907269a96130e798815ba1723a2789fc158f3d (patch)
treebef34aad0315688d2e88ae6418cd0512f36f47d5 /plugins/base/src/main
parent0f1c461d20336444bc667713954ea2879cc0a396 (diff)
downloaddokka-6a907269a96130e798815ba1723a2789fc158f3d.tar.gz
dokka-6a907269a96130e798815ba1723a2789fc158f3d.tar.bz2
dokka-6a907269a96130e798815ba1723a2789fc158f3d.zip
Initially show only the default chosen tab body
Diffstat (limited to 'plugins/base/src/main')
-rw-r--r--plugins/base/src/main/resources/dokka/scripts/platformContentHandler.js17
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")) {