From 3ee54b3cf0656f7aafe1f5ac345a7e3112638f59 Mon Sep 17 00:00:00 2001 From: uukelele-scratch Date: Thu, 10 Apr 2025 14:10:29 +0100 Subject: [PATCH] profile now shows all profiles in directory + other minor improvements --- src/server/public/index.html | 25 ++++++++++++++----------- src/server/public/styles.css | 1 + 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/server/public/index.html b/src/server/public/index.html index 4343abf..6dee613 100644 --- a/src/server/public/index.html +++ b/src/server/public/index.html @@ -187,13 +187,15 @@ function getProfilesFromPath() { socket.emit('get-profile-dir', (response) => { pathProfiles = response; - console.log(response); }) } function toggleSettings() { document.getElementById("settingsContainer").style.display = document.getElementById("settingsContainer").style.display === "none" ? "block" : "none"; document.getElementById("settingsToggler").innerText = document.getElementById("settingsToggler").innerText === "Show Settings" ? "Hide Settings" : "Show Settings"; + if (document.getElementById("settingsContainer").style.display = "block") { + getSettings(); + } } let settings; @@ -226,13 +228,18 @@ const item = Array.from(list.querySelectorAll('.list-item')) .find(item => item.querySelector('input[type="text"]').value === element); if (item) { - console.log(`Setting this to ${enabled}: `) const checkbox = item.querySelector('input[type="checkbox"]'); - console.log(checkbox) - console.log(checkbox.checked) + console.log(`Setting this to ${enabled}: `, checkbox); + console.log("Checkbox in DOM?", document.body.contains(checkbox)); + console.log("Before: ", checkbox.checked); checkbox.checked = enabled; - console.log("After: ") - console.log(checkbox.checked) + console.log("After: ", checkbox.checked); + const itemName = item.querySelector('.name'); + if (checkbox.checked) { + itemName.classList.remove('not-selected'); + } else { + itemName.classList.add('not-selected'); + } } else { addProfileItem(listId, element, enabled); } @@ -287,10 +294,9 @@ if (pathProfiles !== undefined) { clearInterval(intervalId); updateListItem("mcProfileList", pathProfiles, enabled=false); + updateListItem("mcProfileList", settings["profiles"], enabled=true, clear = false); } }, 50); - updateListItem("mcProfileList", settings["profiles"], enabled=true, clear = false); - console.log(`updated with ${settings["profiles"]}`); } function getNewSettings() { @@ -374,9 +380,6 @@ .map(item => item.querySelector('input[type="text"]').value); return names; } - - - getSettings(); diff --git a/src/server/public/styles.css b/src/server/public/styles.css index f20c2d2..7f22d1e 100644 --- a/src/server/public/styles.css +++ b/src/server/public/styles.css @@ -69,6 +69,7 @@ code { .list-item .name.not-selected { text-decoration: line-through; + color: #929292 } .agent {