introducing: collapsible menus for layers!! got the first few done, need to finish the rest of the layer customization menus

This commit is contained in:
2025-06-26 23:13:31 -04:00
parent 32a2cb844d
commit 2188ef0921
+67 -53
View File
@@ -112,6 +112,21 @@
width: auto; width: auto;
} }
.expandableMenuToggle {
cursor: pointer;
padding 18px;
width: 100%;
}
.expanded, .expandableMenuToggle:hover {
background-color: rgba(173, 165, 165, 0.8);
}
.expandableMenu {
display: none;
padding: 0 18px;
border-left: 2px solid black;
}
#instructionsTab { #instructionsTab {
} }
#bookmarkForm { #bookmarkForm {
@@ -172,7 +187,7 @@
<div id="settingsContainer" class="movable settingsContainer hidden"> <div id="settingsContainer" class="movable settingsContainer hidden">
<div id="tabList"> <div id="tabList">
<span class="tab" id="addContainerTab">containers / layers</span> <span class="tab" id="containerTab">containers / layers</span>
<span class="tab" id="imageAndWallpaperTab">images + wallpaper</span> <span class="tab" id="imageAndWallpaperTab">images + wallpaper</span>
<span class="tab" id="audioTab">audio</span> <span class="tab" id="audioTab">audio</span>
<span class="tab" id="globalSettingsTab">global settings</span> <span class="tab" id="globalSettingsTab">global settings</span>
@@ -482,6 +497,11 @@
containerSettings, containerSettings,
sections sections
) { ) {
/**
* TODO
* check if id is already used
* ensure there are no brackets in the name
*/
this.name = name; this.name = name;
this.id = name.replace(" ", "-"); this.id = name.replace(" ", "-");
@@ -669,91 +689,70 @@
/** /**
* creates container options menu in page settings menu * creates container options menu in page settings menu
*/ */
insertContainerSettingsListing() {
document.getElementById("containers").insertAdjacentHTML(
"beforeend",
`
/** /**
* TODO: * TODO:
* make the menus intially invisible
* implement a toggle visibility function
* add the classes for menu layer depths for easier distinction later
* brainstorm best approach to UI/UX for these nested menus
* --> remove "images" from wallpaper tab * --> remove "images" from wallpaper tab
* ----> furthermore, condense all global settings into one tab * ----> furthermore, condense all global settings into one tab
* ----- including wallpaper, audio, cursor * ----- including wallpaper, audio, cursor
* add toggles for each settings menu * add toggles for each settings menu
* rename settings form div ids (see "note to self") * rename settings form div ids (see "note to self")
*/ */
insertContainerSettingsListing() {
document.getElementById("containers").insertAdjacentHTML(
"beforeend",
`
<div class="containerListing" id=${this.id + "-container-listing"}> <div class="containerListing" id=${this.id + "-container-listing"}>
<p onclick="toggleContainerSettingsMenu(this)">${this.name} [expand]</p>
<div class="settingsMenu" id=${this.id + "-settings-menu"}> <p class="expandableMenuToggle" onclick="toggleExpandableMenu(this)">+ ${this.name}</p>
<div id=${this.id + "-bookmark-menu"} > <div class="expandableMenu" id=${this.id + "-settings-menu"}>
<h1 class="formTitle">add bookmarks</h1>
<div> <p class="expandableMenuToggle" onclick="toggleExpandableMenu(this)">+ ${this.id}: bookmarks</h1>
<div class="expandableMenu" id=${this.id + "-bookmark-menu"} >
<label> enter url: </label> <label> enter url: </label>
<input id=${this.id + "-url-input"} type="text" name="url" /> <input id=${this.id + "-url-input"} type="text" name="url" />
</div>
<div>
<label> enter label: </label> <label> enter label: </label>
<input id=${this.id + "-label-input"} type="text" name="label" /> <input id=${this.id + "-label-input"} type="text" name="label" />
</div>
<div>
<label> enter section (optional): </label> <label> enter section (optional): </label>
<input id=${this.id + "-section-input"} type="text" name="section" /> <input id=${this.id + "-section-input"} type="text" name="section" />
</div>
<br /><br />
<button onclick="addLink(${this.id})">add link</button> <button onclick="addLink(${this.id})">add link</button>
</div> </div>
<br /> <p class="expandableMenuToggle" onclick="toggleExpandableMenu(this)">+ ${this.id}: customize background color</p>
<div class="expandableMenu">
<div id=${this.id + "-customization-menu"}>
<h1 class="formTitle">customize layer</h1>
<span id=${this.id + "-background-options"}>
<p class="formTitle">change background</p>
<div>
<label>set background color: </label> <label>set background color: </label>
<input id=${this.id + "-settings-bg-color"} type="color" /> <input id=${this.id + "-settings-bg-color"} type="color" />
</div>
<div>
<label>set background opacity (%): </label> <label>set background opacity (%): </label>
<input id=${this.id + "-settings-bg-alpha"} /> <input id=${this.id + "-settings-bg-alpha"} />
</div> </div>
</span>
<br /> <p class="expandableMenuToggle" onclick="toggleExpandableMenu(this)">+ ${this.id}: text settings</p>
<div class="expandableMenu">
<span id=${this.id + "-text-options"}>
<h1 class="formTitle">change text</h1>
<div>
<label>change font (see instructions for more info):</label> <label>change font (see instructions for more info):</label>
<input id=${this.id + "-settings-font-input"} /> <input id=${this.id + "-settings-font-input"} />
<button id=${ <button id=${this.id + "-settings-set-font-button"}>set font</button>
this.id + "-settings-set-font-button"
}>set font</button>
<label>current font:</label><span id=${
this.id + "-settings-font-name"
}></span>
</div>
</span>
<label>current font:</label>
<span id=${this.id + "-settings-font-name"}></span>
<br /><br />
<label>align text:</label>
<br /> <br />
<div class="formTitle">align text:</div>
<div>
<label for=${this.id + "-settings-left-align"}>left</label> <label for=${this.id + "-settings-left-align"}>left</label>
<input id=${ <input id=${this.id + "-settings-left-align"} type="radio" name="align" />
this.id + "-settings-left-align"
} type="radio" name="align" />
<label for=${this.id + "-settings-center-align"}>center</label> <label for=${this.id + "-settings-center-align"}>center</label>
<input id=${ <input id=${this.id + "-settings-center-align"} type="radio" name="align" />
this.id + "-settings-center-align"
} type="radio" name="align" />
</div> </div>
<br />
<div class="formTitle">customize sections</div> <div class="formTitle">customize sections</div>
<div> <div>
@@ -1543,6 +1542,21 @@
} }
} }
function toggleExpandableMenu(toggleButton) {
toggleButton.classList.toggle("expanded");
let toggleButtonLabel = toggleButton.innerText;
let menuContent = toggleButton.nextElementSibling;
console.log(toggleButtonLabel);
if (menuContent.style.display === "block") {
menuContent.style.display = "none";
toggleButton.innerHTML = toggleButtonLabel.replace("-", "+");
} else {
menuContent.style.display = "block";
toggleButton.innerHTML = toggleButtonLabel.replace("+", "-");
}
}
function toggleImageRatio() { function toggleImageRatio() {
keepImageRatio = !document.getElementById("imageRatioToggle").checked; keepImageRatio = !document.getElementById("imageRatioToggle").checked;
} }