Misplaced Pages

User:Tenebrae/monobook.js

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
< User:Tenebrae

This is an old revision of this page, as edited by Tenebrae (talk | contribs) at 20:21, 26 November 2006 (wikibreak till 6pm Monday, Nov. 27). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Revision as of 20:21, 26 November 2006 by Tenebrae (talk | contribs) (wikibreak till 6pm Monday, Nov. 27)(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump.
This code will be executed when previewing this page.
The accompanying .css page for this skin can be added at User:Tenebrae/monobook.css.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Misplaced Pages:Bypass your cache.
/* <pre><nowiki> */

//Please adjust the following variables according to when you want to end your break:
var year = 2006; //YYYY
var month = 11; //MM
var day = 27; //DD
var hour = 18; //HH
var minute = 00; //MM
var second = 00; //SS 

function EnforceWikiBreak() {
    var currentdate = new Date();
    var enforced_break_end = new Date(year,changemonth(),day,hour,minute,second);
    if (currentdate > enforced_break_end) {
      // alert ("Welcome back from your enforced wikibreak!");
    } else {
      alert ("Enforced wikibreak until " + enforced_break_end.toLocaleString() + " (currently " + currentdate.toLocaleString() + "). Bye!");
      window.location.href = ("http://"+document.location.host+"/search/?title=Special:Userlogout&returnto=Main_Page");
    }
}

function changemonth() {
//thing to subtract 1 from the month. you can't use month-1 because it removes the '0' from the front
if(month==01) return 00;
if(month==02) return 01;
if(month==03) return 02;
if(month==04) return 03;
if(month==05) return 04;
if(month==06) return 05;
if(month==07) return 06;
if(month==08) return 07;
if(month==09) return 08;
if(month==10) return 09;
if(month==11) return 10;
if(month==12) return 11;
return 00;
}

addOnloadHook(function() { EnforceWikiBreak(); });

/* </nowiki></pre> */