User:Kwj2772/validator.js
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.
Documentation for this user script can be added at User:Kwj2772/validator. |
if (typeof (SVGValidate) == 'undefined') {
var SVGValidate = {
validate: function () {
if (mw.config.get( 'wgNamespaceNumber' ) == 6 && mw.config.get( 'wgAction' ) == 'view' && mw.config.get( 'wgTitle' ).match(/\.svg$/i)) {
var svgFileElement = $('#file a:has(img)').get(0);
if (!svgFileElement) return;
var svgFilePath = svgFileElement.href;
mw.util.addPortletLink('p-cactions', 'http://validator.w3.org/check?uri=' + encodeURIComponent(svgFilePath), 'SVG Validate', 'ca-validateSVG');
}
}
};
}
$(SVGValidate.validate);