From 7c76da5dfa87ac1ac00a42a3e5f542485f8211ec Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 22 Mar 2015 11:31:37 +0100 Subject: [PATCH] Work-around for uploaded images being stuck in the viewer --- wcfsetup/install/files/js/WCF.ImageViewer.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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')); } -- 2.20.1