User:Glrx/common.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.
The accompanying .css page for this skin can be added at User:Glrx/common.css. |
// <nowiki>
var ns = mw.config.get('wgNamespaceNumber'),
ti = mw.config.get('wgTitle');
$.when(mw.loader.using(['mediawiki.util']), $.ready).done(function () {
// if File: namespace
if ( ns === 6 ) { // Files only
// and title ends in "svg"
if (/SVG/i.test(ti.slice(-3))) { // SVG
// SVG edit
importScript('User:Rillke/SVGedit.js');
}
}
});
// copied from https://commons.wikimedia.org/w/index.php?title=Commons:Village_pump/Technical&diff=prev&oldid=826080394
if (mw.config.get('wgNamespaceNumber') === 6 &&
mw.config.get('wgIsArticle') &&
/(PNG|GIF|JPE?G|TIF?F|WEBP)$/i.test(mw.config.get('wgTitle'))) {
$(function () {
var file = document.getElementById('file');
if (file) {
mw.util.addPortletLink(
'p-tb',
new mw.Uri('https://ocr.wmcloud.org/').extend({image: file.querySelector('a').href}).toString(),
'OCR',
't-ocr',
'Transcribe text in the image'
);
}
});
}
//</nowiki>