解决黑色主题下刷新页面有短时白闪的现象

This commit is contained in:
呆瓜云 2023-08-28 09:58:57 +08:00
parent 8419612522
commit b4d776a07c

View File

@ -6,6 +6,11 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="//cdn.staticfile.org/Primer/21.0.7/primer.css" rel="stylesheet" />
<link rel="icon" href="{{ blogBase['faviconUrl'] }}">
<script>
if(localStorage.getItem("meek_theme")==null){}
else if(localStorage.getItem("meek_theme")=="dark"){document.getElementsByTagName("html")[0].attributes.getNamedItem("data-color-mode").value="dark";}
else if(localStorage.getItem("meek_theme")=="light"){document.getElementsByTagName("html")[0].attributes.getNamedItem("data-color-mode").value="light";}
</script>
{% block head %}{% endblock %}
</head>
<style>
@ -35,13 +40,8 @@ body{
</body>
<script>
var IconList={{ IconList }};
document.getElementById("themeSwitch").setAttribute("d",value=IconList["sun"]);
if(localStorage.getItem("meek_theme")==null){localStorage.setItem("meek_theme","light")}
else if(localStorage.getItem("meek_theme")=="dark"){changeDark();}
else if(localStorage.getItem("meek_theme")=="light"){changeLight();}
var utterancesLoad=0
if(localStorage.getItem("meek_theme")==null){localStorage.setItem("meek_theme","light")}
var utterancesLoad=0;
if(localStorage.getItem("meek_theme")==null){localStorage.setItem("meek_theme","light");changeLight();}
else if(localStorage.getItem("meek_theme")=="dark"){changeDark();}
else if(localStorage.getItem("meek_theme")=="light"){changeLight();}