mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-12 09:27:36 +00:00
Merge "Only add handlers on image thumbnails"
This commit is contained in:
commit
822018c418
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue