Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Cleanup night mode code and move switcher to top right

Cette révision appartient à :
sfan5 2017-05-07 20:49:59 +02:00
Parent 1d8bfa901c
révision f0d68a7d7f
4 fichiers modifiés avec 33 ajouts et 28 suppressions

Voir le fichier

@ -1,10 +1,13 @@
/* Night mode image */
#sunmoon {
position: fixed;
top: 10px;
height: 30px;
/* Night mode switcher */
.nightswitch {
position: fixed;
top: 12px;
right: 48px;
}
.nightswitch > a > img {
width: 24px;
}
/* Torrent status colors */
.remake {
background-color: #795c46;

Voir le fichier

@ -1,9 +1,13 @@
/* Night mode image */
#sunmoon {
position: fixed;
top: 10px;
height: 30px;
/* Night mode switcher */
.nightswitch {
position: fixed;
top: 12px;
right: 48px;
}
.nightswitch > a > img {
width: 24px;
}
/* Torrent status colors */
.remake {
background-color: rgb(240, 176, 128);

Voir le fichier

@ -1,25 +1,20 @@
// Night mode
// also sorry that this code is soo bad, literally nothing else worked.. ima remake it in a near future
var night = localStorage.getItem("night");
if (night=="true") {
document.getElementById("style").href = "/css/style-night.css";
document.getElementById("nightbutton").innerHTML = "<img id='sunmoon' src='/img/sun.png' alt='Day!'>";
if (night == "true") {
$("#style")[0].href = "/css/style-night.css";
$("#nighticon")[0].src = "/img/sun.png";
}
function toggleNightMode() {
var styleshieeet = document.getElementById("style").href;
var styleshieet = new RegExp("style.css");
var stylesheet = styleshieet.test(styleshieeet);
if (stylesheet==true) {
document.getElementById("style").href = "/css/style-night.css";
document.getElementById("nightbutton").innerHTML = "<img id='sunmoon' src='/img/sun.png' alt='Day!'>";
localStorage.setItem("night", "true");
}
else {
document.getElementById("style").href = "/css/style.css";
document.getElementById("nightbutton").innerHTML = "<img id='sunmoon' src='/img/moon.png' alt='Night!'>";
localStorage.setItem("night", "false");
var night = localStorage.getItem("night");
if(night == "true") {
$("#style")[0].href = "/css/style.css";
$("#nighticon")[0].src = "/img/moon.png";
} else {
$("#style")[0].href = "/css/style-night.css";
$("#nighticon")[0].src = "/img/sun.png";
}
localStorage.setItem("night", (night == "true") ? "false" : "true");
}
// Used by spoiler tags
@ -30,6 +25,7 @@ function toggleLayer(elem) {
elem.classList.add("hide");
}
// Date formatting
function formatDate(date) { // thanks stackoverflow
var monthNames = [
"January", "February", "March",

Voir le fichier

@ -47,7 +47,6 @@
<li><a href="irc://irc.rizon.net/nyaapantsu">IRC</a></li>
<li><a href="{{ genRouteWithQuery "feed" .URL }}">RSS</a></li>
<li><a href="https://sukebei.pantsu.cat">Fap</a></li>
<li><a href="javascript:void(0);" id="nightbutton" onclick='toggleNightMode();'><img id="sunmoon" src="/img/moon.png" alt="Night!"></a></li>
</ul>
<form class="navbar-form navbar-right" role="search" action="/search" method="get">
@ -56,6 +55,9 @@
{{block "search_button" .}}{{end}}
</div>
</form>
<div class="nightswitch" style="position:absolute;right:1em">
<a href="javascript:toggleNightMode();" ><img id="nighticon" src="/img/moon.png"></a>
</div>
</div>
</div>
</nav>