Fix theme toggle: move init to app.js, remove duplicate script
- Theme initialized BEFORE page render (no flash) - toggleTheme() now in app.js global scope - Proxy page rewritten with btn-filled MD3 class
This commit is contained in:
@@ -58,18 +58,3 @@
|
||||
<script src="./static/js/app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<script>
|
||||
function toggleTheme(){
|
||||
var t=document.documentElement.getAttribute("data-theme")==="light"?"dark":"light";
|
||||
document.documentElement.setAttribute("data-theme",t);
|
||||
localStorage.setItem("sensu-theme",t);
|
||||
document.querySelector(".theme-toggle").textContent=t==="light"?"☀️":"🌙";
|
||||
}
|
||||
(function(){
|
||||
var s=localStorage.getItem("sensu-theme")||"dark";
|
||||
document.documentElement.setAttribute("data-theme",s);
|
||||
var btn=document.querySelector(".theme-toggle");
|
||||
if(btn) btn.textContent=s==="light"?"☀️":"🌙";
|
||||
})();
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user