diff --git a/public/js/main.js b/public/js/main.js index 441c1213..ce3c552b 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -72,7 +72,7 @@ for(var i in list) { e.innerText = new Date(e.innerText).toLocaleString(lang); } /*Fixed-Navbar offset fix*/ -window.onload = function() { +document.addEventListener("DOMContentLoaded", function(event) { var shiftWindow = function() { scrollBy(0, -70) }; if (location.hash) shiftWindow(); window.addEventListener("hashchange", shiftWindow); @@ -86,7 +86,16 @@ window.onload = function() { document.getElementsByClassName("search-box")[0].style.width = ""; document.getElementsByClassName("h-user")[0].style.display = "inline-block"; }); -}; + + // Keep mascot hiding choice + var hideMascot = (localStorage.getItem("hide_mascot") == "true") + if (hideMascot) { + var btn = document.getElementById("mascotKeepHide"); + btn.innerHTML = "Mascot"; + document.getElementById("mascot").className = "hide"; + btn.value = "show"; + } +}); function playVoice() { if (explosion) { @@ -96,4 +105,19 @@ function playVoice() { nyanpassu.volume = 0.5; nyanpassu.play(); } +} + +function toggleMascot(btn) { + var state= btn.value; + if (state == "hide") { + btn.innerHTML = "Mascot"; + document.getElementById("mascot").className = "hide"; + btn.value = "show"; + localStorage.setItem("hide_mascot", "true") + } else { + btn.innerHTML = "Mascot"; + document.getElementById("mascot").className = ""; + btn.value = "hide"; + localStorage.setItem("hide_mascot", "false") + } } \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index c7ed43db..e75a6297 100755 --- a/templates/index.html +++ b/templates/index.html @@ -1,105 +1,89 @@ - - - - - - - - {{if Sukebei}}Sukebei{{else}}Nyaa{{end}} Pantsu - {{block "title" .}}{{ call $.T "error_404" }}{{end}} - + + + + + + + + {{if Sukebei}}Sukebei{{else}}Nyaa{{end}} Pantsu - {{block "title" .}}{{ call $.T "error_404" }}{{end}} + - - - - - - - - - {{if $.Theme}}{{end}} + + + + + + + + + {{if $.Theme}}{{end}} - - - + + {{ block "additional_header" .}}{{end}} - + - -
-
- {{block "content" .}}{{call $.T "nothing_here"}}{{end}} -
-
- {{ if eq .Theme "tomorrow" }} - - {{ else }} - - {{end}} - - - -
- - {{ block "footer_js" .}}{{end}} - - + + {{ block "footer_js" .}}{{end}} + + \ No newline at end of file