don't show controls on videos until the mouse is moved over them
This commit is contained in:
parent
a8f4f419dd
commit
b224d20896
@ -57,7 +57,9 @@ Main =
|
|||||||
Redirect.navigate URL
|
Redirect.navigate URL
|
||||||
else if Conf['Loop in New Tab'] and video = $ 'video'
|
else if Conf['Loop in New Tab'] and video = $ 'video'
|
||||||
video.loop = true
|
video.loop = true
|
||||||
Video.start video
|
video.controls = false
|
||||||
|
video.play()
|
||||||
|
ImageCommon.addControls video
|
||||||
return
|
return
|
||||||
|
|
||||||
if Conf['Normalize URL'] and g.VIEW is 'thread'
|
if Conf['Normalize URL'] and g.VIEW is 'thread'
|
||||||
|
|||||||
@ -160,8 +160,8 @@ Gallery =
|
|||||||
$.replace nodes.current, file
|
$.replace nodes.current, file
|
||||||
if elType is 'video'
|
if elType is 'video'
|
||||||
file.loop = true
|
file.loop = true
|
||||||
file.controls = Conf['Show Controls']
|
file.play() if Conf['Autoplay']
|
||||||
Video.start file if Conf['Autoplay']
|
ImageCommon.addControls file if Conf['Show Controls']
|
||||||
nodes.count.textContent = +@dataset.id + 1
|
nodes.count.textContent = +@dataset.id + 1
|
||||||
nodes.current = file
|
nodes.current = file
|
||||||
nodes.frame.scrollTop = 0
|
nodes.frame.scrollTop = 0
|
||||||
@ -216,7 +216,7 @@ Gallery =
|
|||||||
Gallery.cb.cleanupTimer()
|
Gallery.cb.cleanupTimer()
|
||||||
{current} = Gallery.nodes
|
{current} = Gallery.nodes
|
||||||
isVideo = current.nodeName is 'VIDEO'
|
isVideo = current.nodeName is 'VIDEO'
|
||||||
Video.start current if isVideo
|
current.play() if isVideo
|
||||||
if (if isVideo then current.readyState > 4 else current.complete) or current.nodeName is 'IFRAME'
|
if (if isVideo then current.readyState > 4 else current.complete) or current.nodeName is 'IFRAME'
|
||||||
Gallery.cb.startTimer()
|
Gallery.cb.startTimer()
|
||||||
else
|
else
|
||||||
|
|||||||
@ -42,3 +42,11 @@ ImageCommon =
|
|||||||
filename: post.file.URL
|
filename: post.file.URL
|
||||||
if URL and (/^https:\/\//.test(URL) or location.protocol is 'http:')
|
if URL and (/^https:\/\//.test(URL) or location.protocol is 'http:')
|
||||||
return cb URL
|
return cb URL
|
||||||
|
|
||||||
|
addControls: (video) ->
|
||||||
|
handler = ->
|
||||||
|
$.off video, 'mouseover', handler
|
||||||
|
# Hacky workaround for Firefox forever-loading bug for very short videos
|
||||||
|
$.asap (-> (video.readyState >= 3 and video.currentTime <= Math.max 0.1, (video.duration - 0.5)) or !d.contains video), ->
|
||||||
|
video.controls = true
|
||||||
|
$.on video, 'mouseover', handler
|
||||||
|
|||||||
@ -171,9 +171,9 @@ ImageExpand =
|
|||||||
|
|
||||||
video = file.fullImage
|
video = file.fullImage
|
||||||
video.loop = true
|
video.loop = true
|
||||||
video.controls = Conf['Show Controls']
|
|
||||||
ImageExpand.setupVideoCB post
|
ImageExpand.setupVideoCB post
|
||||||
ImageExpand.play post if Conf['Autoplay']
|
ImageExpand.play post if Conf['Autoplay']
|
||||||
|
ImageCommon.addControls video if Conf['Show Controls']
|
||||||
|
|
||||||
# Scroll to keep our place in the thread when images are expanded above us.
|
# Scroll to keep our place in the thread when images are expanded above us.
|
||||||
if oldBottom? and oldBottom <= 0
|
if oldBottom? and oldBottom <= 0
|
||||||
@ -181,7 +181,7 @@ ImageExpand =
|
|||||||
|
|
||||||
play: (post) ->
|
play: (post) ->
|
||||||
if !d.hidden and Header.isNodeVisible post.file.fullImage
|
if !d.hidden and Header.isNodeVisible post.file.fullImage
|
||||||
Video.start post.file.fullImage
|
post.file.fullImage.play()
|
||||||
else
|
else
|
||||||
post.file.wasPlaying = true
|
post.file.wasPlaying = true
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +0,0 @@
|
|||||||
Video =
|
|
||||||
start: (video) ->
|
|
||||||
return unless video.paused
|
|
||||||
{controls} = video
|
|
||||||
video.controls = false
|
|
||||||
video.play()
|
|
||||||
# Hacky workaround for Firefox forever-loading bug for very short videos
|
|
||||||
if controls
|
|
||||||
$.asap (-> (video.readyState >= 3 and video.currentTime <= Math.max 0.1, (video.duration - 0.5)) or !d.contains video), ->
|
|
||||||
video.controls = true
|
|
||||||
, 500
|
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user