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]
|
['Reveal Spoiler Thumbnails', RevealSpoilers]
|
||||||
['Image Loading', ImageLoader]
|
['Image Loading', ImageLoader]
|
||||||
['Image Hover', ImageHover]
|
['Image Hover', ImageHover]
|
||||||
|
['Trash Queue', TrashQueue]
|
||||||
['Thread Expansion', ExpandThread]
|
['Thread Expansion', ExpandThread]
|
||||||
['Thread Excerpt', ThreadExcerpt]
|
['Thread Excerpt', ThreadExcerpt]
|
||||||
['Favicon', Favicon]
|
['Favicon', Favicon]
|
||||||
|
|||||||
@ -90,7 +90,9 @@ ImageExpand =
|
|||||||
ImageExpand.contract post
|
ImageExpand.contract post
|
||||||
|
|
||||||
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.nodes.root, 'expanded-image'
|
||||||
$.rmClass post.file.thumb, 'expanding'
|
$.rmClass post.file.thumb, 'expanding'
|
||||||
post.file.isExpanded = false
|
post.file.isExpanded = false
|
||||||
@ -105,6 +107,7 @@ ImageExpand =
|
|||||||
naturalHeight = if isVideo then 'videoHeight' else 'naturalHeight'
|
naturalHeight = if isVideo then 'videoHeight' else 'naturalHeight'
|
||||||
if img = post.file.fullImage
|
if img = post.file.fullImage
|
||||||
# Expand already-loaded/ing picture.
|
# Expand already-loaded/ing picture.
|
||||||
|
TrashQueue.remove img
|
||||||
$.rmClass img, 'ihover'
|
$.rmClass img, 'ihover'
|
||||||
$.addClass img, 'full-image'
|
$.addClass img, 'full-image'
|
||||||
img.controls = (img.parentNode isnt thumb.parentNode)
|
img.controls = (img.parentNode isnt thumb.parentNode)
|
||||||
|
|||||||
@ -13,6 +13,7 @@ ImageHover =
|
|||||||
{isVideo} = post.file
|
{isVideo} = post.file
|
||||||
if post.file.fullImage
|
if post.file.fullImage
|
||||||
el = post.file.fullImage
|
el = post.file.fullImage
|
||||||
|
TrashQueue.remove el
|
||||||
$.rmClass el, 'full-image'
|
$.rmClass el, 'full-image'
|
||||||
$.addClass el, 'ihover'
|
$.addClass el, 'ihover'
|
||||||
else
|
else
|
||||||
@ -36,7 +37,9 @@ ImageHover =
|
|||||||
endEvents: 'mouseout click'
|
endEvents: 'mouseout click'
|
||||||
asapTest: -> el[naturalHeight]
|
asapTest: -> el[naturalHeight]
|
||||||
cb: ->
|
cb: ->
|
||||||
el.pause() if isVideo
|
if isVideo
|
||||||
|
el.pause()
|
||||||
|
TrashQueue.add el
|
||||||
$.rmClass el, 'ihover'
|
$.rmClass el, 'ihover'
|
||||||
$.addClass el, 'full-image'
|
$.addClass el, 'full-image'
|
||||||
$.on el, 'error', ImageHover.error
|
$.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