User:Argo Carpathians/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.
/* jshint multistr:true */
var ns = mw.config.get('wgNamespaceNumber'),
	ul = mw.config.get('wgUserLanguage'),
	pn = mw.config.get('wgPageName'),
	un = mw.config.get('wgUserName'),
	ti = mw.config.get('wgTitle');

$.when(mw.loader.using('mediawiki.util'), $.ready).done(function () {
	"use strict";
	if (ns === 6) { // Files only
		if (/SVG/i.test(ti.slice(-3))) { // SVG
			// SVG edit
			importScript('User:Rillke/SVGedit.js');
			// W3C-Validator for SVG (with ss)
			mw.util.addPortletLink('p-cactions', 'http://validator.w3.org/check?uri=' + 'https://commons.wikimedia.org' + mw.util.getUrl('Special:Filepath/' + ti) + '&ss=1#source', 'Valid SVG?', 't-validSVG', 'W3C-Validator', null);
			// W3C-Validator check-link for every SVG (by [[User: Perhelion]] fixed also now for admins); + detailed byte-size
			importScript('User:Perhelion/simpleSVGcheck.js');  // Test update
		}
		// [[Commons:GlobalReplace]]
		// JustReplace [[User:Sreejithk2000/JustReplace.js]]
		importScript('User:Perhelion/JustReplace+.js');
		// File desc. cleanup
		importScript('User:Magog the Ogre/cleanup.js');
	}

	// Insert a personalized text-template into the Special:Upload edit box.
	// I upload mostly my own work; prefill input form; adapted from [[User:Dschwen]]<nowiki>
	if (pn === 'Special:Upload' && /&uselang=([^&]*)ownwork/.test(location.search)) {
		var re = RegExp.$1;
		setTimeout(function () {
			$('#wpUploadDescription').val(
				'=={{int:filedesc}}==\n\
				{{Information\n\
				|description=\n{{en|1=}}\n' +
				((re) ? '{{' + re + '|1=}}\n' : '') +
				'|date=' + '{{Originaluploaddate|}} {{vectorization}} {{Uploaddate|{{subst:CURRENTYEAR}}-{{subst:CURRENTMONTH}}-{{subst:CURRENTDAY2}}}}\n\
				|source={{own based|…}}\n\
				|author={{AutVec||' + un + '}}\n\
				|permission=\n\
				|other versions=\n\
				//<gallery widths="100" heights="100" showfilename>\n\n</gallery>\n\
				|other fields={{Igen|h|+|s=|u=' + un + '}}\n\
				}}\n\n\
				=={{int:license-header}}==\n\
				{{self|GFDL|cc-by-sa-4.0|author=I, [[User:' + un + '|]]}}');
		}, 100);
	} else { // If not on Special:Upload change the Upload-link.
		$('#n-uploadbtn').find('a').attr('href', '//commons.wikimedia.org/w/index.php?title=Special:Upload&uselang=' +
			((ul === 'en') ? '' : ul) + 'ownwork&uploadformstyle=basic');
	} // </nowiki>
}); // end mw.util

//<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":5,"summaryChacheLen":5,"loadThumbs":true,"loadWikitext":true};
//////////////////////////////////vFCvFCCfgEnd//
//</nowiki>