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:
Fomafix 2018-09-13 22:09:43 +02:00 committed by MGChecker
parent 31a83b948a
commit 170d10848b

View file

@ -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;
} );
}
};
/**