getting modpack ids

This commit is contained in:
Cuptain 2024-06-23 14:12:41 +10:00
parent 4ffaf29645
commit 1fe3be506c
3 changed files with 24 additions and 17 deletions

View File

@ -8,11 +8,9 @@
<script type="module" src="/main.js" defer></script>
</head>
<style>
body {
background-image: src="assets/CityBase.png";
}
</style>
<body onload="load();">
@ -27,7 +25,9 @@
<select name="modSelect" id="Modpacks">
</select>
<button id="idsButton" type="button">Show Id</button>
<p type="text" id="showTheId"></p>
</div>
</body>
</html>

View File

@ -10,17 +10,13 @@ async function greet() {
}
window.addEventListener("DOMContentLoaded", () => {
greetInputEl = document.querySelector("#greet-input");
greetMsgEl = document.querySelector("#greet-msg");
document.querySelector("#greet-form").addEventListener("submit", (e) => {
e.preventDefault();
greet();
});
document.getElementById("idsButton").addEventListener("click", viewIds);
console.log("testing");
});
function packSelect() {
document.getElementById("myDropdown").classList.toggle("show");
}
function load() {
@ -38,16 +34,23 @@ window.onload = async function() {
}
function addModpacks(modpacks) {
var dropdown = document.getElementById("Modpacks");
modpacks.sort();
modpacks.reverse();
for (let i = 0; i < modpacks.length; i++){
var opt = document.createElement("option");
opt.text = modpacks[i];
opt.value = 'somethings value';
opt.text = modpacks[i].name;
opt.value = modpacks[i].id;
dropdown.options.add(opt);
}
}
function viewIds() {
var packId = document.getElementById("Modpacks");
var selectedId = packId.value;
document.getElementById("showTheId").textContent = selectedId;
console.log(selectedId);
}
//window.onclick = function(event) {

View File

@ -68,10 +68,14 @@ button {
font-size: 1em;
font-weight: 500;
font-family: inherit;
color: #0f0f0f;
color: #4df3ff;
background-color: #ffffff;
transition: border-color 0.25s;
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2);
width: 300px;
display: flex;
justify-content: center;
align-self: center;
}
button {
@ -141,7 +145,7 @@ button {
z-index: 1;
}
.dropdown-content a {
#text {
color: black;
padding: 12px 16px;
text-decoration: none;