Gallery improvements: now loops.

Conflicts:
	builds/appchan-x.user.js
	builds/crx/script.js
	src/Images/Gallery.coffee
This commit is contained in:
Zixaphir 2014-07-17 23:42:18 -07:00 committed by ccd0
parent 0912bfb98d
commit 1f6ccfca8b

View File

@ -162,16 +162,13 @@ Gallery =
nodes.next.focus()
Gallery.cb[if slideshow then 'setupTimer' else 'stop']()
# Scroll to post
if Conf['Scroll to Post'] and post = (post = g.posts[file.dataset.post])?.nodes.root
Header.scrollTo post
# Center selected thumbnail
nodes.thumbs.scrollTop = @offsetTop + @offsetHeight/2 - nodes.thumbs.clientHeight/2
# Scroll to post
try
if Conf['Scroll to Post'] and post = (post = g.posts[file.dataset.post])?.nodes.root
Header.scrollTo post
catch err
console.log err
image: (e) ->
e.preventDefault()
e.stopPropagation()
@ -206,8 +203,14 @@ Gallery =
if postObj.filedeleted
post.kill true
prev: -> Gallery.cb.open.call Gallery.images[+Gallery.nodes.current.dataset.id - 1]
next: -> Gallery.cb.open.call Gallery.images[+Gallery.nodes.current.dataset.id + 1]
prev: ->
Gallery.cb.open.call(
Gallery.images[+Gallery.nodes.current.dataset.id - 1] or Gallery.images[Gallery.images.length - 1]
)
next: ->
Gallery.cb.open.call(
Gallery.images[+Gallery.nodes.current.dataset.id + 1] or Gallery.images[0]
)
enterKey: -> if Gallery.nodes.current.paused then Gallery.nodes.current.play() else Gallery.cb.next()
click: -> Gallery.cb[if Gallery.nodes.current.controls then 'stop' else 'enterKey']()
toggle: -> (if Gallery.nodes then Gallery.cb.close else Gallery.build)()