User:Leyo/common.js

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
//<nowiki>

// Schnarks Diff
mw.loader.load('//de.wikipedia.org/w/index.php?title=Benutzer:Schnark/js/diff.js&action=raw&ctype=text/javascript');

// Benutzernamen-Tab umbenennen
$(function () {
	document.getElementById('pt-userpage').getElementsByTagName('a')[0].innerHTML = 'B.S.';

mw.loader.using(['mediawiki.util']).then(function () {
	var editform = document.editform;

	// Adds a “Replace” tab which pops up two prompt boxes; one for a regexp and one for a replacement
	function wpTextboxReplace(e) {
		e.preventDefault();
		var s = prompt('Search regexp:');
		if (s) {
			var r = prompt('Replace /' + s + '/ with:');
			if (!r && r !== '')
				return;
			var txt = editform.wpTextbox1;
			txt.value = txt.value.replace(new RegExp(s, 'mg'), r);
		}
	}

	if (editform) {
		$(mw.util.addPortletLink(
				'p-cactions',
				'#',
				'Replace',
				'ca-replace',
				'Regexp replace for the edit window',
				'R',
				document.getElementById('ca-history'))).click(wpTextboxReplace);
	}

	// Link zu Vector-Skin
	var l = window.location;
	var url = l.protocol + '//' + l.host + l.pathname;
	url += (l.search.length > 1) ? (!mw.util.getParamValue('useskin') ?
		l.search.replace(/(&|\?)useskin=.+?(&|$)/, '$1useskin=vector$2')
		 : l.search + '&useskin=vector')
	 : '?useskin=vector';
	$(mw.util.addPortletLink(
			'p-cactions',
			url,
			'V',
			'ca-skinwechsel',
			'Seite mit Vector-Skin',
			null,
			null)).click(function (e) {
		e.preventDefault();
		this.href += l.hash;
	});
});
});

// Auf Benutzerseiten letztes Editdatum anzeigen
mw.loader.load('//de.wikipedia.org/w/index.php?title=Benutzer:Schnark/js/letzteredit.js&action=raw&ctype=text/javascript');

// Section links
if ($.inArray(mw.config.get('wgNamespaceNumber'), [0, 2, 6, 10, 12, 14]) === -1)
	mw.loader.load('//de.wikipedia.org/w/index.php?title=Benutzer:Schnark/js/section-links.js&action=raw&ctype=text/javascript');

// Chemie-Löschanträge
importScript('User:Leyo/del-chem.js');

// Provides several useful functions for rollback (custom edit summary, mark as bot edits and mass revert)
// by [[m:user:Hoo man]] <http://meta.wikimedia.org/wiki/User:Hoo_man/Scripts/Smart_rollback>
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Hoo_man/smart_rollback.js&action=raw&ctype=text/javascript');

// SVG-Dateien direkt bearbeiten
if (mw.config.get('wgNamespaceNumber') === 6 && /SVG/i.test(mw.config.get('wgTitle').slice(-3)))
	importScript('User:Rillke/SVGedit.js');

// Bilder mit SVG-Bug taggen
function addBausteinSVGBUG() {
	var newtext = "{{Low quality chem|SVG bug}}\n\n";
	var wpText = document.editform.wpTextbox1;
	wpText.value = newtext + wpText.value;
	document.editform.wpSummary.value = 'SVG bug';
}

