Guard against double insertion.
This was a problem when the gallery was opened before the page was done parsing.
This commit is contained in:
parent
ea5d27a502
commit
a5494c8a2e
@ -31,6 +31,7 @@ Gallery =
|
|||||||
build: (image) ->
|
build: (image) ->
|
||||||
Gallery.images = []
|
Gallery.images = []
|
||||||
nodes = Gallery.nodes = {}
|
nodes = Gallery.nodes = {}
|
||||||
|
Gallery.fullIDs = {}
|
||||||
Gallery.slideshow = false
|
Gallery.slideshow = false
|
||||||
|
|
||||||
nodes.el = dialog = $.el 'div',
|
nodes.el = dialog = $.el 'div',
|
||||||
@ -90,6 +91,9 @@ Gallery =
|
|||||||
generateThumb: (file) ->
|
generateThumb: (file) ->
|
||||||
post = Get.postFromNode file
|
post = Get.postFromNode file
|
||||||
return unless post.file and (post.file.isImage or post.file.isVideo or Conf['PDF in Gallery'])
|
return unless post.file and (post.file.isImage or post.file.isVideo or Conf['PDF in Gallery'])
|
||||||
|
return if Gallery.fullIDs[post.fullID]
|
||||||
|
Gallery.fullIDs[post.fullID] = true
|
||||||
|
|
||||||
title = ($ '.fileText a', file).textContent
|
title = ($ '.fileText a', file).textContent
|
||||||
thumb = $.el 'a',
|
thumb = $.el 'a',
|
||||||
className: 'gal-thumb'
|
className: 'gal-thumb'
|
||||||
@ -248,6 +252,7 @@ Gallery =
|
|||||||
Gallery.nodes.current.pause?()
|
Gallery.nodes.current.pause?()
|
||||||
$.rm Gallery.nodes.el
|
$.rm Gallery.nodes.el
|
||||||
delete Gallery.nodes
|
delete Gallery.nodes
|
||||||
|
delete Gallery.fullIDs
|
||||||
d.body.style.overflow = ''
|
d.body.style.overflow = ''
|
||||||
|
|
||||||
$.off d, 'keydown', Gallery.cb.keybinds
|
$.off d, 'keydown', Gallery.cb.keybinds
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user