Inline style-switching JS into <head>
Cette révision appartient à :
Parent
380237b24e
révision
725c6acca0
2 fichiers modifiés avec 9 ajouts et 6 suppressions
|
@ -1,10 +1,4 @@
|
||||||
// Night mode
|
// 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() {
|
function toggleNightMode() {
|
||||||
var night = localStorage.getItem("night");
|
var night = localStorage.getItem("night");
|
||||||
if(night == "true") {
|
if(night == "true") {
|
||||||
|
|
|
@ -27,6 +27,15 @@
|
||||||
|
|
||||||
<!-- Website CSS -->
|
<!-- Website CSS -->
|
||||||
<link rel="stylesheet" id="style" href="{{.URL.Parse "/css/style.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>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<nav class="navbar navbar-default" id="mainmenu">
|
<nav class="navbar navbar-default" id="mainmenu">
|
||||||
|
|
Référencer dans un nouveau ticket