move PageSwitchTab

This commit is contained in:
ReznoRMichael 2021-08-01 22:45:47 +02:00
parent 130aca36a2
commit 7ec11846d1
3 changed files with 122 additions and 122 deletions

View file

@ -7080,57 +7080,6 @@ function GenerateInnerHTML(db) {
_HKCheckCompletion_js__WEBPACK_IMPORTED_MODULE_0__.benchmarkTimes.GenerateInnerHTML.timeEnd = performance.now();
}
/**
* Hides all other tabs, except the one which button was clicked (shows only the chosen tab)
* @param {String} clickedButton The click target (button clicked)
*/
function PageSwitchTab(clickedButton) {
var sectionList = document.querySelectorAll(".large-section");
var buttonList = document.querySelectorAll(".tab-switch");
/* Make Active Tab Visible */
for (var i = 0, length = sectionList.length; i < length; i++) {
/* Other tabs except the clicked one */
if (sectionList[i].id !== "tab-".concat(clickedButton)) {
if (!sectionList[i].classList.contains("hidden")) {
sectionList[i].classList.add("hidden");
}
}
/* The clicked tab */
else {
if (sectionList[i].classList.contains("hidden")) {
sectionList[i].classList.remove("hidden");
}
}
}
/* Make Active Button stand out */
for (var _i5 = 0, _length = buttonList.length; _i5 < _length; _i5++) {
/* Other buttons except the clicked one */
if (buttonList[_i5].id !== "button-switch-".concat(clickedButton)) {
if (buttonList[_i5].classList.contains("tab-active")) {
buttonList[_i5].classList.remove("tab-active");
}
}
/* The clicked button */
else {
if (!buttonList[_i5].classList.contains("tab-active")) {
buttonList[_i5].classList.add("tab-active");
}
}
}
/* remember this choice for subsequent page visits and browser restarts */
if (StorageAvailable('localStorage')) {
if (clickedButton) {
localStorage.setItem("hkTabActive", clickedButton);
}
}
}
function SectionDescription(section) {
return "<p class=\"section-description\">".concat(section.description, "</p>");
@ -7310,8 +7259,8 @@ function CheckboxSpoilersToggle() {
allClassElements[i].classList.add("blurred");
}
for (var _i6 = 0; _i6 < lengthRed; _i6++) {
allClassElementsRed[_i6].classList.add("blurred");
for (var _i5 = 0; _i5 < lengthRed; _i5++) {
allClassElementsRed[_i5].classList.add("blurred");
}
checkboxId.value = "spoilers-off";
@ -7324,12 +7273,12 @@ function CheckboxSpoilersToggle() {
break;
case "show":
for (var _i7 = 0; _i7 < length; _i7++) {
allClassElements[_i7].classList.remove("blurred");
for (var _i6 = 0; _i6 < length; _i6++) {
allClassElements[_i6].classList.remove("blurred");
}
for (var _i8 = 0; _i8 < lengthRed; _i8++) {
allClassElementsRed[_i8].classList.remove("blurred");
for (var _i7 = 0; _i7 < lengthRed; _i7++) {
allClassElementsRed[_i7].classList.remove("blurred");
}
checkboxId.value = "spoilers-on";
@ -7344,12 +7293,12 @@ function CheckboxSpoilersToggle() {
default:
// This runs when the checkbox is not checked
if (checkboxId.checked === false) {
for (var _i9 = 0; _i9 < length; _i9++) {
allClassElements[_i9].classList.add("blurred");
for (var _i8 = 0; _i8 < length; _i8++) {
allClassElements[_i8].classList.add("blurred");
}
for (var _i10 = 0; _i10 < lengthRed; _i10++) {
allClassElementsRed[_i10].classList.add("blurred");
for (var _i9 = 0; _i9 < lengthRed; _i9++) {
allClassElementsRed[_i9].classList.add("blurred");
}
checkboxId.value = "spoilers-off"; // remember this choice for subsequent page visits and browser restarts
@ -7361,12 +7310,12 @@ function CheckboxSpoilersToggle() {
break;
} // This runs when the checkbox is checked
else {
for (var _i11 = 0; _i11 < length; _i11++) {
allClassElements[_i11].classList.remove("blurred");
for (var _i10 = 0; _i10 < length; _i10++) {
allClassElements[_i10].classList.remove("blurred");
}
for (var _i12 = 0; _i12 < lengthRed; _i12++) {
allClassElementsRed[_i12].classList.remove("blurred");
for (var _i11 = 0; _i11 < lengthRed; _i11++) {
allClassElementsRed[_i11].classList.remove("blurred");
}
checkboxId.value = "spoilers-on"; // remember this choice for subsequent page visits and browser restarts
@ -7378,6 +7327,57 @@ function CheckboxSpoilersToggle() {
}
}
/**
* Hides all other tabs, except the one which button was clicked (shows only the chosen tab)
* @param {String} clickedButton The click target (button clicked)
*/
function PageSwitchTab(clickedButton) {
var sectionList = document.querySelectorAll(".large-section");
var buttonList = document.querySelectorAll(".tab-switch");
/* Make Active Tab Visible */
for (var i = 0, length = sectionList.length; i < length; i++) {
/* Other tabs except the clicked one */
if (sectionList[i].id !== "tab-".concat(clickedButton)) {
if (!sectionList[i].classList.contains("hidden")) {
sectionList[i].classList.add("hidden");
}
}
/* The clicked tab */
else {
if (sectionList[i].classList.contains("hidden")) {
sectionList[i].classList.remove("hidden");
}
}
}
/* Make Active Button stand out */
for (var _i12 = 0, _length = buttonList.length; _i12 < _length; _i12++) {
/* Other buttons except the clicked one */
if (buttonList[_i12].id !== "button-switch-".concat(clickedButton)) {
if (buttonList[_i12].classList.contains("tab-active")) {
buttonList[_i12].classList.remove("tab-active");
}
}
/* The clicked button */
else {
if (!buttonList[_i12].classList.contains("tab-active")) {
buttonList[_i12].classList.add("tab-active");
}
}
}
/* remember this choice for subsequent page visits and browser restarts */
if (StorageAvailable('localStorage')) {
if (clickedButton) {
localStorage.setItem("hkTabActive", clickedButton);
}
}
}
/**
* Detects whether Storage is both supported and available.
* MDN WebDocs https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API#feature-detecting_localstorage

File diff suppressed because one or more lines are too long

View file

@ -602,62 +602,6 @@ function GenerateInnerHTML(db) {
benchmarkTimes.GenerateInnerHTML.timeEnd = performance.now();
}
/**
* Hides all other tabs, except the one which button was clicked (shows only the chosen tab)
* @param {String} clickedButton The click target (button clicked)
*/
function PageSwitchTab(clickedButton) {
let sectionList = document.querySelectorAll(".large-section");
let buttonList = document.querySelectorAll(".tab-switch");
/* Make Active Tab Visible */
for (let i = 0, length = sectionList.length; i < length; i++) {
/* Other tabs except the clicked one */
if (sectionList[i].id !== `tab-${clickedButton}`) {
if (!sectionList[i].classList.contains("hidden")) {
sectionList[i].classList.add("hidden");
}
}
/* The clicked tab */
else {
if (sectionList[i].classList.contains("hidden")) {
sectionList[i].classList.remove("hidden");
}
}
}
/* Make Active Button stand out */
for (let i = 0, length = buttonList.length; i < length; i++) {
/* Other buttons except the clicked one */
if (buttonList[i].id !== `button-switch-${clickedButton}`) {
if (buttonList[i].classList.contains("tab-active")) {
buttonList[i].classList.remove("tab-active");
}
}
/* The clicked button */
else {
if (!buttonList[i].classList.contains("tab-active")) {
buttonList[i].classList.add("tab-active");
}
}
}
/* remember this choice for subsequent page visits and browser restarts */
if (StorageAvailable('localStorage')) {
if (clickedButton) {
localStorage.setItem("hkTabActive", clickedButton);
}
}
}
function SectionDescription(section) {
return `<p class="section-description">${section.description}</p>`;
@ -924,6 +868,62 @@ function CheckboxSpoilersToggle(param = "none") {
}
}
/**
* Hides all other tabs, except the one which button was clicked (shows only the chosen tab)
* @param {String} clickedButton The click target (button clicked)
*/
function PageSwitchTab(clickedButton) {
let sectionList = document.querySelectorAll(".large-section");
let buttonList = document.querySelectorAll(".tab-switch");
/* Make Active Tab Visible */
for (let i = 0, length = sectionList.length; i < length; i++) {
/* Other tabs except the clicked one */
if (sectionList[i].id !== `tab-${clickedButton}`) {
if (!sectionList[i].classList.contains("hidden")) {
sectionList[i].classList.add("hidden");
}
}
/* The clicked tab */
else {
if (sectionList[i].classList.contains("hidden")) {
sectionList[i].classList.remove("hidden");
}
}
}
/* Make Active Button stand out */
for (let i = 0, length = buttonList.length; i < length; i++) {
/* Other buttons except the clicked one */
if (buttonList[i].id !== `button-switch-${clickedButton}`) {
if (buttonList[i].classList.contains("tab-active")) {
buttonList[i].classList.remove("tab-active");
}
}
/* The clicked button */
else {
if (!buttonList[i].classList.contains("tab-active")) {
buttonList[i].classList.add("tab-active");
}
}
}
/* remember this choice for subsequent page visits and browser restarts */
if (StorageAvailable('localStorage')) {
if (clickedButton) {
localStorage.setItem("hkTabActive", clickedButton);
}
}
}
/**
* Detects whether Storage is both supported and available.
* MDN WebDocs https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API#feature-detecting_localstorage