* @var boolean
*/
_isOpen: false,
+
+ /**
+ * @var HTMLElement|null
+ */
+ _messageSignature: null,
/**
* number of total images
height: document.documentElement.clientHeight,
width: document.documentElement.clientWidth
};
+ this._messageSignature = null;
this._proxy = new WCF.Action.Proxy({
success: $.proxy(this._success, this)
});
}, '', '');
}
+ this._messageSignature = null;
if (this.options.staticViewer) {
+ if (targetImageElementID) {
+ this._messageSignature = document.getElementById(targetImageElementID).closest(".messageSignature");
+ }
+
+ // Reset the internal state because it could refer to a different set of images.
+ this._active = -1;
+ this._activeImage = null;
+
var $images = this._getStaticImages();
this._initUI();
this._createThumbnails($images, true);
}, this));
}
else if (targetImageElementID) {
+ var images = [];
+
+ $(this.options.imageSelector).each((function (_index, image) {
+ // If the target image is inside a signature, then only include images within
+ // the same signature. Otherwise this check will exclude images that are within
+ // a user's signature.
+ if (image.closest(".messageSignature") !== this._messageSignature) {
+ return;
+ }
+
+ images.push(image);
+ }).bind(this));
+
var $i = 0;
- $(this.options.imageSelector).each(function(index, element) {
- if ($(element).wcfIdentify() == targetImageElementID) {
+ images.forEach(function (image, index) {
+ if (image.id === targetImageElementID) {
$i = index;
-
- return false;
}
- });
+ })
var $item = this._ui.imageList.children('li:eq(' + $i + ')');
*/
_getStaticImages: function() {
var $images = [ ];
-
- $(this.options.imageSelector).each(function(index, link) {
+
+ $(this.options.imageSelector).each((function(index, link) {
+ // If the target image is inside a signature, then only include images within
+ // the same signature. Otherwise this check will exclude images that are within
+ // a user's signature.
+ if (link.closest(".messageSignature") !== this._messageSignature) {
+ return;
+ }
+
var $link = $(link);
var $thumbnail = $link.find('> img, .attachmentThumbnailImage > img').first();
if (!$thumbnail.length) {
},
user: null
});
- });
+ }).bind(this));
this._items = $images.length;