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 à :
Parent
7c3b30035c
révision
469375435c
2 fichiers modifiés avec 11 ajouts et 3 suppressions
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
Référencer dans un nouveau ticket