aboutsummaryrefslogtreecommitdiffhomepage
path: root/settings.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 /settings.js
downloadmini-kvm-rs-d2d2ba7c6602e73dc2e3dbd0aa4215e4c412a688.tar.gz
mini-kvm-rs-d2d2ba7c6602e73dc2e3dbd0aa4215e4c412a688.zip
deploy: d2e2063cb2b5a82709e9c5188602a9fc0f7dadbd
Diffstat (limited to 'settings.js')
-rw-r--r--settings.js1
1 files changed, 1 insertions, 0 deletions
diff --git a/settings.js b/settings.js
new file mode 100644
index 0000000..b4d6fdc
--- /dev/null
+++ b/settings.js
@@ -0,0 +1 @@
+(function(){function changeSetting(settingName,value){updateLocalStorage("rustdoc-"+settingName,value);switch(settingName){case"preferred-dark-theme":case"preferred-light-theme":case"use-system-theme":updateSystemTheme();break}}function handleKey(ev){if(ev.ctrlKey||ev.altKey||ev.metaKey){return}switch(getVirtualKey(ev)){case"Enter":case"Return":case"Space":ev.target.checked=!ev.target.checked;ev.preventDefault();break}}function setEvents(){onEachLazy(document.getElementsByClassName("slider"),function(elem){var toggle=elem.previousElementSibling;var settingId=toggle.id;var settingValue=getSettingValue(settingId);if(settingValue!==null){toggle.checked=settingValue==="true"}toggle.onchange=function(){changeSetting(this.id,this.checked)};toggle.onkeyup=handleKey;toggle.onkeyrelease=handleKey});onEachLazy(document.getElementsByClassName("select-wrapper"),function(elem){var select=elem.getElementsByTagName("select")[0];var settingId=select.id;var settingValue=getSettingValue(settingId);if(settingValue!==null){select.value=settingValue}select.onchange=function(){changeSetting(this.id,this.value)}})}window.addEventListener("DOMContentLoaded",setEvents)})() \ No newline at end of file