User:DannyS712/wikibreak later.js
Appearance
(Redirected from User:DannyS712 test/wikibreak later.js)
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. |
![]() | This user script seems to have a documentation page at User:DannyS712/wikibreak later. |
// Based on the script at [[Wikipedia:WikiProject User scripts/Scripts/WikiBreak Enforcer]]
// Built for taking a wikibreak, but only starting later
// Set when it will start, and how long it will last for
/*** BEGIN WIKIBREAK PLANNER ***/
$(document).ready(function() {
/*** Start editing here ***/
// no leading zeroes. (example: 9 - correct, 09 - incorrect)
// start date and time
var date1 = { year: 2018, month: 11, day: 30};
var time1 = { hours: 14, minutes: 08, seconds: 0 };
// end date and time
var date2 = { year: 2018, month: 11, day: 30};
var time2 = { hours: 14, 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";
}
});
/*** END WIKIBREAK PLANNER ***/