fix hover bug, some code cleanup

This commit is contained in:
ccd0 2014-07-18 19:23:45 -07:00
parent cc9a0d28d9
commit f6641ee54e

View File

@ -10,20 +10,16 @@ ImageHover =
$.on @file.thumb, 'mouseover', ImageHover.mouseover $.on @file.thumb, 'mouseover', ImageHover.mouseover
mouseover: (e) -> mouseover: (e) ->
post = Get.postFromNode @ post = Get.postFromNode @
{isVideo} = post.file {file} = post
if post.file.fullImage {isVideo} = file
el = post.file.fullImage if el = file.fullImage
TrashQueue.remove el TrashQueue.remove el
else else
el = $.el (if isVideo then 'video' else 'img'), el = $.el (if isVideo then 'video' else 'img'),
className: 'full-image' className: 'full-image'
src: post.file.URL src: file.URL
post.file.fullImage = el file.fullImage = el
{thumb} = post.file $.after file.thumb, el unless el is file.thumb.nextSibling
if d.body.contains thumb
$.after thumb, el unless el is thumb.nextSibling
else
$.add Header.hover, el if el.parentNode isnt Header.hover
el.id = 'ihover' el.id = 'ihover'
el.dataset.fullID = post.fullID el.dataset.fullID = post.fullID
if isVideo if isVideo