profile now shows all profiles in directory + other minor improvements

This commit is contained in:
uukelele-scratch 2025-04-10 14:10:29 +01:00
parent 669144ccc1
commit 3ee54b3cf0
2 changed files with 15 additions and 11 deletions

View file

@ -187,13 +187,15 @@
function getProfilesFromPath() { function getProfilesFromPath() {
socket.emit('get-profile-dir', (response) => { socket.emit('get-profile-dir', (response) => {
pathProfiles = response; pathProfiles = response;
console.log(response);
}) })
} }
function toggleSettings() { function toggleSettings() {
document.getElementById("settingsContainer").style.display = document.getElementById("settingsContainer").style.display === "none" ? "block" : "none"; 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"; document.getElementById("settingsToggler").innerText = document.getElementById("settingsToggler").innerText === "Show Settings" ? "Hide Settings" : "Show Settings";
if (document.getElementById("settingsContainer").style.display = "block") {
getSettings();
}
} }
let settings; let settings;
@ -226,13 +228,18 @@
const item = Array.from(list.querySelectorAll('.list-item')) const item = Array.from(list.querySelectorAll('.list-item'))
.find(item => item.querySelector('input[type="text"]').value === element); .find(item => item.querySelector('input[type="text"]').value === element);
if (item) { if (item) {
console.log(`Setting this to ${enabled}: `)
const checkbox = item.querySelector('input[type="checkbox"]'); const checkbox = item.querySelector('input[type="checkbox"]');
console.log(checkbox) console.log(`Setting this to ${enabled}: `, checkbox);
console.log(checkbox.checked) console.log("Checkbox in DOM?", document.body.contains(checkbox));
console.log("Before: ", checkbox.checked);
checkbox.checked = enabled; checkbox.checked = enabled;
console.log("After: ") console.log("After: ", checkbox.checked);
console.log(checkbox.checked) const itemName = item.querySelector('.name');
if (checkbox.checked) {
itemName.classList.remove('not-selected');
} else {
itemName.classList.add('not-selected');
}
} else { } else {
addProfileItem(listId, element, enabled); addProfileItem(listId, element, enabled);
} }
@ -287,10 +294,9 @@
if (pathProfiles !== undefined) { if (pathProfiles !== undefined) {
clearInterval(intervalId); clearInterval(intervalId);
updateListItem("mcProfileList", pathProfiles, enabled=false); updateListItem("mcProfileList", pathProfiles, enabled=false);
updateListItem("mcProfileList", settings["profiles"], enabled=true, clear = false);
} }
}, 50); }, 50);
updateListItem("mcProfileList", settings["profiles"], enabled=true, clear = false);
console.log(`updated with ${settings["profiles"]}`);
} }
function getNewSettings() { function getNewSettings() {
@ -374,9 +380,6 @@
.map(item => item.querySelector('input[type="text"]').value); .map(item => item.querySelector('input[type="text"]').value);
return names; return names;
} }
getSettings();
</script> </script>
</body> </body>
</html> </html>

View file

@ -69,6 +69,7 @@ code {
.list-item .name.not-selected { .list-item .name.not-selected {
text-decoration: line-through; text-decoration: line-through;
color: #929292
} }
.agent { .agent {