Albirew/nyaa-pantsu
Albirew
/
nyaa-pantsu
Archivé
1
0
Bifurcation 0

Toggle theme JS now also do a query to save new theme settings for logged-in users (#1443)

* Set user theme through query in toggle

* Create UserID JS variable

* remove useless shit
Cette révision appartient à :
kilo 2017-08-29 13:15:37 +02:00 révisé par ewhal
Parent 7c3b30035c
révision 469375435c
2 fichiers modifiés avec 11 ajouts et 3 suppressions

Voir le fichier

@ -183,8 +183,16 @@ function toggleTheme(e) {
document.getElementById("theme").href = "/css/" + CurrentTheme + ".css";
document.cookie = "theme=" + CurrentTheme + ";path=/;domain=pantsu.cat;expires=" + farFutureString
document.cookie = "theme2=" + (CurrentTheme == UserTheme[0] ? UserTheme[1] : UserTheme[0]) + ";path=/;domain=pantsu.cat;expires=" + farFutureString
if(UserID > 0 ){
Query.Get("https://dev.pantsu.cat/dark")
//If user logged in, we're forced to go through this page in order to save the new user theme
}
else {
document.cookie = "theme=" + CurrentTheme + ";path=/;domain=pantsu.cat;expires=" + farFutureString
document.cookie = "theme2=" + (CurrentTheme == UserTheme[0] ? UserTheme[1] : UserTheme[0]) + ";path=/;domain=pantsu.cat;expires=" + farFutureString
//Otherwise, we can just set the theme through cookies
}
e.preventDefault()
}

Voir le fichier

@ -90,7 +90,7 @@
</div>
</footer>
</div>
<script type="text/javascript" charset="utf-8">var commitVersion = "{{ Config.Build }}";</script>
<script type="text/javascript" charset="utf-8">var commitVersion = "{{ Config.Build }}", UserID = {{User.ID}};</script>
<script type="text/javascript" charset="utf-8" src="/js/main.js?v={{ Config.Version }}{{ Config.Build }}" async></script>
{{block footer_js()}}{{end}}
</body>