From a995d5ecb1fb2b09a2958ab82142c8618334f9fc Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 26 Jul 2014 11:44:56 -0700 Subject: [PATCH] don't add error handler multiple times --- src/Images/ImageExpand.coffee | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Images/ImageExpand.coffee b/src/Images/ImageExpand.coffee index 4a5a13996..1a365d799 100755 --- a/src/Images/ImageExpand.coffee +++ b/src/Images/ImageExpand.coffee @@ -102,13 +102,15 @@ ImageExpand = contract: (post) -> {thumb} = post.file - if post.file.isVideo and video = post.file.fullImage - video.pause() - TrashQueue.add video, post - thumb.parentNode.href = video.src + if el = post.file.fullImage + $.off el, 'error', ImageExpand.error + if el and post.file.isVideo + el.pause() + TrashQueue.add el, post + thumb.parentNode.href = el.src thumb.parentNode.target = '_blank' for eventName, cb of ImageExpand.videoCB - $.off video, eventName, cb + $.off el, eventName, cb $.rm post.file.videoControls delete post.file.videoControls $.rmClass post.nodes.root, 'expanded-image'