Updated dependencies

This commit is contained in:
Erik C. Thauvin 2023-04-20 02:22:02 -07:00
parent ad1544c6ef
commit 3d6101d165
140 changed files with 2651 additions and 1906 deletions

File diff suppressed because one or more lines are too long

View file

@ -129,22 +129,39 @@ function handleAnchor() {
highlightedAnchor = null;
}
let searchForTab = function (element) {
let searchForContentTarget = function (element) {
if (element && element.hasAttribute) {
if (element.hasAttribute("data-togglable")) return element;
else return searchForTab(element.parentNode)
if (element.hasAttribute("data-togglable")) return element.getAttribute("data-togglable");
else return searchForContentTarget(element.parentNode)
} else return null
}
let findAnyTab = function (target) {
let result = null
document.querySelectorAll('div[tabs-section] > button[data-togglable]')
.forEach(node => {
if(node.getAttribute("data-togglable").split(",").includes(target)) {
result = node
}
})
return result
}
let anchor = window.location.hash
if (anchor != "") {
anchor = anchor.substring(1)
let element = document.querySelector('a[data-name="' + anchor + '"]')
if (element) {
let tab = searchForTab(element)
if (tab) {
toggleSections(tab)
}
const content = element.nextElementSibling
const contentStyle = window.getComputedStyle(content)
if(contentStyle.display == 'none') {
let tab = findAnyTab(searchForContentTarget(content))
if (tab) {
toggleSections(tab)
}
}
if (content) {
content.classList.add('anchor-highlight')
highlightedAnchor = content
@ -174,10 +191,7 @@ function initTabs() {
function showCorrespondingTabBody(element) {
const buttonWithKey = element.querySelector("button[data-active]")
if (buttonWithKey) {
const key = buttonWithKey.getAttribute("data-togglable")
document.querySelector(".tabs-section-body")
.querySelector("div[data-togglable='" + key + "']")
.setAttribute("data-active", "")
toggleSections(buttonWithKey)
}
}
@ -249,7 +263,6 @@ function removeSourcesetFilterFromCache(sourceset) {
}
function toggleSections(target) {
localStorage.setItem('active-tab', JSON.stringify(target.getAttribute("data-togglable")))
const activateTabs = (containerClass) => {
for (const element of document.getElementsByClassName(containerClass)) {
for (const child of element.children) {
@ -261,13 +274,24 @@ function toggleSections(target) {
}
}
}
const toggleTargets = target.getAttribute("data-togglable").split(",")
const activateTabsBody = (containerClass) => {
document.querySelectorAll("." + containerClass + " *[data-togglable]")
.forEach(child => {
if (toggleTargets.includes(child.getAttribute("data-togglable"))) {
child.setAttribute("data-active", "")
} else if(!child.classList.contains("sourceset-dependent-content")) { // data-togglable is used to switch source set as well, ignore it
child.removeAttribute("data-active")
}
})
}
activateTabs("tabs-section")
activateTabs("tabs-section-body")
activateTabsBody("tabs-section-body")
}
function toggleSectionsEventHandler(evt) {
if (!evt.target.getAttribute("data-togglable")) return
localStorage.setItem('active-tab', JSON.stringify(evt.target.getAttribute("data-togglable")))
toggleSections(evt.target)
}