Jump to content

User:Femke/common.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.
/* Forbid access using this account on weekdays until 17:00 and from 21:15. On weekend, forbid access after 21:15 */

(function(){

    if(!document.body){
        // Page not loaded yet!
        setTimeout(arguments.callee, 100);
        return;
    }

    var e=17*3600 + 0*60; // End lockout time, in seconds
    var s = 21*3600 + 15*60; // Begin second lockout time, in seconds
    var dt=new Date();

    var t=dt.getHours()*3600+dt.getMinutes()*60+dt.getSeconds();
    var wd=dt.getDay()%7;

    
    if((wd==0 || wd==6) && t<s){
        // Sunday, clear lockout during day and wait until later
        setTimeout(arguments.callee, Math.min(600000,86400-t)*1000);
        document.body.style.display='';
        return;
    }

    if(t>=e && t<=s){
        // On other days, clear lockout in evening, clear lockout and wait until later
        setTimeout(arguments.callee, Math.min(600000,86400-t)*1000);
        document.body.style.display='';
        return;
    }

    // Lock out! And repeat the check every second so I can't just firebug my
    // way past it.

    document.body.style.display='none';
    setTimeout(arguments.callee, 1000);
})();


/*** BEGIN WIKIBREAK ENFORCER ***/ 
$(document).ready(function() {

/*** Start editing here ***/

// When you want to end your break? // no leading zeroes. (example: 9 - correct, 09 - incorrect)

var date = { year: 2022, month: 7, day: 1}; var time = { hours: 16, minutes: 55, seconds: 0 };

/*** Stop editing here ***/

var currentDate = new Date(); var enforcedBreakEnd = new Date( date.year,date.month-1,date.day,time.hours,time.minutes,time.seconds); if (currentDate <= enforcedBreakEnd) { alert("Enforced wikibreak until "+enforcedBreakEnd.toLocaleString() + "\n(now is "+currentDate.toLocaleString()+")\n\nBye!"); mw.loader.using(["mediawiki.api", "mediawiki.user"]).then(function () { new mw.Api().post( { action: 'logout', token: mw.user.tokens.get('csrfToken') }).done(function (data) { location = "//" + location.host + "/w/index.php?title=" + "Special:Userlogin&returnto=Main_Page"; }).fail(function () { console.log("logout failed") }); }); } });
/*** END WIKIBREAK ENFORCER ***/

// window.draftCleanerPutInToolsMenu = true;
importScript('User:Trappist the monk/HarvErrors.js'); // Backlink: [[User:Trappist the monk/HarvErrors.js]]
mw.util.addPortletLink('p-personal', 'https://en.wikipedia.org/wiki/WP:PROCC', 'PROCC');
importScript('User:Headbomb/unreliable.js'); // Backlink: [[User:Headbomb/unreliable.js]]
importScript('User:Evad37/duplinks-alt.js'); // [[User:Evad37/duplinks-alt]]
importScript('User:Ohconfucius/script/MOSNUM dates.js'); // Backlink: [[User:Ohconfucius/script/MOSNUM dates.js]]
mw.loader.load('//en.wikipedia.org/w/index.php?title=User%3ACaorongjin%2Fwordcount.js&action=raw&ctype=text/javascript');
importScript('User:Ohconfucius/dashes.js'); // Backlink: [[User:Ohconfucius/dashes.js]]
importScript('User:Novem Linguae/Scripts/DraftCleaner.js'); // Backlink: [[User:Novem Linguae/Scripts/DraftCleaner.js]]
importScript('User:DannyS712/DiscussionCloser.js'); // Backlink: [[User:DannyS712/DiscussionCloser.js]]
importScript('User:Novem Linguae/Scripts/GANReviewTool.js'); // Backlink: [[User:Novem Linguae/Scripts/GANReviewTool.js]]
importScript('User:MusikAnimal/userRightsManager.js'); // Backlink: [[User:MusikAnimal/userRightsManager.js]]
importScript('User:Novem Linguae/Scripts/UserRightsDiff.js'); // Backlink: [[User:Novem Linguae/Scripts/UserRightsDiff.js]]
importScript('User:MusikAnimal/responseHelper.js'); // Backlink: [[User:MusikAnimal/responseHelper.js]]
importScript('User:Novem Linguae/Scripts/VisualEditorEverywhere.js'); // Backlink: [[User:Novem Linguae/Scripts/VisualEditorEverywhere.js]]
importScript('User:SD0001/GAN-helper.js'); // Backlink: [[User:SD0001/GAN-helper.js]]
mw.loader.using( 'user.options' ).then( function() {
	if ( mw.user.options.get( 'gadget-Prosesize' ) === null ) {
		new mw.Api().saveOption( 'gadget-Prosesize', '1' );
		mw.loader.load( [ 'ext.gadget.Prosesize' ] );
	}
} );
importScript('User:SD0001/GAR-helper.js'); // Backlink: [[User:SD0001/GAR-helper.js]]
importScript('User:Shubinator/DYKcheck.js'); // Backlink: [[User:Shubinator/DYKcheck.js]]
importScript('User:Nardog/RefRenamer.js'); // Backlink: [[User:Nardog/RefRenamer.js]]
importScript('User:Phlsph7/Readability.js'); // Backlink: [[User:Phlsph7/Readability.js]]