fix: closes #37
This commit is contained in:
@@ -15,6 +15,13 @@ function tabs() {
|
||||
elm.classList.remove("selected");
|
||||
}
|
||||
child.classList.add("selected");
|
||||
|
||||
for (const childElm of child.parentElement.children) {
|
||||
if (childElm.classList.contains("selected")) {
|
||||
childElm.classList.remove("selected")
|
||||
}
|
||||
}
|
||||
|
||||
document.querySelector(`.tabs .content[data-tab="${
|
||||
child.getAttribute("data-tab")
|
||||
}"]`)?.classList.add("selected");
|
||||
@@ -41,6 +48,55 @@ function tabs() {
|
||||
|
||||
}
|
||||
}
|
||||
for (const elm of document.querySelectorAll(".tabs-header")) {
|
||||
let count = 0;
|
||||
let selected = 0;
|
||||
for (const child of elm.children[0].children) {
|
||||
if (child.tagName == "BUTTON") {
|
||||
count++;
|
||||
if (child.classList.contains("selected")) {
|
||||
selected++;
|
||||
}
|
||||
if (!child.getAttribute("data-armed")) {
|
||||
child.addEventListener("click", () => {
|
||||
if (!child.classList.contains("selected")) {
|
||||
for (const elm of child.parentElement.children) {
|
||||
elm.classList.remove("selected");
|
||||
}
|
||||
child.classList.add("selected");
|
||||
|
||||
for (const childElm of child.parentElement.parentElement.children) {
|
||||
if (childElm.classList.contains("selected")) {
|
||||
childElm.classList.remove("selected")
|
||||
}
|
||||
}
|
||||
|
||||
document.querySelector(`.tabs-header .content[data-tab="${
|
||||
child.getAttribute("data-tab")
|
||||
}"]`)?.classList.add("selected");
|
||||
}
|
||||
});
|
||||
child.setAttribute("data-armed", "true")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (selected > 1 || selected == 0) {
|
||||
for (const child of elm.children) {
|
||||
child.classList.remove("selected");
|
||||
}
|
||||
for (const child of elm.children[0].children) {
|
||||
if (child.tagName == "BUTTON") {
|
||||
child.classList.add("selected");
|
||||
document.querySelector(`.tabs .content[data-tab="${
|
||||
child.getAttribute("data-tab")
|
||||
}"]`)?.classList.add("selected");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
function load() {
|
||||
for (const elm of document.querySelectorAll("form > button")) {
|
||||
|
||||
Reference in New Issue
Block a user