aboutsummaryrefslogtreecommitdiffhomepage
path: root/theme.js
diff options
context:
space:
mode:
authorjohannst <johannst@users.noreply.github.com>2021-06-02 22:38:57 +0000
committerjohannst <johannst@users.noreply.github.com>2021-06-02 22:38:57 +0000
commitd2d2ba7c6602e73dc2e3dbd0aa4215e4c412a688 (patch)
tree360d361f769b79d9af2c02758eaa05fb887bf679 /theme.js
downloadmini-kvm-rs-d2d2ba7c6602e73dc2e3dbd0aa4215e4c412a688.tar.gz
mini-kvm-rs-d2d2ba7c6602e73dc2e3dbd0aa4215e4c412a688.zip
deploy: d2e2063cb2b5a82709e9c5188602a9fc0f7dadbd
Diffstat (limited to 'theme.js')
-rw-r--r--theme.js1
1 files changed, 1 insertions, 0 deletions
diff --git a/theme.js b/theme.js
new file mode 100644
index 0000000..8f9c49a
--- /dev/null
+++ b/theme.js
@@ -0,0 +1 @@
+var themes=document.getElementById("theme-choices");var themePicker=document.getElementById("theme-picker");function showThemeButtonState(){themes.style.display="block";themePicker.style.borderBottomRightRadius="0";themePicker.style.borderBottomLeftRadius="0"}function hideThemeButtonState(){themes.style.display="none";themePicker.style.borderBottomRightRadius="3px";themePicker.style.borderBottomLeftRadius="3px"}function switchThemeButtonState(){if(themes.style.display==="block"){hideThemeButtonState()}else{showThemeButtonState()}};function handleThemeButtonsBlur(e){var active=document.activeElement;var related=e.relatedTarget;if(active.id!=="theme-picker"&&(!active.parentNode||active.parentNode.id!=="theme-choices")&&(!related||(related.id!=="theme-picker"&&(!related.parentNode||related.parentNode.id!=="theme-choices")))){hideThemeButtonState()}}themePicker.onclick=switchThemeButtonState;themePicker.onblur=handleThemeButtonsBlur;["ayu","dark","light"].forEach(function(item){var but=document.createElement("button");but.textContent=item;but.onclick=function(el){switchTheme(currentTheme,mainTheme,item,true);useSystemTheme(false)};but.onblur=handleThemeButtonsBlur;themes.appendChild(but)}) \ No newline at end of file