cleanup?
Conflicts: LICENSE builds/4chan-X-beta.user.js builds/4chan-X.user.js src/Images/ImageExpand.coffee src/Images/ImageHover.coffee
This commit is contained in:
parent
4ce8589e44
commit
b0941f4ae4
@ -72,8 +72,7 @@ ImageExpand =
|
||||
(if @checked then $.addClass else $.rmClass) doc, @name.toLowerCase().replace /\s+/g, '-'
|
||||
|
||||
toggle: (post) ->
|
||||
{thumb} = post.file
|
||||
unless post.file.isExpanded or $.hasClass thumb, 'expanding'
|
||||
unless post.file.isExpanded or $.hasClass post.file.thumb, 'expanding'
|
||||
ImageExpand.expand post
|
||||
return
|
||||
|
||||
@ -102,17 +101,18 @@ ImageExpand =
|
||||
ImageExpand.contract post
|
||||
|
||||
contract: (post) ->
|
||||
{thumb} = post.file
|
||||
if post.file.isVideo and video = post.file.fullImage
|
||||
video.pause()
|
||||
TrashQueue.add video, post
|
||||
post.file.thumb.parentNode.href = video.src
|
||||
post.file.thumb.parentNode.target = '_blank'
|
||||
thumb.parentNode.href = video.src
|
||||
thumb.parentNode.target = '_blank'
|
||||
for eventName, cb of ImageExpand.videoCB
|
||||
$.off video, eventName, cb
|
||||
$.rm post.file.videoControls
|
||||
delete post.file.videoControls
|
||||
$.rmClass post.nodes.root, 'expanded-image'
|
||||
$.rmClass post.file.thumb, 'expanding'
|
||||
$.rmClass thumb, 'expanding'
|
||||
post.file.isExpanded = false
|
||||
|
||||
expand: (post, src, disableAutoplay) ->
|
||||
@ -129,7 +129,7 @@ ImageExpand =
|
||||
$.on el, 'error', ImageExpand.error
|
||||
el.src = src or post.file.URL
|
||||
$.after thumb, el unless el is thumb.nextSibling
|
||||
$.asap (-> if isVideo then el.videoHeight else el.naturalHeight), ->
|
||||
$.asap (-> el.videoHeight or el.naturalHeight), ->
|
||||
ImageExpand.completeExpand post, disableAutoplay
|
||||
|
||||
completeExpand: (post, disableAutoplay) ->
|
||||
@ -162,11 +162,12 @@ ImageExpand =
|
||||
mouseout: (e) -> ImageExpand.contract(Get.postFromNode @) if mousedown and e.clientX <= @getBoundingClientRect().left
|
||||
click: (e) ->
|
||||
if @paused and not @controls
|
||||
e.stopPropagation()
|
||||
@play()
|
||||
e.preventDefault()
|
||||
|
||||
setupVideoControls: (post) ->
|
||||
{file} = post
|
||||
{thumb} = file
|
||||
video = file.fullImage
|
||||
|
||||
# disable link to file so native controls can work
|
||||
@ -174,7 +175,6 @@ ImageExpand =
|
||||
file.thumb.parentNode.removeAttribute 'target'
|
||||
|
||||
# setup callbacks on video element
|
||||
video.dataset.mousedown = 'false'
|
||||
$.on video, eventName, cb for eventName, cb of ImageExpand.videoCB
|
||||
|
||||
# setup controls in file info
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user