Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Update main.js

Cette révision appartient à :
kilo 2017-07-23 01:41:42 +02:00 révisé par GitHub
Parent 52579448fd
révision 00b4439bff

Voir le fichier

@ -55,13 +55,32 @@ parseAllDates()
//if no version cookie set or non-equal version
if(!document.cookie.includes("version") || (document.cookie.substring(document.cookie.indexOf("version") + 8).substring(0, document.cookie.substring(document.cookie.indexOf("version") + 8).indexOf(";") == "-1" ? document.cookie.substring(document.cookie.indexOf("version") + 8).length : document.cookie.substring(document.cookie.indexOf("version") + 8).indexOf(";"))) != Version) {
//Remove all cookies
if(!document.cookie.includes("version") || (document.cookie.substring(document.cookie.indexOf("version") + 8).substring(0, document.cookie.substring(document.cookie.indexOf("version") + 8).indexOf(";") == "-1" ? document.cookie.substring(document.cookie.indexOf("version") + 8).length : document.cookie.substring(document.cookie.indexOf("version") + 8).indexOf(";"))) != Version)
{
//Get current lang, mascot & theme cookies
var lang = null,
mascot = null,
theme = null;
if(document.cookie.includes("lang"))
lang = (document.cookie.substring(document.cookie.indexOf("lang") + 5).substring(0, document.cookie.substring(document.cookie.indexOf("lang") + 5).indexOf(";") == "-1" ? document.cookie.substring(document.cookie.indexOf("lang") + 5).length : document.cookie.substring(document.cookie.indexOf("lang") + 5).indexOf(";")));
if(document.cookie.includes("mascot"))
mascot = (document.cookie.substring(document.cookie.indexOf("mascot") + 7).substring(0, document.cookie.substring(document.cookie.indexOf("mascot") + 7).indexOf(";") == "-1" ? document.cookie.substring(document.cookie.indexOf("mascot") + 7).length : document.cookie.substring(document.cookie.indexOf("mascot") + 7).indexOf(";")));
if(document.cookie.includes("theme"))
theme = (document.cookie.substring(document.cookie.indexOf("theme") + 6).substring(0, document.cookie.substring(document.cookie.indexOf("theme") + 6).indexOf(";") == "-1" ? document.cookie.substring(document.cookie.indexOf("theme") + 6).length : document.cookie.substring(document.cookie.indexOf("theme") + 6).indexOf(";")));
//Remove all cookies
var cookies = document.cookie.split(";");
for (var i = 0; i < cookies.length; i++)
document.cookie = cookies[i].split("=")[0] + "=;expires=Thu, 01 Jan 1970 00:00:00 UTC;";
//set new version in cookie
//Set new version in cookie
document.cookie = "version=" + Version;
//Apply back lang, mascot & theme cookie
if(lang != null) document.cookie = "lang="+ lang;
if(mascot != null) document.cookie = "mascot="+ mascot;
if(theme != null) document.cookie = "theme="+ theme;
}