Jump to content

User:TwoWings/monobook.js

From Wikipedia, the free encyclopedia
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 Wikipedia:Bypass your cache.
/* <pre><nowiki> */
 
function EnforceWikiBreak() {
    //Please adjust the following variables according to when you want to end your break:
    var year = 2008; //YYYY
    var month = 03; //MM
    var day = 15; //DD
    var hour = 20; //HH
    var minute = 00; //MM
    var second = 00; //SS 
 
    var currentdate = new Date();
    var enforced_break_end = new Date(year,changemonth(month),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+"/w/index.php?title=Special:Userlogout&returnto=Main_Page");
    }
}
 
function changemonth(month) {
//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;
}
 
$(EnforceWikiBreak);
 
/* </nowiki></pre> */