Merge pull request #14 from makyen/Mak-update-2019-April-fools

Automatically refresh the page, once.
This commit is contained in:
Glorfindel83 2019-04-01 11:21:51 +02:00 committed by GitHub
commit 969e3740df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 3 deletions

View File

@ -11,6 +11,7 @@
// @match *://*.serverfault.com/*
// @match *://*.askubuntu.com/*
// @match *://*.stackapps.com/*
// @match *://*.mathoverflow.net/*
// @exclude *://api.stackexchange.com/*
// @exclude *://blog.*.com/*
// @exclude *://chat.*.com/*
@ -18,12 +19,22 @@
// @exclude *://elections.stackexchange.com/*
// @exclude *://openid.stackexchange.com/*
// @exclude *://stackexchange.com/*
// @run-at document-start
// @grant none
// @version 0.2
// @version 0.3
// ==/UserScript==
(function () {
"use strict";
$.cookie("tm2019", "1", { expires: 2, path: '/' });
$.cookie("tm2019d", "1", { expires: 2, path: '/' });
if (Date.now() < 1554335999000) {
//Don't do anything if April Fools 2019 is past.
if (document.cookie.indexOf('glorObeyUserPref') === -1 && (document.cookie.indexOf('tm2019') === -1 || document.cookie.indexOf('tm2019d') === -1)) {
//We only want to set these once, so the user can turn the 2019 April Fools theme on for a site, if they want.
//Using a cookie for our own flag automatically cleans up for us after April Fools Day.
document.cookie = 'glorObeyUserPref=1;path=/;expires=Wed, 03 Apr 2019 23:59:59 GMT';
document.cookie = 'tm2019=1;path=/;expires=Wed, 03 Apr 2019 23:59:59 GMT';
document.cookie = 'tm2019d=1;path=/;expires=Wed, 03 Apr 2019 23:59:59 GMT';
window.location.reload(false);
}
}
})()