Added "Show Buttons" button
This commit is contained in:
parent
4ac985501a
commit
0523157649
@ -119,6 +119,14 @@ function updateStyle(type){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ButtonToggle(checkstate){
|
||||||
|
if (checkstate){
|
||||||
|
document.querySelector(".button-container").style.display = "flex";
|
||||||
|
} else {
|
||||||
|
document.querySelector(".button-container").style.display = "none";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function LoadWebsite(){
|
function LoadWebsite(){
|
||||||
|
|
||||||
dirDepth = document.getElementById("toplevel").getAttribute("data-");
|
dirDepth = document.getElementById("toplevel").getAttribute("data-");
|
||||||
@ -208,11 +216,19 @@ function LoadWebsite(){
|
|||||||
footing.appendChild(webside_name);
|
footing.appendChild(webside_name);
|
||||||
|
|
||||||
var button_span = document.createElement("span");
|
var button_span = document.createElement("span");
|
||||||
button_span.setAttribute("class", "prefSpan")
|
button_span.setAttribute("class", "prefSpan");
|
||||||
button_span.textContent = "Style: "
|
|
||||||
|
|
||||||
|
|
||||||
|
var button_select_label = document.createElement("label");
|
||||||
|
button_select_label.textContent = "Style: ";
|
||||||
|
button_select_label.setAttribute("for", "styleselector");
|
||||||
|
button_select_label.setAttribute("class", "styleSelector");
|
||||||
|
|
||||||
var button_select = document.createElement("select");
|
var button_select = document.createElement("select");
|
||||||
button_select.id = "styleselector";
|
button_select.id = "styleselector";
|
||||||
|
button_select.setAttribute("class", "styleSelector");
|
||||||
|
|
||||||
|
|
||||||
for (let i = 0; i < styles.length; i++) {
|
for (let i = 0; i < styles.length; i++) {
|
||||||
var button_item = document.createElement("option");
|
var button_item = document.createElement("option");
|
||||||
@ -223,7 +239,34 @@ function LoadWebsite(){
|
|||||||
button_select.appendChild(button_item);
|
button_select.appendChild(button_item);
|
||||||
}
|
}
|
||||||
|
|
||||||
button_span.appendChild(button_select);
|
if (localStorage.getItem("showButtons") == undefined) localStorage.setItem("showButtons", "true")
|
||||||
|
|
||||||
|
var button_check_buttons = document.createElement("input");
|
||||||
|
button_check_buttons.type = "checkbox";
|
||||||
|
button_check_buttons.id = "buttonToggle";
|
||||||
|
button_check_buttons.setAttribute("class", "buttonToggle");
|
||||||
|
if (localStorage.getItem("showButtons") == "true") button_check_buttons.checked = true;
|
||||||
|
|
||||||
|
button_check_buttons.addEventListener("change", (event) => {
|
||||||
|
ButtonToggle(button_check_buttons.checked);
|
||||||
|
localStorage.setItem("showButtons", button_check_buttons.checked);
|
||||||
|
});
|
||||||
|
|
||||||
|
var button_check_label = document.createElement("label");
|
||||||
|
button_check_label.textContent = " Show Buttons";
|
||||||
|
button_check_label.setAttribute("for", "buttonToggle");
|
||||||
|
button_check_label.setAttribute("class", "buttonToggle");
|
||||||
|
|
||||||
|
button_span.appendChild(button_check_buttons);
|
||||||
|
button_span.appendChild(button_check_label);
|
||||||
|
|
||||||
|
button_span.appendChild(button_select_label);
|
||||||
|
button_select_label.appendChild(button_select);
|
||||||
|
|
||||||
|
if (document.getElementById("please-no-buttons") == null) ButtonToggle(localStorage.getItem("showButtons") == "true");
|
||||||
|
else ButtonToggle(false);
|
||||||
|
|
||||||
|
|
||||||
footing.appendChild(button_span);
|
footing.appendChild(button_span);
|
||||||
|
|
||||||
if(dirDepth === ""){
|
if(dirDepth === ""){
|
||||||
|
@ -439,12 +439,19 @@ input{
|
|||||||
|
|
||||||
|
|
||||||
.prefSpan{
|
.prefSpan{
|
||||||
width: fit-content;
|
|
||||||
margin-left: auto;
|
|
||||||
/* margin-top: -16px; */
|
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: #0066cc;
|
color: #0066cc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.buttonToggle {
|
||||||
|
width: fit-content;
|
||||||
|
}
|
||||||
|
|
||||||
|
.styleSelector {
|
||||||
|
float:right;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user