img -> file in Gallery
This commit is contained in:
parent
7d14a5395f
commit
9324572a5e
@ -92,9 +92,9 @@ Gallery =
|
|||||||
title = ($ '.fileText a', file).textContent
|
title = ($ '.fileText a', file).textContent
|
||||||
thumb = $.el 'a',
|
thumb = $.el 'a',
|
||||||
className: 'gal-thumb'
|
className: 'gal-thumb'
|
||||||
href: post.file.URL
|
href: post.file.URL
|
||||||
target: '_blank'
|
target: '_blank'
|
||||||
title: title
|
title: title
|
||||||
thumb.dataset.id = Gallery.images.length
|
thumb.dataset.id = Gallery.images.length
|
||||||
thumb.dataset.post = $('a[title="Link to this post"]', post.nodes.info).href
|
thumb.dataset.post = $('a[title="Link to this post"]', post.nodes.info).href
|
||||||
|
|
||||||
@ -140,18 +140,18 @@ Gallery =
|
|||||||
elType = 'video' if /\.webm$/.test(@href)
|
elType = 'video' if /\.webm$/.test(@href)
|
||||||
elType = 'iframe' if /\.pdf$/.test(@href)
|
elType = 'iframe' if /\.pdf$/.test(@href)
|
||||||
(if elType is 'iframe' then $.addClass else $.rmClass) doc, 'gal-pdf'
|
(if elType is 'iframe' then $.addClass else $.rmClass) doc, 'gal-pdf'
|
||||||
img = $.el elType,
|
file = $.el elType,
|
||||||
src: name.href = @href
|
src: name.href = @href
|
||||||
title: name.download = name.textContent = @title
|
title: name.download = name.textContent = @title
|
||||||
if elType is 'video'
|
if elType is 'video'
|
||||||
img.loop = true
|
file.loop = true
|
||||||
img.autoplay = Conf['Autoplay']
|
file.autoplay = Conf['Autoplay']
|
||||||
|
|
||||||
$.extend img.dataset, @dataset
|
$.extend file.dataset, @dataset
|
||||||
nodes.current.pause?()
|
nodes.current.pause?()
|
||||||
$.replace nodes.current, img
|
$.replace nodes.current, file
|
||||||
nodes.count.textContent = +@dataset.id + 1
|
nodes.count.textContent = +@dataset.id + 1
|
||||||
nodes.current = img
|
nodes.current = file
|
||||||
nodes.frame.scrollTop = 0
|
nodes.frame.scrollTop = 0
|
||||||
nodes.next.focus()
|
nodes.next.focus()
|
||||||
|
|
||||||
@ -164,16 +164,16 @@ Gallery =
|
|||||||
|
|
||||||
nodes.thumbs.scrollTop += top
|
nodes.thumbs.scrollTop += top
|
||||||
|
|
||||||
$.on img, 'error', ->
|
$.on file, 'error', ->
|
||||||
Gallery.cb.error img, thumb
|
Gallery.cb.error file, thumb
|
||||||
|
|
||||||
image: (e) ->
|
image: (e) ->
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
Gallery.build @
|
Gallery.build @
|
||||||
|
|
||||||
error: (img, thumb) ->
|
error: (file, thumb) ->
|
||||||
post = Get.postFromLink $.el 'a', href: img.dataset.post
|
post = Get.postFromLink $.el 'a', href: file.dataset.post
|
||||||
delete post.file.fullImage
|
delete post.file.fullImage
|
||||||
|
|
||||||
src = @src.split '/'
|
src = @src.split '/'
|
||||||
@ -183,8 +183,8 @@ Gallery =
|
|||||||
filename: src[src.length - 1]
|
filename: src[src.length - 1]
|
||||||
if URL
|
if URL
|
||||||
thumb.href = URL
|
thumb.href = URL
|
||||||
return unless Gallery.nodes.current is img
|
return unless Gallery.nodes.current is file
|
||||||
img.src = URL
|
file.src = URL
|
||||||
return
|
return
|
||||||
if g.DEAD or post.isDead or post.file.isDead
|
if g.DEAD or post.isDead or post.file.isDead
|
||||||
return
|
return
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user