From 93206d295503073b4fa06e6c441d472f91f795e9 Mon Sep 17 00:00:00 2001 From: ripdog Date: Tue, 9 May 2017 19:09:22 +1200 Subject: [PATCH] No longer use img elements changed by js for the night mode toggle button. Use a css background on the . Less JS is better JS. --- public/css/style-night.css | 4 ++++ public/css/style.css | 15 ++++++++++----- public/js/main.js | 3 --- templates/index.html | 2 +- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/public/css/style-night.css b/public/css/style-night.css index 6bb79416..95a5fe08 100644 --- a/public/css/style-night.css +++ b/public/css/style-night.css @@ -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); +} diff --git a/public/css/style.css b/public/css/style.css index da2d9089..23c206d3 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -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; -} \ No newline at end of file +} +/* 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; +} diff --git a/public/js/main.js b/public/js/main.js index d8c1e27f..1cc1c7b7 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -2,17 +2,14 @@ var night = localStorage.getItem("night"); if (night == "true") { $("head").append(''); - $("#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(''); - $("#nighticon")[0].src = "/img/sun.png"; } localStorage.setItem("night", (night == "true") ? "false" : "true"); } diff --git a/templates/index.html b/templates/index.html index 646d0d9c..226870ff 100755 --- a/templates/index.html +++ b/templates/index.html @@ -39,7 +39,7 @@ Nyaa Pantsu - +