User:Keymap9/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
		}
	}
});