From: Alexander Ebert Date: Tue, 24 Dec 2019 19:06:05 +0000 (+0100) Subject: Fall-back to the original version if no thumbnail is available X-Git-Tag: 5.2.0~16 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=686197f61d2f3a9b3e230221a317d608572eac66;p=GitHub%2FWoltLab%2FWCF.git Fall-back to the original version if no thumbnail is available --- diff --git a/wcfsetup/install/files/js/WCF.Attachment.js b/wcfsetup/install/files/js/WCF.Attachment.js index 9c38650728..b6ac5d74bd 100644 --- a/wcfsetup/install/files/js/WCF.Attachment.js +++ b/wcfsetup/install/files/js/WCF.Attachment.js @@ -634,8 +634,22 @@ if (COMPILER_TARGET_DEFAULT) { * Inserts all attachments at once. */ _insertAll: function () { - var selector = (this._useThumbnail()) ? '.jsButtonAttachmentInsertThumbnail, .jsButtonAttachmentInsertPlain' : '.jsButtonAttachmentInsertFull, .jsButtonAttachmentInsertPlain'; - this._fileListSelector.children('li:not(.uploadFailed)').find(selector).trigger('click'); + var attachment, button, preferThumbnail = this._useThumbnail(); + for (var i = 0, length = this._fileListSelector[0].childNodes.length; i < length; i++) { + attachment = this._fileListSelector[0].childNodes[i]; + if (attachment.nodeName === 'LI' && !attachment.classList.contains('uploadFailed')) { + button = null; + if (preferThumbnail) { + button = elBySel('.jsButtonAttachmentInsertThumbnail, .jsButtonAttachmentInsertPlain', attachment); + } + + if (button === null) { + button = elBySel('.jsButtonAttachmentInsertFull, .jsButtonAttachmentInsertPlain', attachment); + } + + window.jQuery(button).trigger('click'); + } + } }, /**