diff options
Diffstat (limited to 'plugins/base/src/main/resources/dokka/scripts')
-rw-r--r-- | plugins/base/src/main/resources/dokka/scripts/platformContentHandler.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/plugins/base/src/main/resources/dokka/scripts/platformContentHandler.js b/plugins/base/src/main/resources/dokka/scripts/platformContentHandler.js index f0e08f48..78d65333 100644 --- a/plugins/base/src/main/resources/dokka/scripts/platformContentHandler.js +++ b/plugins/base/src/main/resources/dokka/scripts/platformContentHandler.js @@ -3,6 +3,8 @@ filteringContext = { restrictedDependencies: [], activeFilters: [] } +let highlightedAnchor; + window.addEventListener('load', () => { document.querySelectorAll("div[data-platform-hinted]") .forEach(elem => elem.addEventListener('click', (event) => togglePlatformDependent(event,elem))) @@ -22,6 +24,11 @@ window.addEventListener('load', () => { window.onhashchange = handleAnchor function handleAnchor() { + if(highlightedAnchor){ + highlightedAnchor.classList.remove('anchor-highlight') + highlightedAnchor = null; + } + let searchForTab = function(element) { if(element && element.hasAttribute) { if(element.hasAttribute("data-togglable")) return element; @@ -37,6 +44,11 @@ function handleAnchor() { if (tab) { let found = document.querySelector('.tabs-section > .section-tab[data-togglable="' + tab.getAttribute("data-togglable") + '"]') toggleSections(tab) + const content = element.nextElementSibling + if(content){ + content.classList.add('anchor-highlight') + highlightedAnchor = content + } element.scrollIntoView({behavior: "smooth"}) } } |