Merge "Only add handlers on image thumbnails"

This commit is contained in:
jenkins-bot 2013-10-24 20:31:14 +00:00 committed by Gerrit Code Review
commit 822018c418

View file

@ -17,6 +17,16 @@
( function ( mw, $ ) { ( function ( mw, $ ) {
var MultiLightbox, LightboxImage, lightboxHooks, var MultiLightbox, LightboxImage, lightboxHooks,
validExtensions = {
'jpg': true,
'jpeg': true,
'gif': true,
'svg': true,
'png': true,
'tiff': true,
'tif': true
},
iiprops = [ iiprops = [
'timestamp', 'timestamp',
'user', 'user',
@ -49,6 +59,11 @@
fileTitle = mw.Title.newFromImg( $thumb ), fileTitle = mw.Title.newFromImg( $thumb ),
index = urls.length; index = urls.length;
if ( !validExtensions[fileTitle.getExtension().toLowerCase()] ) {
// Not a valid extension, skip this one
return;
}
$links.data( 'filePageLink', filePageLink ); $links.data( 'filePageLink', filePageLink );
urls.push( new LightboxImage( fileLink ) ); urls.push( new LightboxImage( fileLink ) );
urls[index].filePageLink = filePageLink; urls[index].filePageLink = filePageLink;