From: Alexander Ebert Date: Sun, 22 Mar 2015 10:31:37 +0000 (+0100) Subject: Work-around for uploaded images being stuck in the viewer X-Git-Tag: 2.1.2~17 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7c76da5dfa87ac1ac00a42a3e5f542485f8211ec;p=GitHub%2FWoltLab%2FWCF.git Work-around for uploaded images being stuck in the viewer --- diff --git a/wcfsetup/install/files/js/WCF.ImageViewer.js b/wcfsetup/install/files/js/WCF.ImageViewer.js index 2c485ed73d..42b72a0ac8 100644 --- a/wcfsetup/install/files/js/WCF.ImageViewer.js +++ b/wcfsetup/install/files/js/WCF.ImageViewer.js @@ -558,6 +558,24 @@ $.widget('ui.wcfImageViewer', { }); var $item = this._ui.imageList.children('li:eq(' + $i + ')'); + + // check if currently active image does not exist anymore + if (this._active !== -1) { + var $clear = false; + if (this._active != $item.data('index')) { + $clear = true; + } + + if (this._ui.images[this._activeImage].prop('src') != this._images[this._active].image.url) { + $clear = true; + } + + if ($clear) { + // reset active state + this._active = -1; + } + } + $item.trigger('click'); this.moveToImage($item.data('index')); }