User:ST47/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.
importScript( 'User:Enterprisey/script-installer.js' ); // Backlink: [[User:Enterprisey/script-installer.js]]
importScript( 'User:Enterprisey/url-select-revdel.js' ); // Backlink: [[User:Enterprisey/url-select-revdel.js]]
importScript('User:Enterprisey/unblock-review.js'); // Backlink: [[User:Enterprisey/unblock-review.js]]
importScript('User:Writ Keeper/Scripts/massRevdel.js'); // [[User:Writ Keeper/Scripts/massRevdel.js]]
importScript('User:ST47/culoghelper.js');
importScript('User:Mr. Stradivarius/gadgets/SpamUserPage.js'); // Linkback: [[User:Mr. Stradivarius/gadgets/SpamUserPage.js]]
mw.loader.using( ['mediawiki.util', 'mediawiki.page.ready'], function () {
	importScript('User:ST47/markblocked.js');
});
importScript('User:MusikAnimal/responseHelper.js'); // Backlink: [[User:MusikAnimal/responseHelper.js]]

mw.loader.using( ['ext.gadget.Twinkle'], function () {
	Twinkle.block.blockPresetsInfo['lta-user'] = {
		autoblock: true,
		nocreate: true,
		disabletalk: true,
		noemail: true,
		expiry: 'infinity',
	    forRegisteredOnly: true,
	    reason: 'LTA',
	    templateName: 'uw-blockindef',
	    suppressArticleInSummary: true,
	};
	Twinkle.block.blockPresetsInfo['lta-ip'] = {
		autoblock: true,
		nocreate: true,
		hardblock: true,
		disabletalk: true,
		expiry: '72 hours',
	    forAnonOnly: true,
	    reason: 'LTA',
	    templateName: 'uw-ablock',
	    suppressArticleInSummary: true,
	};
	Twinkle.block.blockPresetsInfo['lta-ip-2w'] = {
		autoblock: true,
		nocreate: true,
		hardblock: false,
		disabletalk: false,
		expiry: '2 weeks',
	    forAnonOnly: true,
	    reason: '{{anonblock}}',
	    templateName: 'uw-ablock',
	    suppressArticleInSummary: true,
	};
	Twinkle.block.blockGroups.unshift(
		{label: "Custom!", list: [
			{label: "LTA User (indef hard)", value: 'lta-user'},
			{label: "LTA IP (3 days hard)", value: 'lta-ip'},
			{label: "LTA IP (2 weeks soft)", value: 'lta-ip-2w'},
		]}
	);
	Twinkle.block.blockGroups[1]['list'][3]['selected'] = true;
	
	Twinkle.block.callback.issue_template = function twinkleblockCallbackIssueTemplate(formData) {
		var userTalkPage = 'User_talk:' + mw.config.get('wgRelevantUserName');
	
		var params = $.extend(formData, {
			messageData: Twinkle.block.blockPresetsInfo[formData.template],
			reason: Twinkle.block.field_template_options.block_reason,
			disabletalk: Twinkle.block.field_template_options.notalk,
			noemail: Twinkle.block.field_template_options.noemail_template,
			nocreate: Twinkle.block.field_template_options.nocreate_template
		});
	
		Morebits.wiki.actionCompleted.redirect = userTalkPage;
		Morebits.wiki.actionCompleted.notice = 'Actions complete, loading user talk page in a few seconds';
	
		var wikipedia_page = new Morebits.wiki.page(userTalkPage, 'User talk page modification');
		wikipedia_page.setCallbackParameters(params);
		wikipedia_page.setFollowRedirect(false);
		wikipedia_page.load(Twinkle.block.callback.main);
	};
});

mw.loader.using( 'mediawiki.util' ).done( function() {
	mw.util.addPortletLink('p-navigation', mw.config.get( 'wgServer' ) + '/wiki/Wikipedia:Administrator\'s noticeboard', "AN");
	mw.util.addPortletLink('p-navigation', mw.config.get( 'wgServer' ) + '/wiki/Wikipedia:Administrator\'s noticeboard/Incidents', "ANI");
	mw.util.addPortletLink('p-navigation', mw.config.get( 'wgServer' ) + '/wiki/Category:Requests_for_unblock', "CAT:UNB");
	mw.util.addPortletLink('p-navigation', 'https://ticket.wikimedia.org', "OTRS");
	mw.util.addPortletLink('p-navigation', 'https://checkuser.wikimedia.org/wiki/Main_Page', "cuwiki");
} );
importScript('User:Evad37/MoveToDraft.js'); // Backlink: [[User:Evad37/MoveToDraft.js]]
importScript('User:ST47/cu-log-links.js'); // Backlink: [[User:ST47/cu-log-links.js]]
importScript('User:ST47/cu-copy-paste.js'); // Backlink: [[User:ST47/cu-copy-paste.js]]

var anchors = document.getElementsByTagName("a");
for (var i = 0; i < anchors.length; i++) {
	if (anchors[i].href.includes("tools.wmflabs.org/whois/")) {
		anchors[i].href = anchors[i].href.replace("tools.wmflabs.org/whois/", "tools.wmflabs.org/whois-referral/")
	}
	if (anchors[i].href.includes("whois.toolforge.org/")) {
		anchors[i].href = anchors[i].href.replace("whois.toolforge.org/", "tools.wmflabs.org/whois-referral/")
	}
}
importScript('User:Enterprisey/link-deleted-revs.js'); // Backlink: [[User:Enterprisey/link-deleted-revs.js]]
importScript('User:GeneralNotability/spihelper.js'); // Backlink: [[User:GeneralNotability/spihelper.js]]