diff --git a/CHANGELOG.md b/CHANGELOG.md index f8cbb19a8..a16cd3c36 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ Sometimes the changelog has notes (not comprehensive) acknowledging people's wor The links to individual versions below are to copies of the script with the update URL removed. If you want automatic updates, install the script from the links on the [main page](https://github.com/ccd0/4chan-x). +### v1.9.23.6 +*2015-02-04* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.9.23.6/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.9.23.6/builds/4chan-X-noupdate.crx "Chromium version")] + +- Mute videos when removing them to work around a bug where the sound kept playing for some videos. + ### v1.9.23.5 *2015-02-03* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.9.23.5/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.9.23.5/builds/4chan-X-noupdate.crx "Chromium version")] diff --git a/LICENSE b/LICENSE index 9a43f9820..02d258271 100755 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ /* -* 4chan X - Version 1.9.23.5 +* 4chan X - Version 1.9.23.6 * * Licensed under the MIT license. * https://github.com/ccd0/4chan-x/blob/master/LICENSE diff --git a/builds/4chan-X-beta.crx b/builds/4chan-X-beta.crx index 1d69d696a..43c364c2f 100644 Binary files a/builds/4chan-X-beta.crx and b/builds/4chan-X-beta.crx differ diff --git a/builds/4chan-X-beta.meta.js b/builds/4chan-X-beta.meta.js index 1c0935d64..561a56108 100644 --- a/builds/4chan-X-beta.meta.js +++ b/builds/4chan-X-beta.meta.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X beta -// @version 1.9.23.5 +// @version 1.9.23.6 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X diff --git a/builds/4chan-X-beta.user.js b/builds/4chan-X-beta.user.js index 10469f08e..56a92d271 100644 --- a/builds/4chan-X-beta.user.js +++ b/builds/4chan-X-beta.user.js @@ -1,7 +1,7 @@ // Generated by CoffeeScript // ==UserScript== // @name 4chan X beta -// @version 1.9.23.5 +// @version 1.9.23.6 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -25,7 +25,7 @@ // ==/UserScript== /* -* 4chan X - Version 1.9.23.5 +* 4chan X - Version 1.9.23.6 * * Licensed under the MIT license. * https://github.com/ccd0/4chan-x/blob/master/LICENSE @@ -402,7 +402,7 @@ doc = d.documentElement; g = { - VERSION: '1.9.23.5', + VERSION: '1.9.23.6', NAMESPACE: '4chan X.', NAME: '4chan X', FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions', @@ -9066,7 +9066,7 @@ return $.add(Gallery.nodes.thumbs, thumb); }, open: function(thumb) { - var el, elType, file, name, newID, nodes, oldID, post, slideshow, _base, _ref; + var el, elType, file, name, newID, nodes, oldID, post, slideshow, _ref; nodes = Gallery.nodes; name = nodes.name; oldID = +nodes.current.dataset.id; @@ -9081,18 +9081,11 @@ file = $.el(elType, { title: name.download = name.textContent = thumb.title }); - $.on(file, 'error', (function(_this) { - return function() { - return Gallery.error(file, thumb); - }; - })(this)); - file.src = name.href = thumb.href; $.extend(file.dataset, thumb.dataset); - if (!nodes.current.error) { - if (typeof (_base = nodes.current).pause === "function") { - _base.pause(); - } - } + $.on(file, 'error', Gallery.error); + file.src = name.href = thumb.href; + $.off(nodes.current, 'error', Gallery.error); + ImageCommon.pause(nodes.current); $.replace(nodes.current, file); if (elType === 'video') { file.loop = true; @@ -9118,23 +9111,25 @@ } return nodes.thumbs.scrollTop = thumb.offsetTop + thumb.offsetHeight / 2 - nodes.thumbs.clientHeight / 2; }, - error: function(file, thumb) { + error: function() { var _ref; - if (((_ref = file.error) != null ? _ref.code : void 0) === MediaError.MEDIA_ERR_DECODE) { + if (((_ref = this.error) != null ? _ref.code : void 0) === MediaError.MEDIA_ERR_DECODE) { return new Notice('error', 'Corrupt or unplayable video', 30); } - if (file.src.split('/')[2] !== 'i.4cdn.org') { + if (this.src.split('/')[2] !== 'i.4cdn.org') { return; } - return ImageCommon.error(file, g.posts[file.dataset.post], null, function(URL) { - if (!URL) { - return; - } - thumb.href = URL; - if (Gallery.nodes.current === file) { - return file.src = URL; - } - }); + return ImageCommon.error(this, g.posts[this.dataset.post], null, (function(_this) { + return function(url) { + if (!url) { + return; + } + Gallery.images[_this.dataset.id].href = url; + if (Gallery.nodes.current === _this) { + return _this.src = url; + } + }; + })(this)); }, cleanupTimer: function() { var current; @@ -9272,10 +9267,8 @@ return Gallery.slideshow = false; }, close: function() { - var _base; - if (typeof (_base = Gallery.nodes.current).pause === "function") { - _base.pause(); - } + $.off(Gallery.nodes.current, 'error', Gallery.error); + ImageCommon.pause(Gallery.nodes.current); $.rm(Gallery.nodes.el); $.rmClass(doc, 'gallery-open'); if (Conf['Fullscreen Gallery']) { @@ -9360,6 +9353,14 @@ }; ImageCommon = { + pause: function(video) { + if (video.nodeName !== 'VIDEO') { + return; + } + video.pause(); + $.off(video, 'volumechange', Volume.change); + return video.muted = true; + }, rewind: function(el) { if (el.nodeName === 'VIDEO') { if (el.readyState >= el.HAVE_METADATA) { @@ -9671,7 +9672,7 @@ $.off(el, 'error', ImageExpand.error); ImageCommon.pushCache(el); if (file.isVideo) { - el.pause(); + ImageCommon.pause(el); _ref1 = ImageExpand.videoCB; for (eventName in _ref1) { cb = _ref1[eventName]; @@ -9694,7 +9695,7 @@ }); }, expand: function(post, src) { - var el, file, isNew, isVideo, thumb, _ref; + var el, file, isVideo, thumb, _ref; file = post.file; thumb = file.thumb, isVideo = file.isVideo; if (post.isHidden || file.isExpanding || file.isExpanded) { @@ -9712,7 +9713,6 @@ } el.removeAttribute('id'); } else { - isNew = true; el = file.fullImage = $.el((isVideo ? 'video' : 'img')); el.dataset.fullID = post.fullID; $.on(el, 'error', ImageExpand.error); @@ -9728,7 +9728,7 @@ thumb.parentNode.removeAttribute('href'); thumb.parentNode.removeAttribute('target'); el.loop = true; - Volume.setup(el, isNew); + Volume.setup(el); ImageExpand.setupVideoCB(post); } if (!isVideo) { @@ -9934,7 +9934,7 @@ }, mouseover: function(post) { return function(e) { - var el, error, file, height, isNew, isVideo, left, maxHeight, maxWidth, padding, right, scale, width, x, _ref, _ref1, _ref2; + var el, error, file, height, isVideo, left, maxHeight, maxWidth, padding, right, scale, width, x, _ref, _ref1, _ref2; if (!doc.contains(this)) { return; } @@ -9948,7 +9948,6 @@ el = ImageCommon.popCache(); $.on(el, 'error', error); } else { - isNew = true; el = $.el((isVideo ? 'video' : 'img')); el.dataset.fullID = post.fullID; $.on(el, 'error', error); @@ -9963,7 +9962,7 @@ if (isVideo) { el.loop = true; el.controls = false; - Volume.setup(el, isNew); + Volume.setup(el); if (Conf['Autoplay']) { el.play(); } @@ -9998,9 +9997,7 @@ cb: function() { $.off(el, 'error', error); ImageCommon.pushCache(el); - if (isVideo) { - el.pause(); - } + ImageCommon.pause(el); $.rm(el); return el.removeAttribute('style'); } @@ -10440,15 +10437,10 @@ order: 201 }); }, - setup: function(video, isNew) { - if (isNew == null) { - isNew = true; - } + setup: function(video) { video.muted = !Conf['Allow Sound']; video.volume = Conf['Default Volume']; - if (isNew) { - return $.on(video, 'volumechange', Volume.change); - } + return $.on(video, 'volumechange', Volume.change); }, change: function() { var items, muted, volume; diff --git a/builds/4chan-X-noupdate.crx b/builds/4chan-X-noupdate.crx index e362c14aa..cfb1dcd48 100644 Binary files a/builds/4chan-X-noupdate.crx and b/builds/4chan-X-noupdate.crx differ diff --git a/builds/4chan-X-noupdate.user.js b/builds/4chan-X-noupdate.user.js index 9672b1feb..99ae9f75e 100644 --- a/builds/4chan-X-noupdate.user.js +++ b/builds/4chan-X-noupdate.user.js @@ -1,7 +1,7 @@ // Generated by CoffeeScript // ==UserScript== // @name 4chan X -// @version 1.9.23.5 +// @version 1.9.23.6 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -24,7 +24,7 @@ // ==/UserScript== /* -* 4chan X - Version 1.9.23.5 +* 4chan X - Version 1.9.23.6 * * Licensed under the MIT license. * https://github.com/ccd0/4chan-x/blob/master/LICENSE @@ -401,7 +401,7 @@ doc = d.documentElement; g = { - VERSION: '1.9.23.5', + VERSION: '1.9.23.6', NAMESPACE: '4chan X.', NAME: '4chan X', FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions', @@ -9065,7 +9065,7 @@ return $.add(Gallery.nodes.thumbs, thumb); }, open: function(thumb) { - var el, elType, file, name, newID, nodes, oldID, post, slideshow, _base, _ref; + var el, elType, file, name, newID, nodes, oldID, post, slideshow, _ref; nodes = Gallery.nodes; name = nodes.name; oldID = +nodes.current.dataset.id; @@ -9080,18 +9080,11 @@ file = $.el(elType, { title: name.download = name.textContent = thumb.title }); - $.on(file, 'error', (function(_this) { - return function() { - return Gallery.error(file, thumb); - }; - })(this)); - file.src = name.href = thumb.href; $.extend(file.dataset, thumb.dataset); - if (!nodes.current.error) { - if (typeof (_base = nodes.current).pause === "function") { - _base.pause(); - } - } + $.on(file, 'error', Gallery.error); + file.src = name.href = thumb.href; + $.off(nodes.current, 'error', Gallery.error); + ImageCommon.pause(nodes.current); $.replace(nodes.current, file); if (elType === 'video') { file.loop = true; @@ -9117,23 +9110,25 @@ } return nodes.thumbs.scrollTop = thumb.offsetTop + thumb.offsetHeight / 2 - nodes.thumbs.clientHeight / 2; }, - error: function(file, thumb) { + error: function() { var _ref; - if (((_ref = file.error) != null ? _ref.code : void 0) === MediaError.MEDIA_ERR_DECODE) { + if (((_ref = this.error) != null ? _ref.code : void 0) === MediaError.MEDIA_ERR_DECODE) { return new Notice('error', 'Corrupt or unplayable video', 30); } - if (file.src.split('/')[2] !== 'i.4cdn.org') { + if (this.src.split('/')[2] !== 'i.4cdn.org') { return; } - return ImageCommon.error(file, g.posts[file.dataset.post], null, function(URL) { - if (!URL) { - return; - } - thumb.href = URL; - if (Gallery.nodes.current === file) { - return file.src = URL; - } - }); + return ImageCommon.error(this, g.posts[this.dataset.post], null, (function(_this) { + return function(url) { + if (!url) { + return; + } + Gallery.images[_this.dataset.id].href = url; + if (Gallery.nodes.current === _this) { + return _this.src = url; + } + }; + })(this)); }, cleanupTimer: function() { var current; @@ -9271,10 +9266,8 @@ return Gallery.slideshow = false; }, close: function() { - var _base; - if (typeof (_base = Gallery.nodes.current).pause === "function") { - _base.pause(); - } + $.off(Gallery.nodes.current, 'error', Gallery.error); + ImageCommon.pause(Gallery.nodes.current); $.rm(Gallery.nodes.el); $.rmClass(doc, 'gallery-open'); if (Conf['Fullscreen Gallery']) { @@ -9359,6 +9352,14 @@ }; ImageCommon = { + pause: function(video) { + if (video.nodeName !== 'VIDEO') { + return; + } + video.pause(); + $.off(video, 'volumechange', Volume.change); + return video.muted = true; + }, rewind: function(el) { if (el.nodeName === 'VIDEO') { if (el.readyState >= el.HAVE_METADATA) { @@ -9670,7 +9671,7 @@ $.off(el, 'error', ImageExpand.error); ImageCommon.pushCache(el); if (file.isVideo) { - el.pause(); + ImageCommon.pause(el); _ref1 = ImageExpand.videoCB; for (eventName in _ref1) { cb = _ref1[eventName]; @@ -9693,7 +9694,7 @@ }); }, expand: function(post, src) { - var el, file, isNew, isVideo, thumb, _ref; + var el, file, isVideo, thumb, _ref; file = post.file; thumb = file.thumb, isVideo = file.isVideo; if (post.isHidden || file.isExpanding || file.isExpanded) { @@ -9711,7 +9712,6 @@ } el.removeAttribute('id'); } else { - isNew = true; el = file.fullImage = $.el((isVideo ? 'video' : 'img')); el.dataset.fullID = post.fullID; $.on(el, 'error', ImageExpand.error); @@ -9727,7 +9727,7 @@ thumb.parentNode.removeAttribute('href'); thumb.parentNode.removeAttribute('target'); el.loop = true; - Volume.setup(el, isNew); + Volume.setup(el); ImageExpand.setupVideoCB(post); } if (!isVideo) { @@ -9933,7 +9933,7 @@ }, mouseover: function(post) { return function(e) { - var el, error, file, height, isNew, isVideo, left, maxHeight, maxWidth, padding, right, scale, width, x, _ref, _ref1, _ref2; + var el, error, file, height, isVideo, left, maxHeight, maxWidth, padding, right, scale, width, x, _ref, _ref1, _ref2; if (!doc.contains(this)) { return; } @@ -9947,7 +9947,6 @@ el = ImageCommon.popCache(); $.on(el, 'error', error); } else { - isNew = true; el = $.el((isVideo ? 'video' : 'img')); el.dataset.fullID = post.fullID; $.on(el, 'error', error); @@ -9962,7 +9961,7 @@ if (isVideo) { el.loop = true; el.controls = false; - Volume.setup(el, isNew); + Volume.setup(el); if (Conf['Autoplay']) { el.play(); } @@ -9997,9 +9996,7 @@ cb: function() { $.off(el, 'error', error); ImageCommon.pushCache(el); - if (isVideo) { - el.pause(); - } + ImageCommon.pause(el); $.rm(el); return el.removeAttribute('style'); } @@ -10439,15 +10436,10 @@ order: 201 }); }, - setup: function(video, isNew) { - if (isNew == null) { - isNew = true; - } + setup: function(video) { video.muted = !Conf['Allow Sound']; video.volume = Conf['Default Volume']; - if (isNew) { - return $.on(video, 'volumechange', Volume.change); - } + return $.on(video, 'volumechange', Volume.change); }, change: function() { var items, muted, volume; diff --git a/builds/4chan-X.crx b/builds/4chan-X.crx index 7d1275e7f..1c44bd6b8 100644 Binary files a/builds/4chan-X.crx and b/builds/4chan-X.crx differ diff --git a/builds/4chan-X.meta.js b/builds/4chan-X.meta.js index 6d62b83b6..e3fbb8023 100644 --- a/builds/4chan-X.meta.js +++ b/builds/4chan-X.meta.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X -// @version 1.9.23.5 +// @version 1.9.23.6 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 2dba7d5b4..f15307ec8 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -1,7 +1,7 @@ // Generated by CoffeeScript // ==UserScript== // @name 4chan X -// @version 1.9.23.5 +// @version 1.9.23.6 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -25,7 +25,7 @@ // ==/UserScript== /* -* 4chan X - Version 1.9.23.5 +* 4chan X - Version 1.9.23.6 * * Licensed under the MIT license. * https://github.com/ccd0/4chan-x/blob/master/LICENSE @@ -402,7 +402,7 @@ doc = d.documentElement; g = { - VERSION: '1.9.23.5', + VERSION: '1.9.23.6', NAMESPACE: '4chan X.', NAME: '4chan X', FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions', @@ -9066,7 +9066,7 @@ return $.add(Gallery.nodes.thumbs, thumb); }, open: function(thumb) { - var el, elType, file, name, newID, nodes, oldID, post, slideshow, _base, _ref; + var el, elType, file, name, newID, nodes, oldID, post, slideshow, _ref; nodes = Gallery.nodes; name = nodes.name; oldID = +nodes.current.dataset.id; @@ -9081,18 +9081,11 @@ file = $.el(elType, { title: name.download = name.textContent = thumb.title }); - $.on(file, 'error', (function(_this) { - return function() { - return Gallery.error(file, thumb); - }; - })(this)); - file.src = name.href = thumb.href; $.extend(file.dataset, thumb.dataset); - if (!nodes.current.error) { - if (typeof (_base = nodes.current).pause === "function") { - _base.pause(); - } - } + $.on(file, 'error', Gallery.error); + file.src = name.href = thumb.href; + $.off(nodes.current, 'error', Gallery.error); + ImageCommon.pause(nodes.current); $.replace(nodes.current, file); if (elType === 'video') { file.loop = true; @@ -9118,23 +9111,25 @@ } return nodes.thumbs.scrollTop = thumb.offsetTop + thumb.offsetHeight / 2 - nodes.thumbs.clientHeight / 2; }, - error: function(file, thumb) { + error: function() { var _ref; - if (((_ref = file.error) != null ? _ref.code : void 0) === MediaError.MEDIA_ERR_DECODE) { + if (((_ref = this.error) != null ? _ref.code : void 0) === MediaError.MEDIA_ERR_DECODE) { return new Notice('error', 'Corrupt or unplayable video', 30); } - if (file.src.split('/')[2] !== 'i.4cdn.org') { + if (this.src.split('/')[2] !== 'i.4cdn.org') { return; } - return ImageCommon.error(file, g.posts[file.dataset.post], null, function(URL) { - if (!URL) { - return; - } - thumb.href = URL; - if (Gallery.nodes.current === file) { - return file.src = URL; - } - }); + return ImageCommon.error(this, g.posts[this.dataset.post], null, (function(_this) { + return function(url) { + if (!url) { + return; + } + Gallery.images[_this.dataset.id].href = url; + if (Gallery.nodes.current === _this) { + return _this.src = url; + } + }; + })(this)); }, cleanupTimer: function() { var current; @@ -9272,10 +9267,8 @@ return Gallery.slideshow = false; }, close: function() { - var _base; - if (typeof (_base = Gallery.nodes.current).pause === "function") { - _base.pause(); - } + $.off(Gallery.nodes.current, 'error', Gallery.error); + ImageCommon.pause(Gallery.nodes.current); $.rm(Gallery.nodes.el); $.rmClass(doc, 'gallery-open'); if (Conf['Fullscreen Gallery']) { @@ -9360,6 +9353,14 @@ }; ImageCommon = { + pause: function(video) { + if (video.nodeName !== 'VIDEO') { + return; + } + video.pause(); + $.off(video, 'volumechange', Volume.change); + return video.muted = true; + }, rewind: function(el) { if (el.nodeName === 'VIDEO') { if (el.readyState >= el.HAVE_METADATA) { @@ -9671,7 +9672,7 @@ $.off(el, 'error', ImageExpand.error); ImageCommon.pushCache(el); if (file.isVideo) { - el.pause(); + ImageCommon.pause(el); _ref1 = ImageExpand.videoCB; for (eventName in _ref1) { cb = _ref1[eventName]; @@ -9694,7 +9695,7 @@ }); }, expand: function(post, src) { - var el, file, isNew, isVideo, thumb, _ref; + var el, file, isVideo, thumb, _ref; file = post.file; thumb = file.thumb, isVideo = file.isVideo; if (post.isHidden || file.isExpanding || file.isExpanded) { @@ -9712,7 +9713,6 @@ } el.removeAttribute('id'); } else { - isNew = true; el = file.fullImage = $.el((isVideo ? 'video' : 'img')); el.dataset.fullID = post.fullID; $.on(el, 'error', ImageExpand.error); @@ -9728,7 +9728,7 @@ thumb.parentNode.removeAttribute('href'); thumb.parentNode.removeAttribute('target'); el.loop = true; - Volume.setup(el, isNew); + Volume.setup(el); ImageExpand.setupVideoCB(post); } if (!isVideo) { @@ -9934,7 +9934,7 @@ }, mouseover: function(post) { return function(e) { - var el, error, file, height, isNew, isVideo, left, maxHeight, maxWidth, padding, right, scale, width, x, _ref, _ref1, _ref2; + var el, error, file, height, isVideo, left, maxHeight, maxWidth, padding, right, scale, width, x, _ref, _ref1, _ref2; if (!doc.contains(this)) { return; } @@ -9948,7 +9948,6 @@ el = ImageCommon.popCache(); $.on(el, 'error', error); } else { - isNew = true; el = $.el((isVideo ? 'video' : 'img')); el.dataset.fullID = post.fullID; $.on(el, 'error', error); @@ -9963,7 +9962,7 @@ if (isVideo) { el.loop = true; el.controls = false; - Volume.setup(el, isNew); + Volume.setup(el); if (Conf['Autoplay']) { el.play(); } @@ -9998,9 +9997,7 @@ cb: function() { $.off(el, 'error', error); ImageCommon.pushCache(el); - if (isVideo) { - el.pause(); - } + ImageCommon.pause(el); $.rm(el); return el.removeAttribute('style'); } @@ -10440,15 +10437,10 @@ order: 201 }); }, - setup: function(video, isNew) { - if (isNew == null) { - isNew = true; - } + setup: function(video) { video.muted = !Conf['Allow Sound']; video.volume = Conf['Default Volume']; - if (isNew) { - return $.on(video, 'volumechange', Volume.change); - } + return $.on(video, 'volumechange', Volume.change); }, change: function() { var items, muted, volume; diff --git a/builds/4chan-X.zip b/builds/4chan-X.zip index 28d71829c..27b4712b8 100644 Binary files a/builds/4chan-X.zip and b/builds/4chan-X.zip differ diff --git a/builds/updates-beta.xml b/builds/updates-beta.xml index b3d8ece1c..b459128a0 100644 --- a/builds/updates-beta.xml +++ b/builds/updates-beta.xml @@ -1,7 +1,7 @@ - + diff --git a/builds/updates.xml b/builds/updates.xml index 471c4996d..ae7678f22 100644 --- a/builds/updates.xml +++ b/builds/updates.xml @@ -1,7 +1,7 @@ - + diff --git a/package.json b/package.json index a383635f3..6d6d6a7fa 100755 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "description": "Cross-browser userscript for maximum lurking on 4chan.", "meta": { "name": "4chan X", - "version": "1.9.23.5", + "version": "1.9.23.6", "repo": "https://github.com/ccd0/4chan-x/", "page": "https://github.com/ccd0/4chan-x", "downloads": "https://ccd0.github.io/4chan-x/builds/",