MediaWiki:CheckThumb.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 MediaWiki:CheckThumb. |
- Report page listing warnings and errors.
function check_svg()
{
var title = mw.config.get('wgCanonicalNamespace') + ':' + mw.config.get('wgTitle');
var file = document.getElementById('file');
if( !file ) return;
var images = file.getElementsByTagName('img');
var image;
var thumb = null;
for( var i = 0; i < images.length; i++ )
{
image = images[i];
if( image.alt && image.alt == title )
if( ( image.clientWidth == 0 && image.clientHeight == 0 ) ||
( image.fileSize && image.fileSize < 0 ) )
{
thumb = image.src;
break;
}
}
if( thumb )
{
var iframe = document.createElement('iframe');
iframe.style.width = '90%'; iframe.style.height = '200px';
iframe.style.border = '1px solid red';
file.innerHTML = '';
file.appendChild( iframe );
iframe.src = thumb;
}
}
$( check_svg );