istio.io/generated/js/styleSwitcher.min.js

3 lines
1.3 KiB
JavaScript

"use strict";function applyStyleSheet(a){const b=document.getElementsByTagName("link");for(let c=0;c<b.length;c++){const d=b[c];d.getAttribute("rel").includes("stylesheet")&&d.getAttribute("title")&&(d.disabled=!0,d.getAttribute("title")===a&&(d.disabled=!1))}let c=document.getElementById("light-theme-item");null!==c&&("Light Theme"===a?c.classList.add("active"):c.classList.remove("active")),c=document.getElementById("dark-theme-item"),null!==c&&("Dark Theme"===a?c.classList.add("active"):c.classList.remove("active"))}function createCookie(a,b,c){let d="";if(c){const a=new Date;a.setTime(a.getTime()+1e3*(60*(60*(24*c)))),d="; expires="+a.toGMTString()}document.cookie=a+"="+b+d+"; path=/"}function readCookie(a){const b=a+"=",d=document.cookie.split(";");for(let e,c=0;c<d.length;c++){for(e=d[c];" "===e.charAt(0);)e=e.substring(1,e.length);if(0===e.indexOf(b)){let a=e.substring(b.length,e.length);return"light"===a?a="Light Theme":"dark"==a&&(a="Dark Theme"),a}}return null}function setActiveStyleSheet(a){applyStyleSheet(a),createCookie("style",a)}function loadActiveStyleSheet(){let a=readCookie("style");null!==a&&applyStyleSheet(a)}loadActiveStyleSheet(),document.addEventListener("DOMContentLoaded",()=>{loadActiveStyleSheet()});
//# sourceMappingURL=styleSwitcher.min.js.map