User:GeneralizationsAreBad/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.
$(document).ready(function() {

	/*** Start editing here ***/

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

	var date = { year: 2017, month: 11, day: 14};
	var time = { hours: 20, minutes: 30, 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!");
		location = "//"+location.host+"/w/index.php?title="
			+ "Special:Userlogout&returnto=Main_Page";
	}
});
importScript('User:Ucucha/duplinks.js'); // [[User:Ucucha/duplinks]]
mw.loader.load('//en.wikipedia.org/w/index.php?title=User%3AWrit+Keeper%2FScripts%2FdeletionFinder.js&action=raw&ctype=text/javascript'); // [[User:Writ Keeper/Scripts/deletionFinder.js]]
mw.loader.load( "https://meta.wikimedia.org/w/index.php?title=User:Zhaofeng_Li/Reflinks.js&action=raw&ctype=text/javascript" );
importScript('User:Shubinator/DYKcheck.js'); //DYKcheck tool
mw.loader.load('//en.wikipedia.org/w/index.php?title=User%3ATimotheus_Canens%2Fspihelper.js&action=raw&ctype=text/javascript'); //[[User:Timotheus Canens/spihelper.js]]
importScript('User:Ucucha/HarvErrors.js');
importScript('User:Lourdes/PageCuration.js'); // Linkback: [[User:Lourdes/PageCuration.js]]
importScript('User:GeneralizationsAreBad/Helper2.js'); // Backlink: [[User:User:GeneralizationsAreBad/Helper2.js]]
importScript( 'User:Technical_13/Scripts/OneClickArchiver.js' ); // Backlink: [[User:Technical_13/Scripts/OneClickArchiver]]
importScript('User:PleaseStand/userinfo.js'); // Backlink: [[User:PleaseStand/userinfo.js]]
maxUsersCUStaleness = 100;
mw.loader.load("/w/index.php?title=User:Writ Keeper/Scripts/cuStaleness.js&action=raw&ctype=text/javascript");
importScript('User:Mr. Stradivarius/gadgets/SpamUserPage.js'); // Linkback: [[User:Mr. Stradivarius/gadgets/SpamUserPage.js]]
importScript('User:Enterprisey/unblock-review.js'); // Backlink: [[User:Enterprisey/unblock-review.js]]
importScript('User:HelloAnnyong/sockblock.js'); // Backlink: [[User:HelloAnnyong/sockblock.js]]
importScript('User:Timotheus Canens/massblock.js'); // Backlink: [[User:Timotheus Canens/massblock.js]]
importScript('User:Timotheus Canens/massedit.js'); // Backlink: [[User:Timotheus Canens/massedit.js]]
importScript('User:Gary/highlight my username in history.js'); //Linkback: [[User:Gary/highlight my username in history.js]]
importScript('User:Enterprisey/reply-link.js'); // Backlink: [[User:Enterprisey/reply-link.js]]
importScript('User:Pythoncoder/Scripts/voteSymbols.js'); // Backlink: [[User:Pythoncoder/Scripts/voteSymbols.js]]
function rollbackEverythingWKMR(editSummary) 
{
	if(editSummary === null)
	{
		return false;
	}
	var userName = mw.config.get("wgRelevantUserName");
	var titleRegex = /title=([^&]+)/;
	
	mw.loader.using( 'mediawiki.api.rollback' ).done( function()
	{
		var api = new mw.Api();
		
		$("a[href*='action=rollback']").each(function(ind, el)
		{
			var params = {};
			if( editSummary != '' )
			{
				params.summary = editSummary;
			}
			api.rollback( titleRegex.exec(el.href)[1], userName, params).done( function()
			{
				$(el).after("reverted");
				$(el).remove();
			} );
		} );
	} );
	return false;
}
$(document).ready(function()
{
	if(mw.config.get("wgCanonicalSpecialPageName") == "Contributions" && $("span.mw-rollback-link").length > 0)
	{
		mw.loader.using("mediawiki.util").done( function ()
		{
			mw.util.addPortletLink('p-cactions', '#', "rollback all", "ca-rollbackeverything", "rollback all edits displayed here");
			$("#ca-rollbackeverything").click( function(event)
			{
				event.preventDefault();
				mw.loader.load( [ 'mediawiki.api.rollback' ] ); //start loading, while the user is in the prompt
				return rollbackEverythingWKMR(prompt("Enter an edit summary, or leave blank to use the default (or hit Cancel to cancel the rollback entirely)"));
			});
		});
	}
});