From 72cd71db97d1d11c844eb95b1412c7b7d3d824ed Mon Sep 17 00:00:00 2001 From: Geindre Colin Date: Thu, 25 Feb 2021 09:13:58 +0100 Subject: [PATCH] change toggler to select --- Y/Scripts/yfold.js | 45 ++++++++++++++++++++++++++++++--------------- Y/ystyle.css | 7 +++++++ favicon.ico | Bin 0 -> 1150 bytes 3 files changed, 37 insertions(+), 15 deletions(-) create mode 100644 favicon.ico diff --git a/Y/Scripts/yfold.js b/Y/Scripts/yfold.js index 9ab6118..a5bc870 100644 --- a/Y/Scripts/yfold.js +++ b/Y/Scripts/yfold.js @@ -136,31 +136,48 @@ window.onload = function() { if (typeof(Storage) !== "undefined") { var theme = localStorage.getItem("theme"); console.log("theme : " + theme) - - if (theme === "/Y/ystyle.css") { - css_url = "/Y/ystyle.css"; - } else if (theme === "/Y/ystyle2.css") { - css_url = "/Y/ystyle2.css"; - changeCSS(css_url, 0) - } else { + if (theme == "null" || theme == null || theme == "undefined" || theme == undefined) { // Get default value css_url = "/Y/ystyle.css"; + } else { + css_url = theme; + changeCSS(css_url, 0) } } - var toggler = document.createElement("a") - toggler.setAttribute("id", "toggler") + var toggler = document.createElement("select") + + var liste = ["/Y/ystyle.css","/Y/ystyle2.css"]; + + toggler.id = "toggler"; + document.body.appendChild(toggler) + + let i = 1; + + //Create and append the options + for (let opt of liste) { + let option = document.createElement("option"); + option.value = opt; + option.text = "style " + i.toString(); + i++; + option.style.color = "white"; + console.log(option) + toggler.appendChild(option); + console.log("added option") + } + toggler.style.position = "absolute" - toggler.style.top = "12px" - toggler.style.right = "12px" + toggler.style.top = "18px" + toggler.style.right = "15px" toggler.style.padding = "10px" toggler.style.borderRadius = "7px" toggler.style.background = "#335" + toggler.style.border = "none" + toggler.style.appearance = "none" toggler.style.color = "#eee" toggler.style.zIndex = "12" - toggler.innerHTML = "theme" toggler.style.cursor = "pointer" - toggler.addEventListener("click", function() { + toggler.addEventListener("change", function() { if (css_url == "/Y/ystyle.css") { css_url = "/Y/ystyle2.css"; } else { @@ -168,8 +185,6 @@ window.onload = function() { } changeCSS(css_url, 0) }) - - document.body.appendChild(toggler) } function changeCSS(css_file, cssLinkIndex) { diff --git a/Y/ystyle.css b/Y/ystyle.css index 93713fe..63b2e05 100644 --- a/Y/ystyle.css +++ b/Y/ystyle.css @@ -477,6 +477,13 @@ img:hover { transition: all 0.3s; } +/* General styling */ + +::selection { + background-color: #113e9e; + color: lightgoldenrodyellow; +} + /* MEDIA */ @media (min-width: 1400px) { footer { diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..24d4c117c496438ef36695cbfa4a6bef29493469 GIT binary patch literal 1150 zcmaiz%PWLo6vmGzr8F~}Sy&i-3z5>)U?ZWX+;1}`mvSjggOx0%*ivId`~&P{YirF4 zJCt%M$<{=n@Od8N@Xp&zW_sp1=Xaj-&E@?@qySH^SMXXPi6Rldh*Uv9AQ=u5!7SG! zUK3lIsUEzcoAdFCo^#4%nw<-d?kZ=!8DDix#@TdLG)-xa&dgqF$L0GeN2Y(OGIB;& zMxS*0_QwL2bOnXYEcy@>w^*22ld%T#K?hJ$XQ*S)?>=V`Gd|7Ojv3!` zBkF0s=qzgZgg#i4L5`iz)en?5y&&tF>Mdz}%ayemcII_2>T7i=?crJHYwxm0=0x)= zv7}3B&snY=oAEmvJKy_cb}nC!-KUPi`cLZ`&-wDok>_upf}D1#3&Jm