mirror of
https://github.com/rvtr/wiki.git
synced 2025-06-19 03:25:40 -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">
|
<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 %}
|
{% 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>
|
<script src="/assets/js/theme.js"></script>
|
||||||
|
|
||||||
{% include favicon.html %}
|
{% include favicon.html %}
|
||||||
|
@ -1,22 +1,9 @@
|
|||||||
function loadTheme() {
|
function loadTheme() {
|
||||||
const themeCSS = document.getElementById("themeCSS");
|
const themeCSS = document.getElementById("theme-css");
|
||||||
if(!localStorage.theme || localStorage.theme == "default") {
|
if(!localStorage.theme || localStorage.theme == "default")
|
||||||
if(themeCSS)
|
themeCSS.href = "/assets/css/style.css";
|
||||||
themeCSS.remove();
|
else
|
||||||
} else {
|
themeCSS.href = "/assets/css/" + localStorage.theme + ".css";
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setTheme(theme) {
|
function setTheme(theme) {
|
||||||
|
Loading…
Reference in New Issue
Block a user