Better handling of videos inside of clones.
This commit is contained in:
parent
259fd0cc89
commit
9bb234ab5e
@ -19,15 +19,11 @@ ImageExpand =
|
|||||||
if @isClone
|
if @isClone
|
||||||
if @file.error
|
if @file.error
|
||||||
@file.error = $ '.warning', @file.thumb.parentNode
|
@file.error = $ '.warning', @file.thumb.parentNode
|
||||||
if @file.isImage and @file.isExpanding
|
else if @file.isExpanding or @file.isExpanded
|
||||||
# If we clone a post where the image is still loading,
|
# Re-expand to make sure everything works/loads fine.
|
||||||
# make it loading in the clone too.
|
|
||||||
ImageExpand.contract @
|
ImageExpand.contract @
|
||||||
ImageExpand.expand @
|
ImageExpand.expand @
|
||||||
return
|
return
|
||||||
if @file.isVideo and @file.isExpanded
|
|
||||||
@file.fullImage.play()
|
|
||||||
return
|
|
||||||
if ImageExpand.on and !@isHidden and (Conf['Expand spoilers'] or !@file.isSpoiler)
|
if ImageExpand.on and !@isHidden and (Conf['Expand spoilers'] or !@file.isSpoiler)
|
||||||
ImageExpand.expand @
|
ImageExpand.expand @
|
||||||
cb:
|
cb:
|
||||||
@ -139,13 +135,16 @@ ImageExpand =
|
|||||||
delete post.file.isExpanding
|
delete post.file.isExpanding
|
||||||
post.file.isReady = true
|
post.file.isReady = true
|
||||||
post.file.isExpanded = true
|
post.file.isExpanded = true
|
||||||
|
if post.file.isVideo and !d.hidden and (post.isClone and !post.nodes.root.parentNode or Header.isNodeVisible post.nodes.root)
|
||||||
|
# Play the video if it's in a clone that hasn't been inserted yet,
|
||||||
|
# otherwise, check if it's in the viewport as usual.
|
||||||
|
post.file.fullImage.play()
|
||||||
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.
|
||||||
$.addClass post.nodes.root, 'expanded-image'
|
$.addClass post.nodes.root, 'expanded-image'
|
||||||
$.rmClass post.file.thumb, 'expanding'
|
$.rmClass post.file.thumb, 'expanding'
|
||||||
return
|
return
|
||||||
post.file.fullImage.play() if post.file.isVideo and !d.hidden and Header.isNodeVisible post.nodes.root
|
|
||||||
{bottom} = post.nodes.root.getBoundingClientRect()
|
{bottom} = post.nodes.root.getBoundingClientRect()
|
||||||
$.queueTask ->
|
$.queueTask ->
|
||||||
$.addClass post.nodes.root, 'expanded-image'
|
$.addClass post.nodes.root, 'expanded-image'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user