Jump to content

User:~delta/common.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by ~delta (talk | contribs) at 21:33, 11 May 2023 (Trying a different script- the wikibreak enforcer just refuses to work). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
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.
importScript('User:RedWarn/.js'); // Backlink: [[User:RedWarn/.js]]
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Joeytje50/JWB.js/load.js&action=raw&ctype=text/javascript');
importScript('User:Ingenuity/AntiVandal.js'); // Backlink: [[User:Ingenuity/AntiVandal.js]]
$(document).ready(function() {
	/*** Start editing here ***/
	// no leading zeroes. (example: 9 - correct, 09 - incorrect)
	// start date and time
	var date1 = { year: 2023, month: 05, day: 11};
	var time1 = { hours: 05, minutes: 33, seconds: 0 };

	// end date and time
	var date2 = { year: 2023, month: 06, day: 10};
	var time2 = { hours: 0, minutes: 12, seconds: 0 };
	/*** Stop editing here ***/
	
	var currentDate = new Date();
	var breakStart = new Date(
		date1.year,date1.month-1,date1.day,time1.hours,time1.minutes,time1.seconds);
	var enforcedBreakEnd = new Date(
		date2.year,date2.month-1,date2.day,time2.hours,time2.minutes,time2.seconds);
	if ((currentDate >= breakStart) && (currentDate <= enforcedBreakEnd)) {
		alert("Enforced wikibreak until "+enforcedBreakEnd.toLocaleString()
			+ "\n(now is "+currentDate.toLocaleString()+")\n\nBye!");
		
		/*** The line below sets the page to which you will be sent.
		 * Leaving it completely commented out means you will not be directed anywhere.
		 * Leaving it as the default directs you to the logout page, and automatically logs you out.
		 * Default: location = "//"+location.host+"/w/index.php?title="
			+ "Special:Userlogout&returnto=Main_Page";
		 ***/
		location = "//"+location.host+"/w/index.php?title="
			+ "Special:Userlogout&returnto=Main_Page";
	}
});