From: Alexander Ebert Date: Sat, 29 Nov 2014 19:29:22 +0000 (+0100) Subject: work-around for Chrome on iOS X-Git-Tag: 2.1.0_Beta_1~118 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=edf4ac39f5c1bac7599a5a5e1510c882493c8f16;p=GitHub%2FWoltLab%2FWCF.git work-around for Chrome on iOS --- diff --git a/wcfsetup/install/files/js/WCF.ImageViewer.js b/wcfsetup/install/files/js/WCF.ImageViewer.js index fef0f6a7ac..040e12f73d 100644 --- a/wcfsetup/install/files/js/WCF.ImageViewer.js +++ b/wcfsetup/install/files/js/WCF.ImageViewer.js @@ -714,10 +714,23 @@ $.widget('ui.wcfImageViewer', { $image.trigger('load'); } - if (this.options.staticViewer && !imageData.height && $image[0].complete) { + if (this.options.staticViewer && !imageData.image.height && $image[0].complete) { var $img = new Image(); $img.src = imageData.image.url; + // Chrome on iOS seems to not fetch images from cache + if (navigator.userAgent.match(/CriOS/)) { + var self = this; + $img.onload = function() { + imageData.image.height = this.height; + imageData.image.width = this.width; + + self._renderImage(targetIndex, imageData, containerDimensions); + }; + + return; + } + imageData.image.height = $img.height; imageData.image.width = $img.width; }