Use template for night theme switcher inline js
Cette révision appartient à :
Parent
a502dd8c3f
révision
34933e0b82
3 fichiers modifiés avec 16 ajouts et 24 suppressions
14
templates/_night_theme.html
Fichier normal
14
templates/_night_theme.html
Fichier normal
|
@ -0,0 +1,14 @@
|
|||
{{define "night_theme_init"}}
|
||||
<script type="text/javascript">
|
||||
// Night mode
|
||||
var night = localStorage.getItem("night");
|
||||
var darkStyleLink = document.createElement('link');
|
||||
darkStyleLink.id = "style-dark";
|
||||
darkStyleLink.rel = "stylesheet";
|
||||
darkStyleLink.type = "text/css";
|
||||
darkStyleLink.href = "/css/style-night.css"
|
||||
if (night == "true") {
|
||||
document.getElementsByTagName("head")[0].append(darkStyleLink);
|
||||
}
|
||||
</script>
|
||||
{{end}}
|
|
@ -26,18 +26,7 @@
|
|||
|
||||
<!-- Website CSS -->
|
||||
<link rel="stylesheet" id="style" href="{{.URL.Parse "/css/style.css"}}">
|
||||
<script type="text/javascript">
|
||||
// Night mode
|
||||
var night = localStorage.getItem("night");
|
||||
var darkStyleLink = document.createElement('link');
|
||||
darkStyleLink.id = "style-dark";
|
||||
darkStyleLink.rel = "stylesheet";
|
||||
darkStyleLink.type = "text/css";
|
||||
darkStyleLink.href = "/css/style-night.css"
|
||||
if (night == "true") {
|
||||
document.getElementsByTagName("head")[0].append(darkStyleLink);
|
||||
}
|
||||
</script>
|
||||
{{block "night_theme_init" .}}{{end}}
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-default" id="mainmenu">
|
||||
|
|
|
@ -30,18 +30,7 @@
|
|||
|
||||
<!-- Website CSS -->
|
||||
<link rel="stylesheet" id="style" href="{{.URL.Parse "/css/style.css"}}">
|
||||
<script type="text/javascript">
|
||||
// Night mode
|
||||
var night = localStorage.getItem("night");
|
||||
var darkStyleLink = document.createElement('link');
|
||||
darkStyleLink.id = "style-dark";
|
||||
darkStyleLink.rel = "stylesheet";
|
||||
darkStyleLink.type = "text/css";
|
||||
darkStyleLink.href = "/css/style-night.css"
|
||||
if (night == "true") {
|
||||
document.getElementsByTagName("head")[0].append(darkStyleLink);
|
||||
}
|
||||
</script>
|
||||
{{block "night_theme_init" .}}{{end}}
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-default" id="mainmenu">
|
||||
|
|
Référencer dans un nouveau ticket