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
dd0b84a88c
révision
a48e49a159
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 {
|
||||
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 */
|
||||
.remake {
|
||||
|
@ -318,4 +315,12 @@ div.container div.blockBody:nth-of-type(2) table tr:first-of-type th:last-of-typ
|
|||
padding: 20px;
|
||||
background: #fff;
|
||||
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");
|
||||
if (night == "true") {
|
||||
$("head").append('<link id="style-dark" rel="stylesheet" type="text/css" href="/css/style-night.css">');
|
||||
$("#nighticon")[0].src = "/img/sun.png";
|
||||
}
|
||||
|
||||
function toggleNightMode() {
|
||||
var night = localStorage.getItem("night");
|
||||
if(night == "true") {
|
||||
$("#style-dark")[0].remove()
|
||||
$("#nighticon")[0].src = "/img/moon.png";
|
||||
} else {
|
||||
$("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");
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<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 class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||
<ul class="nav navbar-nav">
|
||||
|
|
Référencer dans un nouveau ticket