if (mw.config.get('wgNamespaceNumber') === 6) { // Files only

	// Cleanup-Script
	importScript('User:Magog the Ogre/cleanup.js');
	// importScript('User:Perhelion/cleanup.js');
	mw.hook('gadget.magog.cleanup').add(function () {
		window.addCleanupFunction('fast_cleanup', window.fast_cleanup, 'fast cleanup TL (exp.)');
	});

	// JustReplace
	importScript('User:Perhelion/justReplace.js');
	// importScript('User:Sreejithk2000/JustReplace.js');

	// Bilder mit SVG-Bug taggen (Ajax)
	/* var AjaxDeleteExtraButtons = [{
	'label': 'SVG bug (chem)',
	'tag': '{{Low quality chem|SVG bug}}',
	'img_summary': 'Tagging file showing [[Librsvg bugs|librsvg bug]] as “low quality chem”'
	}]; */

	mw.loader.using(['mediawiki.util']).then(function () {

		// „en“-Tab
		mw.util.addPortletLink(
			'p-cactions',
			"//en.wikipedia.org/wiki/" + mw.config.get('wgPageName'),
			'en',
			'ca-enwiki',
			'Bild in der englischsprachigen Wikipedia',
			null,
			null);

		$(mw.util.addPortletLink(
				'p-cactions',
				'#',
				'SVG bug',
				'ca-svgbug',
				'SVG-Bug eintragen',
				null,
				null)).click(function (e) {
			e.preventDefault();
			var ac = mw.config.get('wgAction');
			if (ac === 'edit' || ac === 'submit')
				addBausteinSVGBUG();
			else if (ac === 'view') {
				document.location = mw.util.getUrl(mw.config.get('wgPageName'), {
						action: 'edit',
						functionName: 'addBausteinSVGBUG'
					});
			}
		});

		if (mw.util.getParamValue('functionName') === 'addBausteinSVGBUG')
			addBausteinSVGBUG();
	});
}

//</nowiki>

//vFCvFCCfg/////////////////////////////////////
/////// VISUAL FILE CHANGE CONFIGURATION ///////
///// DO NOT MODIFY BY HAND - FINGERS AWAY! ////
////////////////////////////////////////////////
window.vFCSettings = {"userNote":"Yours sincerely","firstTest":0,"testEdits":0,"defaultAction":"c_replace","watchlistUserTalk":"preferences","watchlistFiles":"preferences","watchlistReplace":"nochange","watchlistOTRS":"nochange","loadBatchSize":100,"maxSimultaneousReq":10,"summaryChacheLen":5,"loadThumbs":true,"loadWikitext":true};
//////////////////////////////////vFCvFCCfgEnd//
//<nowiki>

