don't add error handler multiple times

This commit is contained in:
ccd0 2014-07-26 11:44:56 -07:00
parent 6d5fec5dcb
commit a995d5ecb1

View File

@ -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'