mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-14 11:16:44 +00:00
Use a for
loop instead of Array.prototype.find
Array.prototype.find is part of ES6 and not supported by older browser.
This change is a follow-up of 965b496850
.
Bug: T205162
Change-Id: I0954c42a37668b0eb46c3e864a2e13152a6dc68a
This commit is contained in:
parent
31a83b948a
commit
170d10848b
|
@ -395,7 +395,7 @@
|
|||
* @param {boolean} updateHash Viewer should update the location hash when true
|
||||
*/
|
||||
MMVP.loadImageByTitle = function ( title, updateHash ) {
|
||||
var viewer = this;
|
||||
var i, thumb;
|
||||
|
||||
if ( !this.thumbs || !this.thumbs.length ) {
|
||||
return;
|
||||
|
@ -403,13 +403,13 @@
|
|||
|
||||
this.comingFromHashChange = !updateHash;
|
||||
|
||||
this.thumbs.find( function ( thumb ) {
|
||||
for ( i = 0; i < this.thumbs.length; i++ ) {
|
||||
thumb = this.thumbs[ i ];
|
||||
if ( thumb.title.getPrefixedText() === title.getPrefixedText() ) {
|
||||
viewer.loadImage( thumb.image, thumb.$thumb.clone()[ 0 ], true );
|
||||
return true;
|
||||
this.loadImage( thumb.image, thumb.$thumb.clone()[ 0 ], true );
|
||||
return;
|
||||
}
|
||||
return false;
|
||||
} );
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue