Implement Fullscreen Gallery option.

This commit is contained in:
ccd0 2014-11-22 18:13:55 -08:00
parent a710bdf8b4
commit e9802b3458
2 changed files with 11 additions and 1 deletions

View File

@ -165,7 +165,11 @@ Config =
] ]
'Gallery': [ 'Gallery': [
true true
'Adds a simple and cute image gallery.' 'Adds a simple and cute image gallery.'
]
'Fullscreen Gallery': [
true
'Open gallery in fullscreen mode.'
] ]
'PDF in Gallery': [ 'PDF in Gallery': [
false false

View File

@ -78,6 +78,9 @@ Gallery =
candidate = post.file.thumb.parentNode candidate = post.file.thumb.parentNode
if Header.getTopOf(candidate) + candidate.getBoundingClientRect().height >= 0 if Header.getTopOf(candidate) + candidate.getBoundingClientRect().height >= 0
image = candidate image = candidate
if Conf['Fullscreen Gallery']
doc.mozRequestFullScreen?()
doc.webkitRequestFullScreen?(Element.ALLOW_KEYBOARD_INPUT)
$.addClass doc, 'gallery-open' $.addClass doc, 'gallery-open'
$.add d.body, dialog $.add d.body, dialog
@ -261,6 +264,9 @@ Gallery =
Gallery.nodes.current.pause?() Gallery.nodes.current.pause?()
$.rm Gallery.nodes.el $.rm Gallery.nodes.el
$.rmClass doc, 'gallery-open' $.rmClass doc, 'gallery-open'
if Conf['Fullscreen Gallery']
d.mozCancelFullScreen?()
d.webkitExitFullscreen?()
delete Gallery.nodes delete Gallery.nodes
delete Gallery.fullIDs delete Gallery.fullIDs
doc.style.overflow = '' doc.style.overflow = ''