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, '-'
|
(if @checked then $.addClass else $.rmClass) doc, @name.toLowerCase().replace /\s+/g, '-'
|
||||||
|
|
||||||
toggle: (post) ->
|
toggle: (post) ->
|
||||||
{thumb} = post.file
|
unless post.file.isExpanded or $.hasClass post.file.thumb, 'expanding'
|
||||||
unless post.file.isExpanded or $.hasClass thumb, 'expanding'
|
|
||||||
ImageExpand.expand post
|
ImageExpand.expand post
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -102,17 +101,18 @@ ImageExpand =
|
|||||||
ImageExpand.contract post
|
ImageExpand.contract post
|
||||||
|
|
||||||
contract: (post) ->
|
contract: (post) ->
|
||||||
|
{thumb} = post.file
|
||||||
if post.file.isVideo and video = post.file.fullImage
|
if post.file.isVideo and video = post.file.fullImage
|
||||||
video.pause()
|
video.pause()
|
||||||
TrashQueue.add video, post
|
TrashQueue.add video, post
|
||||||
post.file.thumb.parentNode.href = video.src
|
thumb.parentNode.href = video.src
|
||||||
post.file.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 video, 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'
|
||||||
$.rmClass post.file.thumb, 'expanding'
|
$.rmClass thumb, 'expanding'
|
||||||
post.file.isExpanded = false
|
post.file.isExpanded = false
|
||||||
|
|
||||||
expand: (post, src, disableAutoplay) ->
|
expand: (post, src, disableAutoplay) ->
|
||||||
@ -129,7 +129,7 @@ ImageExpand =
|
|||||||
$.on el, 'error', ImageExpand.error
|
$.on el, 'error', ImageExpand.error
|
||||||
el.src = src or post.file.URL
|
el.src = src or post.file.URL
|
||||||
$.after thumb, el unless el is thumb.nextSibling
|
$.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
|
ImageExpand.completeExpand post, disableAutoplay
|
||||||
|
|
||||||
completeExpand: (post, disableAutoplay) ->
|
completeExpand: (post, disableAutoplay) ->
|
||||||
@ -162,11 +162,12 @@ ImageExpand =
|
|||||||
mouseout: (e) -> ImageExpand.contract(Get.postFromNode @) if mousedown and e.clientX <= @getBoundingClientRect().left
|
mouseout: (e) -> ImageExpand.contract(Get.postFromNode @) if mousedown and e.clientX <= @getBoundingClientRect().left
|
||||||
click: (e) ->
|
click: (e) ->
|
||||||
if @paused and not @controls
|
if @paused and not @controls
|
||||||
e.stopPropagation()
|
|
||||||
@play()
|
@play()
|
||||||
|
e.preventDefault()
|
||||||
|
|
||||||
setupVideoControls: (post) ->
|
setupVideoControls: (post) ->
|
||||||
{file} = post
|
{file} = post
|
||||||
|
{thumb} = file
|
||||||
video = file.fullImage
|
video = file.fullImage
|
||||||
|
|
||||||
# disable link to file so native controls can work
|
# disable link to file so native controls can work
|
||||||
@ -174,7 +175,6 @@ ImageExpand =
|
|||||||
file.thumb.parentNode.removeAttribute 'target'
|
file.thumb.parentNode.removeAttribute 'target'
|
||||||
|
|
||||||
# setup callbacks on video element
|
# setup callbacks on video element
|
||||||
video.dataset.mousedown = 'false'
|
|
||||||
$.on video, eventName, cb for eventName, cb of ImageExpand.videoCB
|
$.on video, eventName, cb for eventName, cb of ImageExpand.videoCB
|
||||||
|
|
||||||
# setup controls in file info
|
# setup controls in file info
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user