diff --git a/src/General/css/style.css b/src/General/css/style.css index 50028a15e..e6380c526 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -1405,7 +1405,7 @@ div.boardTitle { padding-right: 7px; top: 5px; } -:root.gal-pdf .gal-buttons { +.gal-pdf .gal-buttons { top: 40px; background: rgba(0,0,0,0.6) !important; border-radius: 3px; diff --git a/src/Images/Gallery.coffee b/src/Images/Gallery.coffee index 2ac560115..b0c29cf33 100644 --- a/src/Images/Gallery.coffee +++ b/src/Images/Gallery.coffee @@ -15,7 +15,7 @@ Gallery = Post.callbacks.push name: 'Gallery' - cb: @node + cb: @node node: -> return unless @file @@ -48,11 +48,11 @@ Gallery = nodes.menu = new UI.Menu 'gallery' {cb} = Gallery - $.on nodes.frame, 'click', cb.blank - $.on nodes.next, 'click', cb.advance - $.on ($ '.gal-prev', dialog), 'click', cb.prev - $.on ($ '.gal-next', dialog), 'click', cb.next - $.on ($ '.gal-close', dialog), 'click', cb.close + $.on nodes.frame, 'click', cb.blank + $.on nodes.next, 'click', cb.advance + $.on $('.gal-prev', dialog), 'click', cb.prev + $.on $('.gal-next', dialog), 'click', cb.next + $.on $('.gal-close', dialog), 'click', cb.close $.on menuButton, 'click', (e) -> nodes.menu.toggle e, @, g @@ -67,12 +67,7 @@ Gallery = $.on d, 'keydown', cb.keybinds $.off d, 'keydown', Keybinds.keydown - - i = 0 - files = $$ '.post .file' - while file = files[i++] - continue if $ '.fileDeletedRes, .fileDeleted', file - Gallery.generateThumb file + Gallery.generateThumb file for file, i in $$ '.post .file' when !$ '.fileDeletedRes, .fileDeleted', file $.add d.body, dialog nodes.thumbs.scrollTop = 0 @@ -139,20 +134,18 @@ Gallery = elType = 'img' elType = 'video' if /\.webm$/.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'] nodes.el, 'gal-pdf' file = $.el elType, src: name.href = @href title: name.download = name.textContent = @title - if elType is 'video' - file.loop = true - file.autoplay = Conf['Autoplay'] $.extend file.dataset, @dataset nodes.current.pause?() $.replace nodes.current, file + Video.configure file if elType is 'video' nodes.count.textContent = +@dataset.id + 1 - nodes.current = file - nodes.frame.scrollTop = 0 + nodes.current = file + nodes.frame.scrollTop = 0 nodes.next.focus() # Scroll @@ -201,14 +194,16 @@ 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] - advance:-> if Gallery.nodes.current.paused then Gallery.nodes.current.play() else Gallery.cb.next() - pause: -> if Gallery.nodes.current.nodeType is 'VIDEO' - if Gallery.nodes.current.paused then Gallery.nodes.current.play() else Gallery.nodes.current.pause() - toggle: -> (if Gallery.nodes then Gallery.cb.close else Gallery.build)() + 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] + advance: -> if Gallery.nodes.current.paused then Gallery.nodes.current.play() else Gallery.cb.next() + toggle: -> (if Gallery.nodes then Gallery.cb.close else Gallery.build)() blank: (e) -> Gallery.cb.close() if e.target is @ + pause: -> + {current} = Gallery.nodes + current[if current.paused then 'play' else 'pause']() if current.nodeType is 'VIDEO' + close: -> Gallery.nodes.current.pause?() $.rm Gallery.nodes.el