diff options
author | Filip Zybała <fzybala@virtuslab.com> | 2020-04-06 14:24:07 +0200 |
---|---|---|
committer | Kamil Doległo <kamilok1965@users.noreply.github.com> | 2020-04-15 14:41:29 +0200 |
commit | 72db3a16521408509f4a0f61ef110851a252d2cc (patch) | |
tree | 24f0a93c809045d66063c4c643d6ded4d4c6a0bc /core/src/main/resources/dokka/scripts | |
parent | fee86d79a3aa7357c68c2f8f519d187f43447e8c (diff) | |
download | dokka-72db3a16521408509f4a0f61ef110851a252d2cc.tar.gz dokka-72db3a16521408509f4a0f61ef110851a252d2cc.tar.bz2 dokka-72db3a16521408509f4a0f61ef110851a252d2cc.zip |
Change PlatformHintedContent rendering, js and css to match Figma style
Diffstat (limited to 'core/src/main/resources/dokka/scripts')
-rw-r--r-- | core/src/main/resources/dokka/scripts/navigationLoader.js | 4 | ||||
-rw-r--r-- | core/src/main/resources/dokka/scripts/platformContentHandler.js | 29 |
2 files changed, 31 insertions, 2 deletions
diff --git a/core/src/main/resources/dokka/scripts/navigationLoader.js b/core/src/main/resources/dokka/scripts/navigationLoader.js index 5fe52ade..ecbabb4c 100644 --- a/core/src/main/resources/dokka/scripts/navigationLoader.js +++ b/core/src/main/resources/dokka/scripts/navigationLoader.js @@ -1,4 +1,4 @@ -onload = () => { +window.addEventListener('load', () => { fetch(pathToRoot + "navigation.html") .then(response => response.text()) .then(data => { @@ -15,7 +15,7 @@ onload = () => { }).then(() => { revealNavigationForCurrentPage() }) -}; +}) revealNavigationForCurrentPage = () => { let pageId = document.getElementById("content").attributes["pageIds"].value.toString(); diff --git a/core/src/main/resources/dokka/scripts/platformContentHandler.js b/core/src/main/resources/dokka/scripts/platformContentHandler.js new file mode 100644 index 00000000..b4a9e7c9 --- /dev/null +++ b/core/src/main/resources/dokka/scripts/platformContentHandler.js @@ -0,0 +1,29 @@ +window.addEventListener('load', () => { + document.querySelectorAll("div[data-platform-hinted]") + .forEach(elem => elem.addEventListener('click', (event) => togglePlatformDependent(event,elem))) + } +) + +function togglePlatformDependent(e, container) { + let target = e.target + if (target.tagName != 'BUTTON') return; + let index = target.getAttribute('data-toggle') + + for(let child of container.children){ + if(child.hasAttribute('data-toggle-list')){ + for(let bm of child.children){ + if(bm == target){ + bm.setAttribute('data-active',"") + } else if(bm != target) { + bm.removeAttribute('data-active') + } + } + } + else if(child.getAttribute('data-togglable') == index) { + child.setAttribute('data-active',"") + } + else { + child.removeAttribute('data-active') + } + } +} |