Inline style-switching JS into <head>
Cette révision appartient à :
Parent
a3e0cc0503
révision
d099a77c88
2 fichiers modifiés avec 9 ajouts et 6 suppressions
|
@ -1,10 +1,4 @@
|
|||
// Night mode
|
||||
var night = localStorage.getItem("night");
|
||||
if (night == "true") {
|
||||
$("#style")[0].href = "/css/style-night.css";
|
||||
$("#nighticon")[0].src = "/img/sun.png";
|
||||
}
|
||||
|
||||
function toggleNightMode() {
|
||||
var night = localStorage.getItem("night");
|
||||
if(night == "true") {
|
||||
|
|
|
@ -27,6 +27,15 @@
|
|||
|
||||
<!-- Website CSS -->
|
||||
<link rel="stylesheet" id="style" href="{{.URL.Parse "/css/style.css"}}">
|
||||
<script type="text/javascript">
|
||||
// Inlined here to allow early style switch
|
||||
if (localStorage.getItem("night") == "true") {
|
||||
document.getElementById("style").href = "/css/style-night.css";
|
||||
document.body.addEventListener("load", function() {
|
||||
document.getElementById("nighticon").src = "/img/sun.png";
|
||||
}, false);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-default" id="mainmenu">
|
||||
|
|
Référencer dans un nouveau ticket