No longer use img elements changed by js for the night mode toggle button. Use a css background on the <a>. Less JS is better JS.
Cette révision appartient à :
Parent
4a468ae687
révision
93206d2955
4 fichiers modifiés avec 15 ajouts et 9 suppressions
|
@ -66,3 +66,7 @@ a {
|
||||||
.dropdown-menu > li > a:focus, .dropdown-menu > li > a:hover {
|
.dropdown-menu > li > a:focus, .dropdown-menu > li > a:hover {
|
||||||
background: #263238;
|
background: #263238;
|
||||||
}
|
}
|
||||||
|
/* Night mode switcher */
|
||||||
|
#mainmenu a.nightswitch {
|
||||||
|
background-image: url(/img/moon.png);
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
/* Night mode switcher */
|
|
||||||
.nightswitch > img {
|
|
||||||
width: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Torrent status colors */
|
/* Torrent status colors */
|
||||||
.remake {
|
.remake {
|
||||||
|
@ -318,4 +315,12 @@ div.container div.blockBody:nth-of-type(2) table tr:first-of-type th:last-of-typ
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
min-height: 460px;
|
min-height: 460px;
|
||||||
}
|
}
|
||||||
|
/* Night mode switcher */
|
||||||
|
#mainmenu a.nightswitch {
|
||||||
|
background: transparent url(/img/sun.png) no-repeat;
|
||||||
|
background-size: 24px;
|
||||||
|
margin-top: 10px;
|
||||||
|
margin-left: 3px;
|
||||||
|
width: 24px;
|
||||||
|
}
|
||||||
|
|
|
@ -2,17 +2,14 @@
|
||||||
var night = localStorage.getItem("night");
|
var night = localStorage.getItem("night");
|
||||||
if (night == "true") {
|
if (night == "true") {
|
||||||
$("head").append('<link id="style-dark" rel="stylesheet" type="text/css" href="/css/style-night.css">');
|
$("head").append('<link id="style-dark" rel="stylesheet" type="text/css" 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") {
|
||||||
$("#style-dark")[0].remove()
|
$("#style-dark")[0].remove()
|
||||||
$("#nighticon")[0].src = "/img/moon.png";
|
|
||||||
} else {
|
} else {
|
||||||
$("head").append('<link id="style-dark" rel="stylesheet" type="text/css" href="/css/style-night.css">');
|
$("head").append('<link id="style-dark" rel="stylesheet" type="text/css" href="/css/style-night.css">');
|
||||||
$("#nighticon")[0].src = "/img/sun.png";
|
|
||||||
}
|
}
|
||||||
localStorage.setItem("night", (night == "true") ? "false" : "true");
|
localStorage.setItem("night", (night == "true") ? "false" : "true");
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
</button>
|
</button>
|
||||||
<a class="navbar-brand" href="{{.URL.Parse "/"}}">Nyaa Pantsu</a>
|
<a class="navbar-brand" href="{{.URL.Parse "/"}}">Nyaa Pantsu</a>
|
||||||
<a class="navbar-brand hidden-md pull-right nightswitch" href="javascript:toggleNightMode();" ><img id="nighticon" src="/img/moon.png"></a>
|
<a class="navbar-brand hidden-md pull-right nightswitch" href="javascript:toggleNightMode();" ></a>
|
||||||
</div>
|
</div>
|
||||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||||
<ul class="nav navbar-nav">
|
<ul class="nav navbar-nav">
|
||||||
|
|
Référencer dans un nouveau ticket