From 56d3c2de46282274958e599447efdce792ce3810 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 11 Mar 2014 02:29:30 +0100 Subject: [PATCH] Using Image.complete is dangerous, Firefox always returns true --- wcfsetup/install/files/js/WCF.ImageViewer.js | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/wcfsetup/install/files/js/WCF.ImageViewer.js b/wcfsetup/install/files/js/WCF.ImageViewer.js index 439d264f32..3972518932 100644 --- a/wcfsetup/install/files/js/WCF.ImageViewer.js +++ b/wcfsetup/install/files/js/WCF.ImageViewer.js @@ -574,7 +574,6 @@ $.widget('ui.wcfImageViewer', { var $dimensions = this._ui.imageContainer.getDimensions('inner'); var $newImageIndex = (this._activeImage ? 0 : 1); - this._renderImage($newImageIndex, $image, $dimensions); if (this._activeImage !== null) { this._ui.images[this._activeImage].removeClass('active'); @@ -583,17 +582,12 @@ $.widget('ui.wcfImageViewer', { this._activeImage = $newImageIndex; var $currentActiveImage = this._active; - if (this._ui.images[$newImageIndex].get(0).complete) { - // image was fetched from cache + this._ui.imageContainer.addClass('loading'); + this._ui.images[$newImageIndex].off('load').on('load', $.proxy(function() { this._imageOnLoad($currentActiveImage, $newImageIndex); - } - else { - // image is loading, display once loaded - this._ui.imageContainer.addClass('loading'); - this._ui.images[$newImageIndex].off('load').on('load', $.proxy(function() { - this._imageOnLoad($currentActiveImage, $newImageIndex); - }, this)); - } + }, this)); + + this._renderImage($newImageIndex, $image, $dimensions); // user var $link = this._ui.header.find('> div > a').prop('href', $image.user.link).prop('title', $image.user.username); -- 2.20.1