//vFCProfil/////////////////////////////////////
/////// VISUAL FILE CHANGE CONFIGURATION ///////
///// DO NOT MODIFY BY HAND - FINGERS AWAY! ////
////////////////////////////////////////////////
window.vFC_Profiles = {"titles in description":{"editInputs":{"mdDeleteReason":"","mdEditSummary":"attempt to fix display problems (nonsense title in description)","mdReplacePermission":false,"mdDeleteHeading":"Files in [[:Category:Template:en with no text displayed]] ","mdTalkNote":"Yours sincerely","mdRRegEx1":false,"mdRVar1":true,"mdMatchText1":"{{en|= Licensing: ==}}","mdReplaceText1":"","mdRRegEx2":false,"mdRVar2":true,"mdMatchText2":"{{en|== Licensing: ==}}","mdReplaceText2":"","mdRRegEx3":false,"mdRVar3":true,"mdMatchText3":"{{en|= Licensing ==}}","mdReplaceText3":"","mdRRegEx4":false,"mdRVar4":true,"mdMatchText4":"{{en|== Licensing ==}}","mdReplaceText4":"","mdRRegEx5":false,"mdRVar5":true,"mdMatchText5":"{{en|= License: ==}}","mdReplaceText5":"","mdRRegEx6":false,"mdRVar6":true,"mdMatchText6":"{{en|== License: ==}}","mdReplaceText6":"","mdRRegEx7":false,"mdRVar7":true,"mdMatchText7":"{{en|= License ==}}","mdReplaceText7":"","mdRRegEx8":false,"mdRVar8":true,"mdMatchText8":"{{en|== License ==}}","mdReplaceText8":"","mdRRegEx9":false,"mdRVar9":true,"mdMatchText9":"{{en|=Licensing:==}}","mdReplaceText9":"","mdRRegEx10":false,"mdRVar10":true,"mdMatchText10":"{{en|=Licensing==}}","mdReplaceText10":"","mdRRegEx11":false,"mdRVar11":true,"mdMatchText11":"{{en|= NowCommons ==}}","mdReplaceText11":"","mdRRegEx12":false,"mdRVar12":true,"mdMatchText12":"{{en|= Now commons ==}}","mdReplaceText12":"","mdRRegEx13":false,"mdRVar13":true,"mdMatchText13":"","mdReplaceText13":"","selPreserve":"secure","alsoPreserve":""},"action":"c_replace","objectMembers":{"queryParams":{"target":"Category:Template:en with no text displayed","cmdir":"asc","cmsort":"sortkey","cmstartsortkey":"","cmcontinue":"file|d094d0aad091d0a0d090d092d090352e4a5047|7487391"},"startInput":{"mode":"Category","modeCat":true,"modeUser":false,"modePage":false,"target":"Category:Template:en with no text displayed","loadThumbs":true,"loadWikitext":true,"startDate":"","startFile":""}},"proceedAt":{"vals":["file|d094d0aad091d0a0d090d092d090352e4a5047|7487391"],"setVals":["cmcontinue"]},"time":"2013-06-03T09:23:04.328Z"},"undefined parameters":{"editInputs":{"mdDeleteReason":"","mdEditSummary":"removing parameters that are not defined in [[Template:Information]]","mdReplacePermission":false,"mdDeleteHeading":"Files in [[:Category:Pages using Information template with incorrect parameter]] ","mdTalkNote":"Yours sincerely","mdRRegEx1":true,"mdRVar1":true,"mdMatchText1":"/\\n ?\\| ?([Tt]itle|[Aa]nmerkungen|[Aa]ndere Versionen|[Gg]enehmigung|[Oo]ther|[Ll]icense|[Ll]icensing|[Ll]ocation|[Cc]ountry|[Aa]rtist) *= *\\n/g","mdReplaceText1":"\n","mdRRegEx2":false,"mdRVar2":true,"mdMatchText2":"","mdReplaceText2":"","selPreserve":"secure","alsoPreserve":""},"action":"c_replace","objectMembers":{"queryParams":{"target":"Category:Pages using Information template with incorrect parameter","cmdir":"asc","cmsort":"sortkey","cmstartsortkey":"","cmcontinue":"file|d0a1d095d0a0d093d095d09920d092d09bd090d094d098d09cd098d0a0d09ed092d098d0a720d092d09ed09bd09ad09ed0922e544946|14518829"},"startInput":{"mode":"Category","modeCat":true,"modeUser":false,"modePage":false,"target":"Category:Pages using Information template with incorrect parameter","loadThumbs":false,"loadWikitext":true,"startDate":"","startFile":""}},"proceedAt":{"vals":["file|d0a1d095d0a0d093d095d09920d092d09bd090d094d098d09cd098d0a0d09ed092d098d0a720d092d09ed09bd09ad09ed0922e544946|14518829"],"setVals":["cmcontinue"]},"time":"2013-12-02T09:23:18.009Z"},"syntax notification":{"editInputs":{"mdDeleteReason":"","mdEditSummary":"","mdReplacePermission":false,"mdDeleteHeading":"Files in [[:Category:Pages using Information template with incorrect parameter]] ","mdTalkNote":"Hi {{subst:PAGENAME}}. Some of your files are listed in [[:Category:Pages using Information template with incorrect parameter]]. Could you please have a look and try to fix the syntax errors? Thank you.","mdRRegEx1":false,"mdRVar1":true,"mdMatchText1":"","mdReplaceText1":"","selPreserve":"secure","alsoPreserve":""},"action":"prepNf","objectMembers":{"queryParams":{"target":"Category:Pages using Information template with incorrect parameter","cmdir":"asc","cmsort":"sortkey","cmstartsortkey":"","cmcontinue":"file|544f42495345204f462053454e4b414b552049534c414e44532e4a5047|9008690"},"startInput":{"mode":"Category","modeCat":true,"modeUser":false,"modePage":false,"target":"Category:Pages using Information template with incorrect parameter","loadThumbs":false,"loadWikitext":false,"startDate":"","startFile":""}},"proceedAt":{"vals":["file|4d4f4e544553494e4f53204445204e4f4348452e4a5047|2216319","file|544f42495345204f462053454e4b414b552049534c414e44532e4a5047|9008690"],"setVals":["cmcontinue"]},"time":"2013-12-04T09:37:35.893Z"}};
//////////////////////////////////vFCProfilEnd//
//</nowiki>