fix pause off screen for clones
This commit is contained in:
parent
6b8e23d045
commit
656685a9be
@ -407,6 +407,7 @@ Header =
|
||||
bottom -= clientHeight - headRect.bottom + headRect.height
|
||||
bottom
|
||||
isNodeVisible: (node) ->
|
||||
return false if d.hidden or !doc.contains node
|
||||
{height} = node.getBoundingClientRect()
|
||||
Header.getTopOf(node) + height >= 0 and Header.getBottomOf(node) + height >= 0
|
||||
isHidden: ->
|
||||
|
||||
@ -70,15 +70,15 @@ ImageExpand =
|
||||
|
||||
playVideos: (e) ->
|
||||
g.posts.forEach (post) ->
|
||||
return unless post.file and post.file.isVideo and post.file.isExpanded
|
||||
video = post.file.fullImage
|
||||
visible = !d.hidden and Header.isNodeVisible video
|
||||
if visible and post.file.wasPlaying
|
||||
delete post.file.wasPlaying
|
||||
video.play()
|
||||
else if !visible and !video.paused
|
||||
post.file.wasPlaying = true
|
||||
video.pause()
|
||||
for post in [post, post.clones...] when post.file and post.file.isVideo and post.file.isExpanded
|
||||
video = post.file.fullImage
|
||||
visible = Header.isNodeVisible video
|
||||
if visible and post.file.wasPlaying
|
||||
delete post.file.wasPlaying
|
||||
video.play()
|
||||
else if !visible and !video.paused
|
||||
post.file.wasPlaying = true
|
||||
video.pause()
|
||||
return
|
||||
|
||||
setFitness: ->
|
||||
@ -216,11 +216,14 @@ ImageExpand =
|
||||
fullImage.controls = controls
|
||||
return
|
||||
fullImage.controls = false
|
||||
$.asap (=> doc.contains fullImage), =>
|
||||
if !d.hidden and Header.isNodeVisible fullImage
|
||||
fullImage.play()
|
||||
else
|
||||
post.file.wasPlaying = true
|
||||
if post.isFetchedQuote
|
||||
post.file.wasPlaying = true
|
||||
else
|
||||
$.asap (=> doc.contains fullImage), =>
|
||||
if !d.hidden and Header.isNodeVisible fullImage
|
||||
fullImage.play()
|
||||
else
|
||||
post.file.wasPlaying = true
|
||||
if controls
|
||||
ImageCommon.addControls fullImage
|
||||
|
||||
|
||||
@ -10,10 +10,10 @@ ImageLoader =
|
||||
if Conf['Replace WEBM'] and Conf['Autoplay']
|
||||
$.on d, 'scroll visibilitychange', ->
|
||||
g.posts.forEach (post) ->
|
||||
if post.file?.videoThumb
|
||||
for post in [post, post.clones...] when post.file?.videoThumb
|
||||
{thumb} = post.file
|
||||
visible = !d.hidden and Header.isNodeVisible thumb
|
||||
if visible then thumb.play() else thumb.pause()
|
||||
if Header.isNodeVisible thumb then thumb.play() else thumb.pause()
|
||||
return
|
||||
|
||||
return unless Conf['Image Prefetching']
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user