Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Wikibreak enforcer

/*** 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: 2020, month: 2, day: 11};
	var time = { hours: 20, minutes: 22, 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()
			+ "
(now is "+currentDate.toLocaleString()+")

Bye!");
		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 ***/
Comment

PREVIOUS NEXT
Code Example
Javascript :: SHOPIFY CUSTOMER WITH REGISTRATION 
Javascript :: add attribute jquery 
Javascript :: javascript nested destructuring 
Javascript :: redux cannot read properties state) = state.useSelector 
Javascript :: for loop remove duplicates javascript 
Javascript :: how to call javascript function in p tag 
Javascript :: utility javascript function list 
Javascript :: what is clz32 in javascript 
Javascript :: api post to curl command converter 
Javascript :: when i add data into the input it disappeared in react 
Javascript :: vue js v if only hide not remove 
Javascript :: regular expression for beginners 
Javascript :: how-to get selected value of a dropdown menu in reactjs 
Javascript :: remove package-lock.json from commit 
Javascript :: jquery validate min and max value 
Javascript :: element non empty jquer y check 
Javascript :: _.extend() underscore 
Javascript :: JSON: remember you can use a value that comes later 
Javascript :: remove nth character from string javascript 
Javascript :: _.extend() Explanation 
Javascript :: disable submit button until form is fully validated 
Javascript :: pro side nav react rtl 
Javascript :: get a nodes path alias 
Javascript :: Parsing the URL string using the WHATWG API 
Javascript :: angular routing appcomponent snipped 
Javascript :: react js date range 
Javascript :: jquery code convert into javascript online 
Javascript :: javascript detect video change to muted 
Javascript :: auto linting and testing in react tyescript 
Javascript :: how to convert html string to jsx element 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =