implement length 1 queue of videos to be deleted
This commit is contained in:
parent
337b43591b
commit
342672bab3
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -325,6 +325,7 @@ Main =
|
||||
['Reveal Spoiler Thumbnails', RevealSpoilers]
|
||||
['Image Loading', ImageLoader]
|
||||
['Image Hover', ImageHover]
|
||||
['Trash Queue', TrashQueue]
|
||||
['Thread Expansion', ExpandThread]
|
||||
['Thread Excerpt', ThreadExcerpt]
|
||||
['Favicon', Favicon]
|
||||
|
||||
@ -90,7 +90,9 @@ ImageExpand =
|
||||
ImageExpand.contract post
|
||||
|
||||
contract: (post) ->
|
||||
post.file.fullImage?.pause() if post.file.isVideo
|
||||
if post.file.isVideo and video = post.file.fullImage
|
||||
video.pause()
|
||||
TrashQueue.add video
|
||||
$.rmClass post.nodes.root, 'expanded-image'
|
||||
$.rmClass post.file.thumb, 'expanding'
|
||||
post.file.isExpanded = false
|
||||
@ -105,6 +107,7 @@ ImageExpand =
|
||||
naturalHeight = if isVideo then 'videoHeight' else 'naturalHeight'
|
||||
if img = post.file.fullImage
|
||||
# Expand already-loaded/ing picture.
|
||||
TrashQueue.remove img
|
||||
$.rmClass img, 'ihover'
|
||||
$.addClass img, 'full-image'
|
||||
img.controls = (img.parentNode isnt thumb.parentNode)
|
||||
|
||||
@ -13,6 +13,7 @@ ImageHover =
|
||||
{isVideo} = post.file
|
||||
if post.file.fullImage
|
||||
el = post.file.fullImage
|
||||
TrashQueue.remove el
|
||||
$.rmClass el, 'full-image'
|
||||
$.addClass el, 'ihover'
|
||||
else
|
||||
@ -36,7 +37,9 @@ ImageHover =
|
||||
endEvents: 'mouseout click'
|
||||
asapTest: -> el[naturalHeight]
|
||||
cb: ->
|
||||
el.pause() if isVideo
|
||||
if isVideo
|
||||
el.pause()
|
||||
TrashQueue.add el
|
||||
$.rmClass el, 'ihover'
|
||||
$.addClass el, 'full-image'
|
||||
$.on el, 'error', ImageHover.error
|
||||
|
||||
14
src/Images/TrashQueue.coffee
Normal file
14
src/Images/TrashQueue.coffee
Normal file
@ -0,0 +1,14 @@
|
||||
TrashQueue =
|
||||
init: -> return
|
||||
|
||||
add: (video) ->
|
||||
if video isnt @killNext and @killNext
|
||||
post = Get.postFromNode @killNext
|
||||
delete post?.file?.fullImage
|
||||
$.rm @killNext
|
||||
@killNext = video
|
||||
|
||||
remove: (video) ->
|
||||
if video is @killNext
|
||||
delete @killNext
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user