nitpicking
Conflicts:
builds/4chan-X-beta.user.js
builds/4chan-X.user.js
src/Images/ImageExpand.coffee
This commit is contained in:
parent
cbbaee501a
commit
733a1ffa14
@ -17,16 +17,20 @@ ImageExpand =
|
|||||||
return unless @file?.isImage or @file?.isVideo
|
return unless @file?.isImage or @file?.isVideo
|
||||||
{thumb} = @file
|
{thumb} = @file
|
||||||
$.on thumb.parentNode, 'click', ImageExpand.cb.toggle
|
$.on thumb.parentNode, 'click', ImageExpand.cb.toggle
|
||||||
if @isClone and $.hasClass thumb, 'expanding'
|
if @isClone
|
||||||
# If we clone a post where the image is still loading,
|
if $.hasClass thumb, 'expanding'
|
||||||
# make it loading in the clone too.
|
# If we clone a post where the image is still loading,
|
||||||
ImageExpand.contract @
|
# make it loading in the clone too.
|
||||||
ImageExpand.expand @
|
ImageExpand.contract @
|
||||||
else if @isClone and @file.isExpanded and @file.isVideo
|
ImageExpand.expand @
|
||||||
clone = @
|
|
||||||
ImageExpand.setupVideoControls clone
|
else if @file.isExpanded and @file.isVideo
|
||||||
unless clone.origin.file.fullImage.paused
|
clone = @
|
||||||
$.queueTask -> Video.start clone.file.fullImage
|
ImageExpand.setupVideoControls clone
|
||||||
|
unless clone.origin.file.fullImage.paused
|
||||||
|
$.queueTask -> Video.start clone.file.fullImage
|
||||||
|
|
||||||
|
return
|
||||||
else if ImageExpand.on and !@isHidden and
|
else if ImageExpand.on and !@isHidden and
|
||||||
(Conf['Expand spoilers'] or !@file.isSpoiler) and
|
(Conf['Expand spoilers'] or !@file.isSpoiler) and
|
||||||
(Conf['Expand videos'] or !@file.isVideo)
|
(Conf['Expand videos'] or !@file.isVideo)
|
||||||
@ -129,8 +133,7 @@ ImageExpand =
|
|||||||
ImageExpand.completeExpand post, disableAutoplay
|
ImageExpand.completeExpand post, disableAutoplay
|
||||||
|
|
||||||
completeExpand: (post, disableAutoplay) ->
|
completeExpand: (post, disableAutoplay) ->
|
||||||
{thumb} = post.file
|
return unless $.hasClass post.file.thumb, 'expanding' # contracted before the image loaded
|
||||||
return unless $.hasClass thumb, 'expanding' # contracted before the image loaded
|
|
||||||
unless post.nodes.root.parentNode
|
unless post.nodes.root.parentNode
|
||||||
# Image might start/finish loading before the post is inserted.
|
# Image might start/finish loading before the post is inserted.
|
||||||
# Don't scroll when it's expanded in a QP for example.
|
# Don't scroll when it's expanded in a QP for example.
|
||||||
@ -143,7 +146,6 @@ ImageExpand =
|
|||||||
window.scrollBy 0, post.nodes.root.getBoundingClientRect().bottom - bottom
|
window.scrollBy 0, post.nodes.root.getBoundingClientRect().bottom - bottom
|
||||||
|
|
||||||
completeExpand2: (post, disableAutoplay) ->
|
completeExpand2: (post, disableAutoplay) ->
|
||||||
{thumb} = post.file
|
|
||||||
$.addClass post.nodes.root, 'expanded-image'
|
$.addClass post.nodes.root, 'expanded-image'
|
||||||
$.rmClass post.file.thumb, 'expanding'
|
$.rmClass post.file.thumb, 'expanding'
|
||||||
post.file.isExpanded = true
|
post.file.isExpanded = true
|
||||||
@ -151,19 +153,17 @@ ImageExpand =
|
|||||||
ImageExpand.setupVideoControls post
|
ImageExpand.setupVideoControls post
|
||||||
Video.configure post.file.fullImage, disableAutoplay
|
Video.configure post.file.fullImage, disableAutoplay
|
||||||
|
|
||||||
videoCB:
|
videoCB: do ->
|
||||||
click: (e) ->
|
|
||||||
if @paused and not @controls
|
|
||||||
@play()
|
|
||||||
e.stopPropagation()
|
|
||||||
|
|
||||||
# dragging to the left contracts the video
|
# dragging to the left contracts the video
|
||||||
mousedown: (e) -> @dataset.mousedown = 'true' if e.button is 0
|
mousedown = false
|
||||||
mouseup: (e) -> @dataset.mousedown = 'false' if e.button is 0
|
mouseover: -> mousedown = false
|
||||||
mouseover: (e) -> @dataset.mousedown = 'false'
|
mousedown: (e) -> mousedown = true if e.button is 0
|
||||||
mouseout: (e) ->
|
mouseup: (e) -> mousedown = false if e.button is 0
|
||||||
if @dataset.mousedown is 'true' and e.clientX <= @getBoundingClientRect().left
|
mouseout: (e) -> ImageExpand.contract (Get.postFromNode @) if mousedown and e.clientX <= @getBoundingClientRect().left
|
||||||
ImageExpand.contract (Get.postFromNode @)
|
click: (e) ->
|
||||||
|
if @paused and not @controls
|
||||||
|
e.stopPropagation()
|
||||||
|
@play()
|
||||||
|
|
||||||
setupVideoControls: (post) ->
|
setupVideoControls: (post) ->
|
||||||
{file} = post
|
{file} = post
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user