remove duplicate tab functions and document tab functions
This commit is contained in:
parent
8ca3b30eb1
commit
8a84f23dde
2 changed files with 8 additions and 19 deletions
|
@ -447,19 +447,19 @@
|
||||||
<div class="col mb-1">
|
<div class="col mb-1">
|
||||||
<div class="row row-cols-1 rounded text-center dark-5 scaled-font">
|
<div class="row row-cols-1 rounded text-center dark-5 scaled-font">
|
||||||
<div class="row p-0 m-0 text-nowrap">
|
<div class="row p-0 m-0 text-nowrap">
|
||||||
<div id = "str-boost-tab" class="col eDam dark-4u fake-button elem-boost" onclick="toggle_boost_tab('str')">
|
<div id = "str-boost-btn" class="col eDam dark-4u fake-button elem-boost" onclick="show_tab('str-boost', ['str-boost', 'dex-boost', 'int-boost', 'def-boost', 'agi-boost'])">
|
||||||
Earth
|
Earth
|
||||||
</div>
|
</div>
|
||||||
<div id = "dex-boost-tab" class="col tDam dark-4u fake-button elem-boost" onclick="toggle_boost_tab('dex')">
|
<div id = "dex-boost-btn" class="col tDam dark-4u fake-button elem-boost" onclick="show_tab('dex-boost', ['str-boost', 'dex-boost', 'int-boost', 'def-boost', 'agi-boost'])">
|
||||||
Thunder
|
Thunder
|
||||||
</div>
|
</div>
|
||||||
<div id = "int-boost-tab" class="col wDam dark-4u fake-button elem-boost" onclick="toggle_boost_tab('int')">
|
<div id = "int-boost-btn" class="col wDam dark-4u fake-button elem-boost" onclick="show_tab('int-boost', ['str-boost', 'dex-boost', 'int-boost', 'def-boost', 'agi-boost'])">
|
||||||
Water
|
Water
|
||||||
</div>
|
</div>
|
||||||
<div id = "def-boost-tab" class="col fDam dark-4u fake-button elem-boost" onclick="toggle_boost_tab('def')">
|
<div id = "def-boost-btn" class="col fDam dark-4u fake-button elem-boost" onclick="show_tab('def-boost', ['str-boost', 'dex-boost', 'int-boost', 'def-boost', 'agi-boost'])">
|
||||||
Fire
|
Fire
|
||||||
</div>
|
</div>
|
||||||
<div id = "agi-boost-tab" class="col aDam dark-4u fake-button elem-boost" onclick="toggle_boost_tab('agi')">
|
<div id = "agi-boost-btn" class="col aDam dark-4u fake-button elem-boost" onclick="show_tab('agi-boost', ['str-boost', 'dex-boost', 'int-boost', 'def-boost', 'agi-boost'])">
|
||||||
Air
|
Air
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -124,7 +124,7 @@ function toggleButton(button_id) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// toggle tab
|
// Toggles display of a certain element, given the ID.
|
||||||
function toggle_tab(tab) {
|
function toggle_tab(tab) {
|
||||||
if (document.querySelector("#"+tab).style.display == "none") {
|
if (document.querySelector("#"+tab).style.display == "none") {
|
||||||
document.querySelector("#"+tab).style.display = "";
|
document.querySelector("#"+tab).style.display = "";
|
||||||
|
@ -133,20 +133,9 @@ function toggle_tab(tab) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggle_boost_tab(tab) {
|
// Toggle display of a certain tab, in a group of tabs, given the target tab ID, and a list of associated tabs.
|
||||||
for (const i of skp_order) {
|
// Also sets visual display of an element with ID of target + "-btn" to selected.
|
||||||
document.querySelector("#"+i+"-boost").style.display = "none";
|
|
||||||
document.getElementById(i + "-boost-tab").classList.remove("selected-btn");
|
|
||||||
}
|
|
||||||
document.querySelector("#"+tab+"-boost").style.display = "";
|
|
||||||
document.getElementById(tab + "-boost-tab").classList.add("selected-btn");
|
|
||||||
}
|
|
||||||
|
|
||||||
// let tabs = ['overall-stats', 'offensive-stats', 'defensive-stats'];
|
|
||||||
|
|
||||||
function show_tab(target, tabs) {
|
function show_tab(target, tabs) {
|
||||||
//console.log(itemFilters)
|
|
||||||
|
|
||||||
//hide all tabs, then show the tab of the div clicked and highlight the correct button
|
//hide all tabs, then show the tab of the div clicked and highlight the correct button
|
||||||
for (const i in tabs) {
|
for (const i in tabs) {
|
||||||
document.querySelector("#" + tabs[i]).style.display = "none";
|
document.querySelector("#" + tabs[i]).style.display = "none";
|
||||||
|
|
Loading…
Reference in a new issue