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

Classic theme default on nyaa.pt

Cette révision appartient à :
kilo 2017-12-02 16:50:53 +01:00 révisé par GitHub
Parent 03ba41cae3
révision 42638e9f98
Signature inconnue de Forgejo
ID de la clé GPG: 4AEE18F83AFDEB23
1 fichiers modifiés avec 20 ajouts et 0 suppressions

Voir le fichier

@ -195,6 +195,26 @@ function startupCode() {
//If user has no default theme, set these by default
if(getCookieValue("theme") == "") {
//User has no theme selected, we check if the domain name (without sub domain) includes the word "nyaa" and if it does, we set the theme as classic theme
var hostName = window.location.host
var lastDotIndex = hostName.lastIndexOf(".")
var secondLast = -1
for(var index = 0; index < lastDotIndex; index++) {
if(hostName[index] == '.')
secondLast = index
}
hostName = hostName.substr(secondLast == -1 ? 0 : secondLast)
if(hostName.includes("nyaa")) {
document.cookie = "theme=classic;path=/;expires=" + farFutureString + ";domain=" + domain
document.getElementById("theme").href = "/css/themes/classic.css";
}
}
if(document.cookie.includes("theme2=")) {
UserTheme[1] = getCookieValue("theme2")
//If user already has ran the ToggleTheme() function in the past, we get the value of the second theme (the one the script switches to)