From 586a048d6e189045bf4581c6e00df67f739c8c71 Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Thu, 10 Apr 2014 23:36:45 -0700 Subject: [PATCH] Enable video controls! --- Gruntfile.coffee | 3 +-- builds/4chan-X.user.js | 16 +++++++++------- builds/crx/script.js | 16 +++++++++------- src/Images/Gallery.coffee | 8 ++++++-- 4 files changed, 25 insertions(+), 18 deletions(-) diff --git a/Gruntfile.coffee b/Gruntfile.coffee index 3eba81845..2508d1ea0 100755 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -44,8 +44,7 @@ module.exports = (grunt) -> meta: files: - 'LICENSE': 'src/General/meta/banner.js', - 'latest.js': 'src/General/meta/latest.js' + 'LICENSE': 'src/General/meta/banner.js' crx: files: diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 19e09c9b0..9883832af 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -7868,13 +7868,6 @@ next: function() { return Gallery.cb.open.call(Gallery.images[+Gallery.nodes.current.dataset.id + 1]); }, - advance: function() { - if (Gallery.nodes.current.paused) { - return Gallery.nodes.current.play(); - } else { - return Gallery.cb.next(); - } - }, toggle: function() { return (Gallery.nodes ? Gallery.cb.close : Gallery.build)(); }, @@ -7883,6 +7876,15 @@ return Gallery.cb.close(); } }, + advance: function() { + if (Gallery.nodes.current.controls) { + return; + } + if (Gallery.nodes.current.paused) { + return Gallery.nodes.current.play(); + } + return Gallery.cb.next(); + }, pause: function() { var current; current = Gallery.nodes.current; diff --git a/builds/crx/script.js b/builds/crx/script.js index 802f387cf..e55c05b00 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -7907,13 +7907,6 @@ next: function() { return Gallery.cb.open.call(Gallery.images[+Gallery.nodes.current.dataset.id + 1]); }, - advance: function() { - if (Gallery.nodes.current.paused) { - return Gallery.nodes.current.play(); - } else { - return Gallery.cb.next(); - } - }, toggle: function() { return (Gallery.nodes ? Gallery.cb.close : Gallery.build)(); }, @@ -7922,6 +7915,15 @@ return Gallery.cb.close(); } }, + advance: function() { + if (Gallery.nodes.current.controls) { + return; + } + if (Gallery.nodes.current.paused) { + return Gallery.nodes.current.play(); + } + return Gallery.cb.next(); + }, pause: function() { var current; current = Gallery.nodes.current; diff --git a/src/Images/Gallery.coffee b/src/Images/Gallery.coffee index d0bdb2007..17897cb33 100644 --- a/src/Images/Gallery.coffee +++ b/src/Images/Gallery.coffee @@ -214,11 +214,15 @@ Gallery = 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: -> + advance: -> + if Gallery.nodes.current.controls then return + if Gallery.nodes.current.paused then return Gallery.nodes.current.play() + Gallery.cb.next() + + pause: -> {current} = Gallery.nodes current[if current.paused then 'play' else 'pause']() if current.nodeType is 'VIDEO'