Technological Bench: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| Line 101: | Line 101: | ||
</div> | </div> | ||
<!-- ================= PRODUCTION ================= --> | <!-- ================= PRODUCTION ================= --> | ||
<div id="slot2" class="mw-tab-content"></div> | <div id="slot2" class="mw-tab-content"> | ||
<div class="dropdown"> | |||
<select id="productionSelect"> | |||
<option value="">Select Item</option> | |||
<option value="primarysuppliesworkbench">Primary Supplies Workbench</option> | |||
</select> | |||
</div> | |||
<div id="productionOutput" class="output" style="display:none;"></div> | |||
</div> | |||
<!-- ================= COMBAT ================= --> | <!-- ================= COMBAT ================= --> | ||
<div id="slot3" class="mw-tab-content"></div> | <div id="slot3" class="mw-tab-content"></div> | ||
| Line 226: | Line 234: | ||
} | } | ||
}; | }; | ||
/* | /* PRODUCTION DATA */ | ||
const productionData = { | |||
primarysuppliesworkbench: { | |||
title: "Primary Supplies Workbench", | |||
lines: [ | |||
"<b>Tech Level 1:</b> 25 Wood + 17 Copper Ore", | |||
"<b>Tech Level 12:</b> 25 Wood + 17 Copper Ore" | |||
] | |||
} | } | ||
}; | }; | ||
/* DROPDOWN LOGIC */ | |||
function bindDropdown(selectId, outputId, data) { | |||
document.getElementById(selectId).onchange = function () { | |||
const val = this.value; | |||
const output = document.getElementById(outputId); | |||
if (!val) { | |||
output.style.display = "none"; | |||
return; | |||
} | |||
const item = data[val]; | |||
output.innerHTML = | |||
`<div class="output-title">${item.title}</div>` + | |||
item.lines.map(line => `<div class="output-line">${line}</div>`).join(""); | |||
output.style.display = "block"; | |||
}; | |||
} | |||
bindDropdown("survivalSelect", "survivalOutput", survivalData); | |||
bindDropdown("productionSelect", "productionOutput", productionData); | |||
</script> | </script> | ||
</html> | </html> | ||