aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/resources/dokka/scripts
diff options
context:
space:
mode:
authorMarcin Aman <maman@virtuslab.com>2020-05-19 10:23:18 +0200
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-05-20 17:02:27 +0200
commit885bf34ac6d9b9a5974cab35d9dd5a224b0ccc4c (patch)
treeef76bef7da0bbbac47ff493da25cfdb284b609f2 /core/src/main/resources/dokka/scripts
parentdfefa90b4aa7ca0622cf01d14f4fb5083b8b74eb (diff)
downloaddokka-885bf34ac6d9b9a5974cab35d9dd5a224b0ccc4c.tar.gz
dokka-885bf34ac6d9b9a5974cab35d9dd5a224b0ccc4c.tar.bz2
dokka-885bf34ac6d9b9a5974cab35d9dd5a224b0ccc4c.zip
Tabs for sections v1
Diffstat (limited to 'core/src/main/resources/dokka/scripts')
-rw-r--r--core/src/main/resources/dokka/scripts/navigationLoader.js1
-rw-r--r--core/src/main/resources/dokka/scripts/platformContentHandler.js25
2 files changed, 24 insertions, 2 deletions
diff --git a/core/src/main/resources/dokka/scripts/navigationLoader.js b/core/src/main/resources/dokka/scripts/navigationLoader.js
index b30a866d..cac46d2a 100644
--- a/core/src/main/resources/dokka/scripts/navigationLoader.js
+++ b/core/src/main/resources/dokka/scripts/navigationLoader.js
@@ -6,7 +6,6 @@ window.addEventListener('load', () => {
}).then(() => {
document.querySelectorAll(".overview > a").forEach(link => {
link.setAttribute("href", pathToRoot + link.getAttribute("href"));
- console.log(link.attributes["href"])
})
}).then(() => {
document.querySelectorAll(".sideMenuPart").forEach(nav => {
diff --git a/core/src/main/resources/dokka/scripts/platformContentHandler.js b/core/src/main/resources/dokka/scripts/platformContentHandler.js
index b4a9e7c9..72c8daae 100644
--- a/core/src/main/resources/dokka/scripts/platformContentHandler.js
+++ b/core/src/main/resources/dokka/scripts/platformContentHandler.js
@@ -1,8 +1,31 @@
window.addEventListener('load', () => {
document.querySelectorAll("div[data-platform-hinted]")
.forEach(elem => elem.addEventListener('click', (event) => togglePlatformDependent(event,elem)))
+ document.querySelectorAll("div[tabs-section]")
+ .forEach(elem => elem.addEventListener('click', (event) => toggleSections(event)))
+ document.querySelector(".tabs-section-body")
+ .querySelector("div[data-togglable]")
+ .setAttribute("data-active", "")
+})
+
+function toggleSections(evt){
+ if(!evt.target.getAttribute("data-togglable")) return
+
+ const activateTabs = (containerClass) => {
+ for(const element of document.getElementsByClassName(containerClass)){
+ for(const child of element.children){
+ if(child.getAttribute("data-togglable") === evt.target.getAttribute("data-togglable")){
+ child.setAttribute("data-active", "")
+ } else {
+ child.removeAttribute("data-active")
+ }
+ }
+ }
}
-)
+
+ activateTabs("tabs-section")
+ activateTabs("tabs-section-body")
+}
function togglePlatformDependent(e, container) {
let target = e.target