diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b3fdffb1..bcb5f163a 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ The links to individual versions below are to copies of the script with the upda ### v1.10.1 +**v1.10.1.1** *(2015-02-15)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.10.1.1/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.10.1.1/builds/4chan-X-noupdate.crx "Chromium version")] +- Extend `Mouse Wheel Volume` to work on expanded videos (via mouse wheel over the file name) and in the gallery. + **v1.10.1.0** *(2015-02-14)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.10.1.0/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.10.1.0/builds/4chan-X-noupdate.crx "Chromium version")] - Based on v1.10.0.5. - Improve settings/data storage, expecially in Chromium, where failures in syncing data no longer result in failures in saving data. diff --git a/LICENSE b/LICENSE index eec653675..88ce46ead 100755 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ /* -* 4chan X - Version 1.10.1.0 +* 4chan X - Version 1.10.1.1 * * 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 2eb4a3ae5..79ad41cae 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 bec0a4d57..e189a3dca 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.10.1.0 +// @version 1.10.1.1 // @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 ab81beab6..ecd251480 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.10.1.0 +// @version 1.10.1.1 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -25,7 +25,7 @@ // ==/UserScript== /* -* 4chan X - Version 1.10.1.0 +* 4chan X - Version 1.10.1.1 * * Licensed under the MIT license. * https://github.com/ccd0/4chan-x/blob/master/LICENSE @@ -181,7 +181,6 @@ 'Image Expansion': [true, 'Expand images / videos.'], 'Image Hover': [true, 'Show full image / video on mouseover.'], 'Image Hover in Catalog': [false, 'Show full image / video on mouseover in 4chan X catalog.'], - 'Mouse Wheel Volume': [true, 'Adjust volume of hovering videos with mouse wheel.'], 'Gallery': [true, 'Adds a simple and cute image gallery.'], 'Fullscreen Gallery': [false, 'Open gallery in fullscreen mode.', 1], 'PDF in Gallery': [false, 'Show PDF files in gallery.', 1], @@ -200,6 +199,7 @@ 'Show Controls': [true, 'Show controls on videos expanded inline.'], 'Click Passthrough': [false, 'Clicks on videos trigger your browser\'s default behavior. Videos can be contracted with button / dragging to the left.', 1], 'Allow Sound': [true, 'Open videos with the sound unmuted.'], + 'Mouse Wheel Volume': [true, 'Adjust volume of videos with the mouse wheel over the thumbnail/filename/gallery.'], 'Loop in New Tab': [true, 'Loop videos opened in their own tabs.'], 'Volume in New Tab': [true, 'Apply 4chan X mute and volume settings to videos opened in their own tabs.'] }, @@ -405,7 +405,7 @@ doc = d.documentElement; g = { - VERSION: '1.10.1.0', + VERSION: '1.10.1.1', NAMESPACE: '4chan X.', NAME: '4chan X', FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions', @@ -1211,18 +1211,12 @@ return this.ID; }; - function Post(root, thread, board, that) { + function Post(root, thread, board) { var capcode, clone, date, email, flag, info, name, post, subject, tripcode, uniqueID, _i, _len, _ref; this.thread = thread; this.board = board; - if (that == null) { - that = {}; - } this.ID = +root.id.slice(2); this.fullID = "" + this.board + "." + this.ID; - if (that.isOriginalMarkup) { - this.cleanup(root); - } post = $('.post', root); info = $('.postInfo', post); this.nodes = { @@ -1281,7 +1275,7 @@ } this.parseComment(); this.parseQuotes(); - this.parseFile(that); + this.parseFile(); this.isDead = false; this.isHidden = false; this.clones = []; @@ -1295,9 +1289,6 @@ } } g.posts.push(this.fullID, thread.posts.push(this, board.posts.push(this, this))); - if (that.isArchived) { - this.kill(); - } } Post.prototype.parseComment = function() { @@ -1361,7 +1352,7 @@ } }; - Post.prototype.parseFile = function(that) { + Post.prototype.parseFile = function() { var anchor, fileEl, fileText, nameNode, size, thumb, unit; if (!((fileEl = $('.file', this.nodes.post)) && (thumb = $('img[data-md5]', fileEl)))) { return; @@ -1392,20 +1383,6 @@ return this.file.name = fileText.title || nameNode.title || nameNode.textContent; }; - Post.prototype.cleanup = function(root) { - var node, _i, _j, _len, _len1, _ref, _ref1; - _ref = $$('.mobile', root); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - node = _ref[_i]; - $.rm(node); - } - _ref1 = $$('.desktop', root); - for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { - node = _ref1[_j]; - $.rmClass(node, 'desktop'); - } - }; - Post.prototype.kill = function(file) { var clone, quotelink, strong, _i, _j, _len, _len1, _ref, _ref1; if (file) { @@ -2291,9 +2268,8 @@ } board = g.boards[this.boardID] || new Board(this.boardID); thread = g.threads["" + this.boardID + "." + this.threadID] || new Thread(this.threadID, board); - post = new Post(Build.post(o), thread, board, { - isArchived: true - }); + post = new Post(Build.post(o), thread, board); + post.kill(); if (post.file) { post.file.thumbURL = o.file.turl; } @@ -2806,7 +2782,7 @@ return $.rmClass(Header.bar, 'autohide'); } }, - toggleHideBarOnScroll: function(e) { + toggleHideBarOnScroll: function() { var hide; hide = this.checked; $.cb.checked.call(this); @@ -6941,7 +6917,7 @@ } }); }, - scrollLock: function(e) { + scrollLock: function() { if (d.activeElement && QR.nodes.el.contains(d.activeElement) && d.activeElement.nodeName === 'IFRAME') { return window.scroll(window.scrollX, QR.scrollY); } else { @@ -8595,11 +8571,9 @@ return _this.rm(); }; })(this)); - $.on(this.nodes.label, 'click', (function(_this) { - return function(e) { - return e.stopPropagation(); - }; - })(this)); + $.on(this.nodes.label, 'click', function(e) { + return e.stopPropagation(); + }); $.on(this.nodes.spoiler, 'change', (function(_this) { return function(e) { _this.spoiler = e.target.checked; @@ -9067,6 +9041,9 @@ nodes.menu = new UI.Menu('gallery'); cb = Gallery.cb; $.on(nodes.frame, 'click', cb.blank); + if (Conf['Mouse Wheel Volume']) { + $.on(nodes.frame, 'wheel', Volume.wheel); + } $.on(nodes.next, 'click', cb.click); $.on(nodes.name, 'click', ImageCommon.download); $.on($('.gal-prev', dialog), 'click', cb.prev); @@ -9667,7 +9644,7 @@ } }); }, - playVideos: function(e) { + playVideos: function() { return g.posts.forEach(function(post) { var file, video, visible, _i, _len, _ref; _ref = [post].concat(__slice.call(post.clones)); @@ -9994,10 +9971,7 @@ if (!(this.file && (this.file.isImage || this.file.isVideo))) { return; } - $.on(this.file.thumb, 'mouseover', ImageHover.mouseover(this)); - if (Conf['Mouse Wheel Volume'] && this.file.isVideo) { - return $.on(this.file.thumb, 'wheel', ImageHover.wheel); - } + return $.on(this.file.thumb, 'mouseover', ImageHover.mouseover(this)); }, catalogNode: function() { var file; @@ -10005,10 +9979,7 @@ if (!(file && (file.isImage || file.isVideo))) { return; } - $.on(this.nodes.thumb, 'mouseover', ImageHover.mouseover(this.thread.OP)); - if (Conf['Mouse Wheel Volume'] && this.thread.OP.file.isVideo) { - return $.on(this.nodes.thumb, 'wheel', ImageHover.wheel); - } + return $.on(this.nodes.thumb, 'mouseover', ImageHover.mouseover(this.thread.OP)); }, mouseover: function(post) { return function(e) { @@ -10097,24 +10068,6 @@ }; })(this)); }; - }, - wheel: function(e) { - var el, volume; - if (!(el = $.id('ihover'))) { - return; - } - if (el.muted || !$.hasAudio(el)) { - return; - } - volume = el.volume + 0.1; - if (e.deltaY < 0) { - volume *= 1.1; - } - if (e.deltaY > 0) { - volume /= 1.1; - } - el.volume = $.minmax(volume - 0.1, 0, 1); - return e.preventDefault(); } }; @@ -10510,10 +10463,20 @@ el: unmuteEntry, order: 200 }); - return Header.menu.addEntry({ + Header.menu.addEntry({ el: volumeEntry, order: 201 }); + if (Conf['Mouse Wheel Volume']) { + Post.callbacks.push({ + name: 'Mouse Wheel Volume', + cb: this.node + }); + return CatalogThread.callbacks.push({ + name: 'Mouse Wheel Volume', + cb: this.catalogNode + }); + } }, setup: function(video) { video.muted = !Conf['Allow Sound']; @@ -10533,6 +10496,40 @@ Volume.inputs.unmute.checked = !muted; return Volume.inputs.volume.value = volume; } + }, + node: function() { + var _ref; + if (!((_ref = this.file) != null ? _ref.isVideo : void 0)) { + return; + } + $.on(this.file.thumb, 'wheel', Volume.wheel.bind(Header.hover)); + return $.on($('a', this.file.text), 'wheel', Volume.wheel.bind(this.file.thumb.parentNode)); + }, + catalogNode: function() { + var file; + file = this.thread.OP.file; + if (!(file != null ? file.isVideo : void 0)) { + return; + } + return $.on(this.nodes.thumb, 'wheel', Volume.wheel.bind(Header.hover)); + }, + wheel: function(e) { + var el, volume; + if (!(el = $('video:not([data-md5])', this))) { + return; + } + if (el.muted || !$.hasAudio(el)) { + return; + } + volume = el.volume + 0.1; + if (e.deltaY < 0) { + volume *= 1.1; + } + if (e.deltaY > 0) { + volume /= 1.1; + } + el.volume = $.minmax(volume - 0.1, 0, 1); + return e.preventDefault(); } }; @@ -11811,11 +11808,9 @@ innerHTML: "
" + statsHTML.innerHTML + "
" }); $.addClass(doc, 'float'); - $.ready((function(_this) { - return function() { - return $.add(d.body, sc); - }; - })(this)); + $.ready(function() { + return $.add(d.body, sc); + }); } this.postCountEl = $('#post-count', sc); this.fileCountEl = $('#file-count', sc); @@ -12061,7 +12056,7 @@ return !d.hidden; }; }, - autoUpdate: function(e) { + autoUpdate: function() { return ThreadUpdater.count(ThreadUpdater.isUpdating = this.checked); }, interval: function(e) { @@ -12075,7 +12070,7 @@ return $.cb.value.call(this); } }, - load: function(e) { + load: function() { var req; req = ThreadUpdater.req; switch (req.status) { @@ -13499,7 +13494,7 @@ }); return $.sync('hiddenPSA', PSAHiding.sync); }, - toggle: function(e) { + toggle: function() { var UTC; if ($.hasClass(this, 'hide-announcement')) { UTC = +$.id('globalMessage').dataset.utc; @@ -14068,10 +14063,10 @@ if (thread.ID in ExpandThread.statuses) { return ExpandThread.contract(thread, a, threadRoot); } else { - return ExpandThread.expand(thread, a, threadRoot); + return ExpandThread.expand(thread, a); } }, - expand: function(thread, a, threadRoot) { + expand: function(thread, a) { var status; ExpandThread.statuses[thread] = status = {}; a.textContent = ExpandThread.text.apply(ExpandThread, ['...'].concat(__slice.call(a.textContent.match(/\d+/g)))); @@ -15116,7 +15111,7 @@ }); } }, - node: function(post) { + node: function() { return RemoveSpoilers.unspoiler(this.nodes.comment); }, unspoiler: function(el) { diff --git a/builds/4chan-X-noupdate.crx b/builds/4chan-X-noupdate.crx index 8434f6a68..67ac6564c 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 fc0e733ee..55a6e7983 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.10.1.0 +// @version 1.10.1.1 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -24,7 +24,7 @@ // ==/UserScript== /* -* 4chan X - Version 1.10.1.0 +* 4chan X - Version 1.10.1.1 * * Licensed under the MIT license. * https://github.com/ccd0/4chan-x/blob/master/LICENSE @@ -180,7 +180,6 @@ 'Image Expansion': [true, 'Expand images / videos.'], 'Image Hover': [true, 'Show full image / video on mouseover.'], 'Image Hover in Catalog': [false, 'Show full image / video on mouseover in 4chan X catalog.'], - 'Mouse Wheel Volume': [true, 'Adjust volume of hovering videos with mouse wheel.'], 'Gallery': [true, 'Adds a simple and cute image gallery.'], 'Fullscreen Gallery': [false, 'Open gallery in fullscreen mode.', 1], 'PDF in Gallery': [false, 'Show PDF files in gallery.', 1], @@ -199,6 +198,7 @@ 'Show Controls': [true, 'Show controls on videos expanded inline.'], 'Click Passthrough': [false, 'Clicks on videos trigger your browser\'s default behavior. Videos can be contracted with button / dragging to the left.', 1], 'Allow Sound': [true, 'Open videos with the sound unmuted.'], + 'Mouse Wheel Volume': [true, 'Adjust volume of videos with the mouse wheel over the thumbnail/filename/gallery.'], 'Loop in New Tab': [true, 'Loop videos opened in their own tabs.'], 'Volume in New Tab': [true, 'Apply 4chan X mute and volume settings to videos opened in their own tabs.'] }, @@ -404,7 +404,7 @@ doc = d.documentElement; g = { - VERSION: '1.10.1.0', + VERSION: '1.10.1.1', NAMESPACE: '4chan X.', NAME: '4chan X', FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions', @@ -1210,18 +1210,12 @@ return this.ID; }; - function Post(root, thread, board, that) { + function Post(root, thread, board) { var capcode, clone, date, email, flag, info, name, post, subject, tripcode, uniqueID, _i, _len, _ref; this.thread = thread; this.board = board; - if (that == null) { - that = {}; - } this.ID = +root.id.slice(2); this.fullID = "" + this.board + "." + this.ID; - if (that.isOriginalMarkup) { - this.cleanup(root); - } post = $('.post', root); info = $('.postInfo', post); this.nodes = { @@ -1280,7 +1274,7 @@ } this.parseComment(); this.parseQuotes(); - this.parseFile(that); + this.parseFile(); this.isDead = false; this.isHidden = false; this.clones = []; @@ -1294,9 +1288,6 @@ } } g.posts.push(this.fullID, thread.posts.push(this, board.posts.push(this, this))); - if (that.isArchived) { - this.kill(); - } } Post.prototype.parseComment = function() { @@ -1360,7 +1351,7 @@ } }; - Post.prototype.parseFile = function(that) { + Post.prototype.parseFile = function() { var anchor, fileEl, fileText, nameNode, size, thumb, unit; if (!((fileEl = $('.file', this.nodes.post)) && (thumb = $('img[data-md5]', fileEl)))) { return; @@ -1391,20 +1382,6 @@ return this.file.name = fileText.title || nameNode.title || nameNode.textContent; }; - Post.prototype.cleanup = function(root) { - var node, _i, _j, _len, _len1, _ref, _ref1; - _ref = $$('.mobile', root); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - node = _ref[_i]; - $.rm(node); - } - _ref1 = $$('.desktop', root); - for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { - node = _ref1[_j]; - $.rmClass(node, 'desktop'); - } - }; - Post.prototype.kill = function(file) { var clone, quotelink, strong, _i, _j, _len, _len1, _ref, _ref1; if (file) { @@ -2290,9 +2267,8 @@ } board = g.boards[this.boardID] || new Board(this.boardID); thread = g.threads["" + this.boardID + "." + this.threadID] || new Thread(this.threadID, board); - post = new Post(Build.post(o), thread, board, { - isArchived: true - }); + post = new Post(Build.post(o), thread, board); + post.kill(); if (post.file) { post.file.thumbURL = o.file.turl; } @@ -2805,7 +2781,7 @@ return $.rmClass(Header.bar, 'autohide'); } }, - toggleHideBarOnScroll: function(e) { + toggleHideBarOnScroll: function() { var hide; hide = this.checked; $.cb.checked.call(this); @@ -6940,7 +6916,7 @@ } }); }, - scrollLock: function(e) { + scrollLock: function() { if (d.activeElement && QR.nodes.el.contains(d.activeElement) && d.activeElement.nodeName === 'IFRAME') { return window.scroll(window.scrollX, QR.scrollY); } else { @@ -8594,11 +8570,9 @@ return _this.rm(); }; })(this)); - $.on(this.nodes.label, 'click', (function(_this) { - return function(e) { - return e.stopPropagation(); - }; - })(this)); + $.on(this.nodes.label, 'click', function(e) { + return e.stopPropagation(); + }); $.on(this.nodes.spoiler, 'change', (function(_this) { return function(e) { _this.spoiler = e.target.checked; @@ -9066,6 +9040,9 @@ nodes.menu = new UI.Menu('gallery'); cb = Gallery.cb; $.on(nodes.frame, 'click', cb.blank); + if (Conf['Mouse Wheel Volume']) { + $.on(nodes.frame, 'wheel', Volume.wheel); + } $.on(nodes.next, 'click', cb.click); $.on(nodes.name, 'click', ImageCommon.download); $.on($('.gal-prev', dialog), 'click', cb.prev); @@ -9666,7 +9643,7 @@ } }); }, - playVideos: function(e) { + playVideos: function() { return g.posts.forEach(function(post) { var file, video, visible, _i, _len, _ref; _ref = [post].concat(__slice.call(post.clones)); @@ -9993,10 +9970,7 @@ if (!(this.file && (this.file.isImage || this.file.isVideo))) { return; } - $.on(this.file.thumb, 'mouseover', ImageHover.mouseover(this)); - if (Conf['Mouse Wheel Volume'] && this.file.isVideo) { - return $.on(this.file.thumb, 'wheel', ImageHover.wheel); - } + return $.on(this.file.thumb, 'mouseover', ImageHover.mouseover(this)); }, catalogNode: function() { var file; @@ -10004,10 +9978,7 @@ if (!(file && (file.isImage || file.isVideo))) { return; } - $.on(this.nodes.thumb, 'mouseover', ImageHover.mouseover(this.thread.OP)); - if (Conf['Mouse Wheel Volume'] && this.thread.OP.file.isVideo) { - return $.on(this.nodes.thumb, 'wheel', ImageHover.wheel); - } + return $.on(this.nodes.thumb, 'mouseover', ImageHover.mouseover(this.thread.OP)); }, mouseover: function(post) { return function(e) { @@ -10096,24 +10067,6 @@ }; })(this)); }; - }, - wheel: function(e) { - var el, volume; - if (!(el = $.id('ihover'))) { - return; - } - if (el.muted || !$.hasAudio(el)) { - return; - } - volume = el.volume + 0.1; - if (e.deltaY < 0) { - volume *= 1.1; - } - if (e.deltaY > 0) { - volume /= 1.1; - } - el.volume = $.minmax(volume - 0.1, 0, 1); - return e.preventDefault(); } }; @@ -10509,10 +10462,20 @@ el: unmuteEntry, order: 200 }); - return Header.menu.addEntry({ + Header.menu.addEntry({ el: volumeEntry, order: 201 }); + if (Conf['Mouse Wheel Volume']) { + Post.callbacks.push({ + name: 'Mouse Wheel Volume', + cb: this.node + }); + return CatalogThread.callbacks.push({ + name: 'Mouse Wheel Volume', + cb: this.catalogNode + }); + } }, setup: function(video) { video.muted = !Conf['Allow Sound']; @@ -10532,6 +10495,40 @@ Volume.inputs.unmute.checked = !muted; return Volume.inputs.volume.value = volume; } + }, + node: function() { + var _ref; + if (!((_ref = this.file) != null ? _ref.isVideo : void 0)) { + return; + } + $.on(this.file.thumb, 'wheel', Volume.wheel.bind(Header.hover)); + return $.on($('a', this.file.text), 'wheel', Volume.wheel.bind(this.file.thumb.parentNode)); + }, + catalogNode: function() { + var file; + file = this.thread.OP.file; + if (!(file != null ? file.isVideo : void 0)) { + return; + } + return $.on(this.nodes.thumb, 'wheel', Volume.wheel.bind(Header.hover)); + }, + wheel: function(e) { + var el, volume; + if (!(el = $('video:not([data-md5])', this))) { + return; + } + if (el.muted || !$.hasAudio(el)) { + return; + } + volume = el.volume + 0.1; + if (e.deltaY < 0) { + volume *= 1.1; + } + if (e.deltaY > 0) { + volume /= 1.1; + } + el.volume = $.minmax(volume - 0.1, 0, 1); + return e.preventDefault(); } }; @@ -11810,11 +11807,9 @@ innerHTML: "
" + statsHTML.innerHTML + "
" }); $.addClass(doc, 'float'); - $.ready((function(_this) { - return function() { - return $.add(d.body, sc); - }; - })(this)); + $.ready(function() { + return $.add(d.body, sc); + }); } this.postCountEl = $('#post-count', sc); this.fileCountEl = $('#file-count', sc); @@ -12060,7 +12055,7 @@ return !d.hidden; }; }, - autoUpdate: function(e) { + autoUpdate: function() { return ThreadUpdater.count(ThreadUpdater.isUpdating = this.checked); }, interval: function(e) { @@ -12074,7 +12069,7 @@ return $.cb.value.call(this); } }, - load: function(e) { + load: function() { var req; req = ThreadUpdater.req; switch (req.status) { @@ -13498,7 +13493,7 @@ }); return $.sync('hiddenPSA', PSAHiding.sync); }, - toggle: function(e) { + toggle: function() { var UTC; if ($.hasClass(this, 'hide-announcement')) { UTC = +$.id('globalMessage').dataset.utc; @@ -14067,10 +14062,10 @@ if (thread.ID in ExpandThread.statuses) { return ExpandThread.contract(thread, a, threadRoot); } else { - return ExpandThread.expand(thread, a, threadRoot); + return ExpandThread.expand(thread, a); } }, - expand: function(thread, a, threadRoot) { + expand: function(thread, a) { var status; ExpandThread.statuses[thread] = status = {}; a.textContent = ExpandThread.text.apply(ExpandThread, ['...'].concat(__slice.call(a.textContent.match(/\d+/g)))); @@ -15115,7 +15110,7 @@ }); } }, - node: function(post) { + node: function() { return RemoveSpoilers.unspoiler(this.nodes.comment); }, unspoiler: function(el) { diff --git a/builds/4chan-X.crx b/builds/4chan-X.crx index 97adc2846..a7267e75d 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 4d9dd8d07..900e9dc67 100644 --- a/builds/4chan-X.meta.js +++ b/builds/4chan-X.meta.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X -// @version 1.10.1.0 +// @version 1.10.1.1 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index a22aac95e..ccd8ac9a3 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.10.1.0 +// @version 1.10.1.1 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -25,7 +25,7 @@ // ==/UserScript== /* -* 4chan X - Version 1.10.1.0 +* 4chan X - Version 1.10.1.1 * * Licensed under the MIT license. * https://github.com/ccd0/4chan-x/blob/master/LICENSE @@ -181,7 +181,6 @@ 'Image Expansion': [true, 'Expand images / videos.'], 'Image Hover': [true, 'Show full image / video on mouseover.'], 'Image Hover in Catalog': [false, 'Show full image / video on mouseover in 4chan X catalog.'], - 'Mouse Wheel Volume': [true, 'Adjust volume of hovering videos with mouse wheel.'], 'Gallery': [true, 'Adds a simple and cute image gallery.'], 'Fullscreen Gallery': [false, 'Open gallery in fullscreen mode.', 1], 'PDF in Gallery': [false, 'Show PDF files in gallery.', 1], @@ -200,6 +199,7 @@ 'Show Controls': [true, 'Show controls on videos expanded inline.'], 'Click Passthrough': [false, 'Clicks on videos trigger your browser\'s default behavior. Videos can be contracted with button / dragging to the left.', 1], 'Allow Sound': [true, 'Open videos with the sound unmuted.'], + 'Mouse Wheel Volume': [true, 'Adjust volume of videos with the mouse wheel over the thumbnail/filename/gallery.'], 'Loop in New Tab': [true, 'Loop videos opened in their own tabs.'], 'Volume in New Tab': [true, 'Apply 4chan X mute and volume settings to videos opened in their own tabs.'] }, @@ -405,7 +405,7 @@ doc = d.documentElement; g = { - VERSION: '1.10.1.0', + VERSION: '1.10.1.1', NAMESPACE: '4chan X.', NAME: '4chan X', FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions', @@ -1211,18 +1211,12 @@ return this.ID; }; - function Post(root, thread, board, that) { + function Post(root, thread, board) { var capcode, clone, date, email, flag, info, name, post, subject, tripcode, uniqueID, _i, _len, _ref; this.thread = thread; this.board = board; - if (that == null) { - that = {}; - } this.ID = +root.id.slice(2); this.fullID = "" + this.board + "." + this.ID; - if (that.isOriginalMarkup) { - this.cleanup(root); - } post = $('.post', root); info = $('.postInfo', post); this.nodes = { @@ -1281,7 +1275,7 @@ } this.parseComment(); this.parseQuotes(); - this.parseFile(that); + this.parseFile(); this.isDead = false; this.isHidden = false; this.clones = []; @@ -1295,9 +1289,6 @@ } } g.posts.push(this.fullID, thread.posts.push(this, board.posts.push(this, this))); - if (that.isArchived) { - this.kill(); - } } Post.prototype.parseComment = function() { @@ -1361,7 +1352,7 @@ } }; - Post.prototype.parseFile = function(that) { + Post.prototype.parseFile = function() { var anchor, fileEl, fileText, nameNode, size, thumb, unit; if (!((fileEl = $('.file', this.nodes.post)) && (thumb = $('img[data-md5]', fileEl)))) { return; @@ -1392,20 +1383,6 @@ return this.file.name = fileText.title || nameNode.title || nameNode.textContent; }; - Post.prototype.cleanup = function(root) { - var node, _i, _j, _len, _len1, _ref, _ref1; - _ref = $$('.mobile', root); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - node = _ref[_i]; - $.rm(node); - } - _ref1 = $$('.desktop', root); - for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { - node = _ref1[_j]; - $.rmClass(node, 'desktop'); - } - }; - Post.prototype.kill = function(file) { var clone, quotelink, strong, _i, _j, _len, _len1, _ref, _ref1; if (file) { @@ -2291,9 +2268,8 @@ } board = g.boards[this.boardID] || new Board(this.boardID); thread = g.threads["" + this.boardID + "." + this.threadID] || new Thread(this.threadID, board); - post = new Post(Build.post(o), thread, board, { - isArchived: true - }); + post = new Post(Build.post(o), thread, board); + post.kill(); if (post.file) { post.file.thumbURL = o.file.turl; } @@ -2806,7 +2782,7 @@ return $.rmClass(Header.bar, 'autohide'); } }, - toggleHideBarOnScroll: function(e) { + toggleHideBarOnScroll: function() { var hide; hide = this.checked; $.cb.checked.call(this); @@ -6941,7 +6917,7 @@ } }); }, - scrollLock: function(e) { + scrollLock: function() { if (d.activeElement && QR.nodes.el.contains(d.activeElement) && d.activeElement.nodeName === 'IFRAME') { return window.scroll(window.scrollX, QR.scrollY); } else { @@ -8595,11 +8571,9 @@ return _this.rm(); }; })(this)); - $.on(this.nodes.label, 'click', (function(_this) { - return function(e) { - return e.stopPropagation(); - }; - })(this)); + $.on(this.nodes.label, 'click', function(e) { + return e.stopPropagation(); + }); $.on(this.nodes.spoiler, 'change', (function(_this) { return function(e) { _this.spoiler = e.target.checked; @@ -9067,6 +9041,9 @@ nodes.menu = new UI.Menu('gallery'); cb = Gallery.cb; $.on(nodes.frame, 'click', cb.blank); + if (Conf['Mouse Wheel Volume']) { + $.on(nodes.frame, 'wheel', Volume.wheel); + } $.on(nodes.next, 'click', cb.click); $.on(nodes.name, 'click', ImageCommon.download); $.on($('.gal-prev', dialog), 'click', cb.prev); @@ -9667,7 +9644,7 @@ } }); }, - playVideos: function(e) { + playVideos: function() { return g.posts.forEach(function(post) { var file, video, visible, _i, _len, _ref; _ref = [post].concat(__slice.call(post.clones)); @@ -9994,10 +9971,7 @@ if (!(this.file && (this.file.isImage || this.file.isVideo))) { return; } - $.on(this.file.thumb, 'mouseover', ImageHover.mouseover(this)); - if (Conf['Mouse Wheel Volume'] && this.file.isVideo) { - return $.on(this.file.thumb, 'wheel', ImageHover.wheel); - } + return $.on(this.file.thumb, 'mouseover', ImageHover.mouseover(this)); }, catalogNode: function() { var file; @@ -10005,10 +9979,7 @@ if (!(file && (file.isImage || file.isVideo))) { return; } - $.on(this.nodes.thumb, 'mouseover', ImageHover.mouseover(this.thread.OP)); - if (Conf['Mouse Wheel Volume'] && this.thread.OP.file.isVideo) { - return $.on(this.nodes.thumb, 'wheel', ImageHover.wheel); - } + return $.on(this.nodes.thumb, 'mouseover', ImageHover.mouseover(this.thread.OP)); }, mouseover: function(post) { return function(e) { @@ -10097,24 +10068,6 @@ }; })(this)); }; - }, - wheel: function(e) { - var el, volume; - if (!(el = $.id('ihover'))) { - return; - } - if (el.muted || !$.hasAudio(el)) { - return; - } - volume = el.volume + 0.1; - if (e.deltaY < 0) { - volume *= 1.1; - } - if (e.deltaY > 0) { - volume /= 1.1; - } - el.volume = $.minmax(volume - 0.1, 0, 1); - return e.preventDefault(); } }; @@ -10510,10 +10463,20 @@ el: unmuteEntry, order: 200 }); - return Header.menu.addEntry({ + Header.menu.addEntry({ el: volumeEntry, order: 201 }); + if (Conf['Mouse Wheel Volume']) { + Post.callbacks.push({ + name: 'Mouse Wheel Volume', + cb: this.node + }); + return CatalogThread.callbacks.push({ + name: 'Mouse Wheel Volume', + cb: this.catalogNode + }); + } }, setup: function(video) { video.muted = !Conf['Allow Sound']; @@ -10533,6 +10496,40 @@ Volume.inputs.unmute.checked = !muted; return Volume.inputs.volume.value = volume; } + }, + node: function() { + var _ref; + if (!((_ref = this.file) != null ? _ref.isVideo : void 0)) { + return; + } + $.on(this.file.thumb, 'wheel', Volume.wheel.bind(Header.hover)); + return $.on($('a', this.file.text), 'wheel', Volume.wheel.bind(this.file.thumb.parentNode)); + }, + catalogNode: function() { + var file; + file = this.thread.OP.file; + if (!(file != null ? file.isVideo : void 0)) { + return; + } + return $.on(this.nodes.thumb, 'wheel', Volume.wheel.bind(Header.hover)); + }, + wheel: function(e) { + var el, volume; + if (!(el = $('video:not([data-md5])', this))) { + return; + } + if (el.muted || !$.hasAudio(el)) { + return; + } + volume = el.volume + 0.1; + if (e.deltaY < 0) { + volume *= 1.1; + } + if (e.deltaY > 0) { + volume /= 1.1; + } + el.volume = $.minmax(volume - 0.1, 0, 1); + return e.preventDefault(); } }; @@ -11811,11 +11808,9 @@ innerHTML: "
" + statsHTML.innerHTML + "
" }); $.addClass(doc, 'float'); - $.ready((function(_this) { - return function() { - return $.add(d.body, sc); - }; - })(this)); + $.ready(function() { + return $.add(d.body, sc); + }); } this.postCountEl = $('#post-count', sc); this.fileCountEl = $('#file-count', sc); @@ -12061,7 +12056,7 @@ return !d.hidden; }; }, - autoUpdate: function(e) { + autoUpdate: function() { return ThreadUpdater.count(ThreadUpdater.isUpdating = this.checked); }, interval: function(e) { @@ -12075,7 +12070,7 @@ return $.cb.value.call(this); } }, - load: function(e) { + load: function() { var req; req = ThreadUpdater.req; switch (req.status) { @@ -13499,7 +13494,7 @@ }); return $.sync('hiddenPSA', PSAHiding.sync); }, - toggle: function(e) { + toggle: function() { var UTC; if ($.hasClass(this, 'hide-announcement')) { UTC = +$.id('globalMessage').dataset.utc; @@ -14068,10 +14063,10 @@ if (thread.ID in ExpandThread.statuses) { return ExpandThread.contract(thread, a, threadRoot); } else { - return ExpandThread.expand(thread, a, threadRoot); + return ExpandThread.expand(thread, a); } }, - expand: function(thread, a, threadRoot) { + expand: function(thread, a) { var status; ExpandThread.statuses[thread] = status = {}; a.textContent = ExpandThread.text.apply(ExpandThread, ['...'].concat(__slice.call(a.textContent.match(/\d+/g)))); @@ -15116,7 +15111,7 @@ }); } }, - node: function(post) { + node: function() { return RemoveSpoilers.unspoiler(this.nodes.comment); }, unspoiler: function(el) { diff --git a/builds/4chan-X.zip b/builds/4chan-X.zip index eba81bb21..fc0b26c76 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 f58f38c70..e8ca07026 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 8fc6a458e..f890ab57d 100644 --- a/builds/updates.xml +++ b/builds/updates.xml @@ -1,7 +1,7 @@ - + diff --git a/package.json b/package.json index a2860cd61..58c82aec7 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.10.1.0", + "version": "1.10.1.1", "repo": "https://github.com/ccd0/4chan-x/", "page": "https://github.com/ccd0/4chan-x", "downloads": "https://ccd0.github.io/4chan-x/builds/",