3 lines
1.2 KiB
JavaScript
3 lines
1.2 KiB
JavaScript
"use strict";!function(){var e=document.getElementById("darkmode-css"),t="user-color-scheme",r=function(e){try{return localStorage.getItem(e)}catch(t){return null}},n=function(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"},d={dark:!0,light:!0},a=function(a){var o=a||r(t),c=n();switch(document.documentElement.setAttribute("data-theme",o||c),d[o]&&o!==c||(!function(e){try{localStorage.removeItem(e)}catch(t){}}(t),o=null),o){case"dark":e.setAttribute("media","all"),e.removeAttribute("disabled");break;case"light":e.setAttribute("disabled","disabled");break;default:e.setAttribute("media","(prefers-color-scheme: dark)"),e.removeAttribute("disabled")}},o={dark:"light",light:"dark"},c=function(){var e=r(t);return e=d[e]?o[e]:o[n()],function(e,t){try{localStorage.setItem(e,t)}catch(r){}}(t,e),e};a();var i=function l(){document.removeEventListener("DOMContentLoaded",l,!1),window.removeEventListener("load",l,!1),document.getElementById("darkmode-switch").addEventListener("click",(function(){a(c())}))};"complete"===document.readyState?setTimeout(i):(document.addEventListener("DOMContentLoaded",i,!1),window.addEventListener("load",i,!1))}();
|
|
//# sourceMappingURL=../maps/kr-dark.min.js.map
|