MCPcopy Create free account
hub / github.com/SKVNDR/FastDork / setupTabStructure

Function setupTabStructure

Script/FastDork.js:513–559  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

511 contentContainer.style.height = "";
512 }
513 function setupTabStructure() {
514 const tabsContainer = document.getElementById("icetab-container");
515 const contentContainer = document.getElementById("icetab-content");
516 if (!tabsContainer || !contentContainer) return;
517 const tabs = tabsContainer.children;
518 const tabContents = contentContainer.children;
519 if (
520 !tabs ||
521 !tabContents ||
522 tabs.length === 0 ||
523 tabs.length !== tabContents.length
524 ) {
525 console.error("Tab structure elements not found or mismatched.");
526 return;
527 }
528 Array.from(tabs).forEach((tab, index) => {
529 if (!tab) return;
530 tab.dataset.index = index;
531 tab.addEventListener("click", function () {
532 const tabIndex = parseInt(this.dataset.index);
533 Array.from(tabs).forEach((t) => t?.classList.remove("current-tab"));
534 Array.from(tabContents).forEach((c) =>
535 c?.classList.remove("tab-active")
536 );
537 this.classList.add("current-tab");
538 if (tabContents[tabIndex]) {
539 tabContents[tabIndex].classList.add("tab-active");
540 }
541 syncActiveTabHeight();
542 if (tabIndex === 0 && UI.listTab1) {
543 updateDorkCounter(UI.listTab1.value);
544 } else if (tabIndex === 1) {
545 initializeImportButtonLogic();
546 } else if (tabIndex === 2) {
547 resetSettingsTabView();
548 }
549 });
550 });
551 if (!tabsContainer.querySelector(".current-tab") && tabs.length > 0) {
552 tabs[0]?.classList.add("current-tab");
553 tabContents[0]?.classList.add("tab-active");
554 }
555 if (tabs[0]?.classList.contains("current-tab") && UI.listTab1) {
556 updateDorkCounter(UI.listTab1.value);
557 }
558 syncActiveTabHeight();
559 }
560 function createDefaultOption(text = "Select...", value = "0") {
561 const option = document.createElement("option");
562 option.value = value;

Callers 1

initializeFunction · 0.85

Calls 4

syncActiveTabHeightFunction · 0.85
updateDorkCounterFunction · 0.85
resetSettingsTabViewFunction · 0.85

Tested by

no test coverage detected