User:2NumForIce/common.js

Source: 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.
scriptsToManage = {
  "Sandbox" : "//en.wikipedia.org/w/index.php?title=User:2NumForIce/sandbox/.js&action=raw&ctype=text/javascript", // Backlink: [[User:2NumForIce/sandbox/.js]]
  "CitationsWrap" : "//en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=User:2NumForIce/wrap/citations.js", // Backlink: [[User:2NumForIce/wrap/citations.js]]
  "TeahouseWrap" : "//en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=User:2NumForIce/wrap/teahouse.js", // Backlink: [[User:2NumForIce/wrap/teahouse.js]]
  "AfC RedirectCat" : "//en.wikipedia.org/w/index.php?title=User:Eejit43/scripts/AFCRHS.js&action=raw&ctype=text/javascript", // Backlink: [[User:Eejit43/scripts/AFCRHS.js]]
  "AntiVandal" : "//en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=User:Ingenuity/AntiVandal.js", // Backlink: [[User:Ingenuity/AntiVandal.js]]
  "Capricorn" : "//en.wikipedia.org/w/index.php?title=User:Wugapodes/Capricorn.js&action=raw&ctype=text/javascript", // Backlink: [[User:Wugapodes/Capricorn.js]]
  "copyvios" : "//en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=User:The_Earwig/copyvios.js", // Backlink: [[User:The Earwig/copyvios.js]]
  "duplinks-alt" : "//en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=User:Evad37/duplinks-alt.js", // Backlink: [[User:Evad37/duplinks-alt.js]]
  "FormattedER" : "//en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=User:NguoiDungKhongDinhDanh/FormattedEditRequest.js", // Backlink: [[User:NguoiDungKhongDinhDanh/FormattedEditRequest.js]]
  "JWB" : "//en.wikipedia.org/w/index.php?title=User:Joeytje50/JWB.js/load.js&action=raw&ctype=text/javascript", // Backlink: [[User:Joeytje50/JWB.js/load.js]]
  "Lupin Tool" : "//en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=User:Lupin/recent2.js", // Backlink: [[User:Lupin/recent2.js]]
  "One Click Archiver" : "//en.wikipedia.org/w/index.php?title=User:Evad37/OneClickArchiver.js&action=raw&ctype=text/javascript", // Backlink: [[User:Evad37/OneClickArchiver.js]]
  "Source Table Gen" : "//en.wikipedia.org/w/index.php?title=User:DannyS712/SATG.js&action=raw&ctype=text/javascript", // Backlink: [[User:DannyS712/SATG.js]]
  "StatusChanger" : "//en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=User:Enterprisey/StatusChanger.js", // Backlink: [[User:Enterprisey/StatusChanger.js]]
  "SVGedit" : "//commons.wikimedia.org/w/index.php?action=raw&ctype=text/javascript&title=User:Rillke/SVGedit.js", // hosted on https://commons.wikimedia.org/wiki/User:Rillke/SVGedit.js
  "Toggle VF" : "//en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=User:P999/Toggle_VF.js", // Backlink: [[User:P999/Toggle VF.js]]
  "XfD Vote" : "//en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=User:Awesome_Aasim/xfdvote.js" // Backlink: [[User:Awesome_Aasim/xfdvote.js]]
};

/***
 * Scripts above can be toggled using MusikAnimal's scriptManager.
 * Example:
 * "Example" : "//en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=User:Example/Example.js"
 * Comma separated
***/

/* CONFIGS */
// Script configs go here.
/***
 * Other config pages:
 * Twinkle: [[User:2NumForIce/twinkleoptions.js]] ([[Wikipedia:Twinkle/Preferences]])
 * RedWarn: [[User:2NumForIce/redwarnConfig.js]]
 * JS Wiki Browser: [[User:2NumForIce/JWB-settings.json]]
 * Huggle: [[User:2NumForIce/huggle.yaml.js]]
***/

// ConfirmRollback
ConfirmRollback = {
  mobile: "allow",
  watchlist: "confirm"
};

// Navigation Popups
window.popupStructure = "menus";
window.popupShortcutKeys = true;
window.popupFixRedirs = true; // to fix double redirects (should I come across them)
window.popupFixDabs = true;
window.popupEditCounterTool = "custom"; // I use XTools
window.popupEditCounterUrl = "https://xtools.wmcloud.org/ec/en.wikipedia.org/$1"; // $1: username; $2, database name (enwiki_p)

/***
 * Scripts below will be loaded every time.
 * Recommended to keep to minimum.
***/

importScript('User:RedWarn/.js'); // Backlink: [[User:RedWarn/.js]]
importScript('User:MusikAnimal/scriptManager.js'); // Backlink: [[User:MusikAnimal/scriptManager.js]]
mw.loader.load( '/w/index.php?title=User:Mr._Stradivarius/gadgets/ConfirmRollback.js&action=raw&ctype=text/javascript' ); // Backlink: [[User:Mr. Stradivarius/gadgets/ConfirmRollback.js]]
mw.loader.load( '/w/index.php?title=User:2NumForIce/Tools/DashboardLink.js&action=raw&ctype=text/javascript' ); // Backlink: [[User:2NumForIce/Tools/DashboardLink.js]]
importScript( 'User:Ohconfucius/dashes.js' ); // Backlink: [[User:Ohconfucius/dashes.js]]
importScript( 'User:2NumForIce/Tools/ToggleNewWikitextEd.js' ); // Backlink: [[User:2NumForIce/Tools/ToggleNewWikitextEd.js]]
importScript( 'User:Enterprisey/cv-revdel.js' ); // Backlink: [[User:Enterprisey/cv-revdel.js]]
importScript( 'User:Ingenuity/AbuseFilterContribs.js' ); // Backlink: [[User:Ingenuity/AbuseFilterContribs.js]]

/* Make upload form text monospace */
importStylesheet('User:2NumForIce/Tools/UploadFormMonospace.css');

// This adds a down arrow link besides talk link. Requires <nowiki>{{Skip to top and bottom}}</nowiki>.
mw.util.addPortletLink(
//  portlet       URL of link destination (not wiki page name; has to be URL)   nom  ID of link        Portlet display text              Access key  Next link ID w/ #
	"p-personal", mw.util.getUrl("User talk:2NumForIce#skip-to-bottom-anchor"), "↓", "pt-talk-bottom", "Go to bottom of your talk page", null,       "#pt-mytalk"
	);

/*** 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: 2000, month: 1, day: 1};
	var time = { hours: 0, minutes: 0, 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!");
		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 ***/

/* Automate purge confirmation dialog */
if (mw.config.get('wgAction') === 'purge') {
    $('form[action*="action=purge"]').submit();
}