mirror of
https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
synced 2025-10-30 01:35:32 +00:00
Mergess TraditionRules with TextRules. Added tabs for other Text. Some bugs persist see readme
This commit is contained in:
@@ -1,92 +1,23 @@
|
||||
// Code specifically for the letter view
|
||||
const showhidebutton = function (
|
||||
buttonid,
|
||||
divid,
|
||||
buttonlist,
|
||||
divlist,
|
||||
starthidden
|
||||
) {
|
||||
let button = document.getElementById(buttonid);
|
||||
let div = document.getElementById(divid);
|
||||
// // Code specifically for the letter view
|
||||
let activetab = null;
|
||||
let activetabbtn = null;
|
||||
let tabbtnlist = document.querySelectorAll(".ha-tabbtn");
|
||||
let tablist = document.querySelectorAll(".ha-tab");
|
||||
|
||||
if (starthidden && div !== null) {
|
||||
div.classList.add("hide");
|
||||
}
|
||||
for (let i = 0; i < tabbtnlist.length; i++) {
|
||||
tablist[i].classList.add("hidden");
|
||||
tabbtnlist[i].addEventListener("click", () => {
|
||||
if (activetab != null)
|
||||
activetab.classList.add("hidden");
|
||||
if (activetabbtn != null)
|
||||
activetabbtn.classList.remove("active");
|
||||
|
||||
if (!starthidden && button !== null) {
|
||||
button.classList.add("active");
|
||||
}
|
||||
tablist[i].classList.remove("hidden");
|
||||
tabbtnlist[i].classList.add("active");
|
||||
activetab = tablist[i];
|
||||
activetabbtn = tabbtnlist[i];
|
||||
});
|
||||
}
|
||||
|
||||
if (button !== null) {
|
||||
button.addEventListener("click", function () {
|
||||
for (let btn of buttonlist) {
|
||||
let inactivebutton = document.getElementById(btn);
|
||||
if (inactivebutton !== null) inactivebutton.classList.remove("active");
|
||||
}
|
||||
|
||||
for (let element of divlist) {
|
||||
let hiddenelement = document.getElementById(element);
|
||||
if (hiddenelement !== null) {
|
||||
hiddenelement.classList.add("hide")
|
||||
hiddenelement.classList.remove("flow-root");
|
||||
};
|
||||
}
|
||||
|
||||
if (button !== null) button.classList.add("active");
|
||||
if (div !== null) {
|
||||
div.classList.add("flow-root");
|
||||
div.classList.remove("hide");
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// Letter View: Show / Hide Tabs
|
||||
let buttonlist = ["ha-lettertextbtn", "ha-additionsbtn", "ha-marginalsbtn"];
|
||||
let divlist = ["ha-lettertext", "ha-additions", "ha-marginals"];
|
||||
|
||||
if (this.document.getElementById("ha-lettertextbtn") !== null) {
|
||||
showhidebutton(
|
||||
"ha-lettertextbtn",
|
||||
"ha-lettertext",
|
||||
buttonlist,
|
||||
divlist,
|
||||
false
|
||||
);
|
||||
showhidebutton(
|
||||
"ha-additionsbtn",
|
||||
"ha-additions",
|
||||
buttonlist,
|
||||
divlist,
|
||||
true
|
||||
);
|
||||
showhidebutton(
|
||||
"ha-marginalsbtn",
|
||||
"ha-marginals",
|
||||
buttonlist,
|
||||
divlist,
|
||||
true
|
||||
);
|
||||
} else {
|
||||
showhidebutton(
|
||||
"ha-lettertextbtn",
|
||||
"ha-lettertext",
|
||||
buttonlist,
|
||||
divlist,
|
||||
true
|
||||
);
|
||||
showhidebutton(
|
||||
"ha-additionsbtn",
|
||||
"ha-additions",
|
||||
buttonlist,
|
||||
divlist,
|
||||
false
|
||||
);
|
||||
showhidebutton(
|
||||
"ha-marginalsbtn",
|
||||
"ha-marginals",
|
||||
buttonlist,
|
||||
divlist,
|
||||
true
|
||||
);
|
||||
}
|
||||
if (tabbtnlist.length > 0)
|
||||
tabbtnlist[0].click();
|
||||
Reference in New Issue
Block a user