mirror of
https://github.com/rolfiee/wiki.git
synced 2025-06-18 11:15:33 -04:00
Simply theme JS
This commit is contained in:
parent
549b90c341
commit
c861048b22
@ -15,7 +15,7 @@
|
||||
<link id="bootstrap-stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
|
||||
{% endif %}
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="/assets/css/style.css">
|
||||
<link id="theme-css" rel="stylesheet" type="text/css" media="screen" href="/assets/css/style.css">
|
||||
<script src="/assets/js/theme.js"></script>
|
||||
|
||||
{% include favicon.html %}
|
||||
|
@ -1,22 +1,9 @@
|
||||
function loadTheme() {
|
||||
const themeCSS = document.getElementById("themeCSS");
|
||||
if(!localStorage.theme || localStorage.theme == "default") {
|
||||
if(themeCSS)
|
||||
themeCSS.remove();
|
||||
} else {
|
||||
if(themeCSS) {
|
||||
themeCSS.href = "/assets/css/" + localStorage.theme +".css";
|
||||
} else {
|
||||
const l = document.createElement("link");
|
||||
l.rel = "stylesheet";
|
||||
l.type = "text/css";
|
||||
l.media = "screen";
|
||||
l.href = "/assets/css/" + localStorage.theme +".css"
|
||||
l.id = "themeCSS";
|
||||
|
||||
document.head.appendChild(l);
|
||||
}
|
||||
}
|
||||
const themeCSS = document.getElementById("theme-css");
|
||||
if(!localStorage.theme || localStorage.theme == "default")
|
||||
themeCSS.href = "/assets/css/style.css";
|
||||
else
|
||||
themeCSS.href = "/assets/css/" + localStorage.theme + ".css";
|
||||
}
|
||||
|
||||
function setTheme(theme) {
|
||||
|
Loading…
Reference in New Issue
Block a user