From edf4ac39f5c1bac7599a5a5e1510c882493c8f16 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sat, 29 Nov 2014 20:29:22 +0100 Subject: [PATCH] work-around for Chrome on iOS --- wcfsetup/install/files/js/WCF.ImageViewer.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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; } -- 2.20.1