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) -> contract: (post) ->
{thumb} = post.file {thumb} = post.file
if post.file.isVideo and video = post.file.fullImage if el = post.file.fullImage
video.pause() $.off el, 'error', ImageExpand.error
TrashQueue.add video, post if el and post.file.isVideo
thumb.parentNode.href = video.src el.pause()
TrashQueue.add el, post
thumb.parentNode.href = el.src
thumb.parentNode.target = '_blank' thumb.parentNode.target = '_blank'
for eventName, cb of ImageExpand.videoCB for eventName, cb of ImageExpand.videoCB
$.off video, eventName, cb $.off el, eventName, cb
$.rm post.file.videoControls $.rm post.file.videoControls
delete post.file.videoControls delete post.file.videoControls
$.rmClass post.nodes.root, 'expanded-image' $.rmClass post.nodes.root, 'expanded-image'