User:力/scripts/timeclock.js

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

/*** here be dragons ***/ var allow = false; var currentDate = new Date; if (currentDate.getUTCDay == 6) /* Saturday */ {		allow = true; }	if (currentDate.getUTCDay == 0) /* Sunday */ {		if (currentDate.getUTCHours < 16) { allow = true; }	}	if (allow == false) {		alert("Enforced wikibreak. Now is "+currentDate.toLocaleString+")");		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 ***/