This commit is contained in:
AchtBit 2015-02-15 17:02:23 -06:00
commit 49c513bb0d
20 changed files with 241 additions and 249 deletions

View File

@ -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
**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")] **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. - 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. - Improve settings/data storage, expecially in Chromium, where failures in syncing data no longer result in failures in saving data.

View File

@ -225,6 +225,7 @@ module.exports = (grunt) ->
jshint: jshint:
options: options:
undef: true undef: true
unused: true
eqnull: true eqnull: true
expr: true expr: true
shadow: true shadow: true

View File

@ -1,5 +1,5 @@
/* /*
* 4chan X - Version 1.10.1.0 * 4chan X - Version 1.10.1.1
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/ccd0/4chan-x/blob/master/LICENSE * https://github.com/ccd0/4chan-x/blob/master/LICENSE

Binary file not shown.

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name 4chan X beta // @name 4chan X beta
// @version 1.10.1.0 // @version 1.10.1.1
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X

View File

@ -1,7 +1,7 @@
// Generated by CoffeeScript // Generated by CoffeeScript
// ==UserScript== // ==UserScript==
// @name 4chan X beta // @name 4chan X beta
// @version 1.10.1.0 // @version 1.10.1.1
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X
@ -25,7 +25,7 @@
// ==/UserScript== // ==/UserScript==
/* /*
* 4chan X - Version 1.10.1.0 * 4chan X - Version 1.10.1.1
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/ccd0/4chan-x/blob/master/LICENSE * https://github.com/ccd0/4chan-x/blob/master/LICENSE
@ -181,7 +181,6 @@
'Image Expansion': [true, 'Expand images / videos.'], 'Image Expansion': [true, 'Expand images / videos.'],
'Image Hover': [true, 'Show full image / video on mouseover.'], 'Image Hover': [true, 'Show full image / video on mouseover.'],
'Image Hover in Catalog': [false, 'Show full image / video on mouseover in 4chan X catalog.'], '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.'], 'Gallery': [true, 'Adds a simple and cute image gallery.'],
'Fullscreen Gallery': [false, 'Open gallery in fullscreen mode.', 1], 'Fullscreen Gallery': [false, 'Open gallery in fullscreen mode.', 1],
'PDF in Gallery': [false, 'Show PDF files in gallery.', 1], 'PDF in Gallery': [false, 'Show PDF files in gallery.', 1],
@ -200,6 +199,7 @@
'Show Controls': [true, 'Show controls on videos expanded inline.'], '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], '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.'], '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.'], '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.'] '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; doc = d.documentElement;
g = { g = {
VERSION: '1.10.1.0', VERSION: '1.10.1.1',
NAMESPACE: '4chan X.', NAMESPACE: '4chan X.',
NAME: '4chan X', NAME: '4chan X',
FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions', FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions',
@ -1211,18 +1211,12 @@
return this.ID; 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; var capcode, clone, date, email, flag, info, name, post, subject, tripcode, uniqueID, _i, _len, _ref;
this.thread = thread; this.thread = thread;
this.board = board; this.board = board;
if (that == null) {
that = {};
}
this.ID = +root.id.slice(2); this.ID = +root.id.slice(2);
this.fullID = "" + this.board + "." + this.ID; this.fullID = "" + this.board + "." + this.ID;
if (that.isOriginalMarkup) {
this.cleanup(root);
}
post = $('.post', root); post = $('.post', root);
info = $('.postInfo', post); info = $('.postInfo', post);
this.nodes = { this.nodes = {
@ -1281,7 +1275,7 @@
} }
this.parseComment(); this.parseComment();
this.parseQuotes(); this.parseQuotes();
this.parseFile(that); this.parseFile();
this.isDead = false; this.isDead = false;
this.isHidden = false; this.isHidden = false;
this.clones = []; this.clones = [];
@ -1295,9 +1289,6 @@
} }
} }
g.posts.push(this.fullID, thread.posts.push(this, board.posts.push(this, this))); g.posts.push(this.fullID, thread.posts.push(this, board.posts.push(this, this)));
if (that.isArchived) {
this.kill();
}
} }
Post.prototype.parseComment = function() { 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; var anchor, fileEl, fileText, nameNode, size, thumb, unit;
if (!((fileEl = $('.file', this.nodes.post)) && (thumb = $('img[data-md5]', fileEl)))) { if (!((fileEl = $('.file', this.nodes.post)) && (thumb = $('img[data-md5]', fileEl)))) {
return; return;
@ -1392,20 +1383,6 @@
return this.file.name = fileText.title || nameNode.title || nameNode.textContent; 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) { Post.prototype.kill = function(file) {
var clone, quotelink, strong, _i, _j, _len, _len1, _ref, _ref1; var clone, quotelink, strong, _i, _j, _len, _len1, _ref, _ref1;
if (file) { if (file) {
@ -2291,9 +2268,8 @@
} }
board = g.boards[this.boardID] || new Board(this.boardID); board = g.boards[this.boardID] || new Board(this.boardID);
thread = g.threads["" + this.boardID + "." + this.threadID] || new Thread(this.threadID, board); thread = g.threads["" + this.boardID + "." + this.threadID] || new Thread(this.threadID, board);
post = new Post(Build.post(o), thread, board, { post = new Post(Build.post(o), thread, board);
isArchived: true post.kill();
});
if (post.file) { if (post.file) {
post.file.thumbURL = o.file.turl; post.file.thumbURL = o.file.turl;
} }
@ -2806,7 +2782,7 @@
return $.rmClass(Header.bar, 'autohide'); return $.rmClass(Header.bar, 'autohide');
} }
}, },
toggleHideBarOnScroll: function(e) { toggleHideBarOnScroll: function() {
var hide; var hide;
hide = this.checked; hide = this.checked;
$.cb.checked.call(this); $.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') { if (d.activeElement && QR.nodes.el.contains(d.activeElement) && d.activeElement.nodeName === 'IFRAME') {
return window.scroll(window.scrollX, QR.scrollY); return window.scroll(window.scrollX, QR.scrollY);
} else { } else {
@ -8595,11 +8571,9 @@
return _this.rm(); return _this.rm();
}; };
})(this)); })(this));
$.on(this.nodes.label, 'click', (function(_this) { $.on(this.nodes.label, 'click', function(e) {
return function(e) { return e.stopPropagation();
return e.stopPropagation(); });
};
})(this));
$.on(this.nodes.spoiler, 'change', (function(_this) { $.on(this.nodes.spoiler, 'change', (function(_this) {
return function(e) { return function(e) {
_this.spoiler = e.target.checked; _this.spoiler = e.target.checked;
@ -9067,6 +9041,9 @@
nodes.menu = new UI.Menu('gallery'); nodes.menu = new UI.Menu('gallery');
cb = Gallery.cb; cb = Gallery.cb;
$.on(nodes.frame, 'click', cb.blank); $.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.next, 'click', cb.click);
$.on(nodes.name, 'click', ImageCommon.download); $.on(nodes.name, 'click', ImageCommon.download);
$.on($('.gal-prev', dialog), 'click', cb.prev); $.on($('.gal-prev', dialog), 'click', cb.prev);
@ -9667,7 +9644,7 @@
} }
}); });
}, },
playVideos: function(e) { playVideos: function() {
return g.posts.forEach(function(post) { return g.posts.forEach(function(post) {
var file, video, visible, _i, _len, _ref; var file, video, visible, _i, _len, _ref;
_ref = [post].concat(__slice.call(post.clones)); _ref = [post].concat(__slice.call(post.clones));
@ -9994,10 +9971,7 @@
if (!(this.file && (this.file.isImage || this.file.isVideo))) { if (!(this.file && (this.file.isImage || this.file.isVideo))) {
return; return;
} }
$.on(this.file.thumb, 'mouseover', ImageHover.mouseover(this)); 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);
}
}, },
catalogNode: function() { catalogNode: function() {
var file; var file;
@ -10005,10 +9979,7 @@
if (!(file && (file.isImage || file.isVideo))) { if (!(file && (file.isImage || file.isVideo))) {
return; return;
} }
$.on(this.nodes.thumb, 'mouseover', ImageHover.mouseover(this.thread.OP)); 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);
}
}, },
mouseover: function(post) { mouseover: function(post) {
return function(e) { return function(e) {
@ -10097,24 +10068,6 @@
}; };
})(this)); })(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, el: unmuteEntry,
order: 200 order: 200
}); });
return Header.menu.addEntry({ Header.menu.addEntry({
el: volumeEntry, el: volumeEntry,
order: 201 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) { setup: function(video) {
video.muted = !Conf['Allow Sound']; video.muted = !Conf['Allow Sound'];
@ -10533,6 +10496,40 @@
Volume.inputs.unmute.checked = !muted; Volume.inputs.unmute.checked = !muted;
return Volume.inputs.volume.value = volume; 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: "<div class=\"move\" title=\"" + E(statsTitle) + "\">" + statsHTML.innerHTML + "</div>" innerHTML: "<div class=\"move\" title=\"" + E(statsTitle) + "\">" + statsHTML.innerHTML + "</div>"
}); });
$.addClass(doc, 'float'); $.addClass(doc, 'float');
$.ready((function(_this) { $.ready(function() {
return function() { return $.add(d.body, sc);
return $.add(d.body, sc); });
};
})(this));
} }
this.postCountEl = $('#post-count', sc); this.postCountEl = $('#post-count', sc);
this.fileCountEl = $('#file-count', sc); this.fileCountEl = $('#file-count', sc);
@ -12061,7 +12056,7 @@
return !d.hidden; return !d.hidden;
}; };
}, },
autoUpdate: function(e) { autoUpdate: function() {
return ThreadUpdater.count(ThreadUpdater.isUpdating = this.checked); return ThreadUpdater.count(ThreadUpdater.isUpdating = this.checked);
}, },
interval: function(e) { interval: function(e) {
@ -12075,7 +12070,7 @@
return $.cb.value.call(this); return $.cb.value.call(this);
} }
}, },
load: function(e) { load: function() {
var req; var req;
req = ThreadUpdater.req; req = ThreadUpdater.req;
switch (req.status) { switch (req.status) {
@ -13499,7 +13494,7 @@
}); });
return $.sync('hiddenPSA', PSAHiding.sync); return $.sync('hiddenPSA', PSAHiding.sync);
}, },
toggle: function(e) { toggle: function() {
var UTC; var UTC;
if ($.hasClass(this, 'hide-announcement')) { if ($.hasClass(this, 'hide-announcement')) {
UTC = +$.id('globalMessage').dataset.utc; UTC = +$.id('globalMessage').dataset.utc;
@ -14068,10 +14063,10 @@
if (thread.ID in ExpandThread.statuses) { if (thread.ID in ExpandThread.statuses) {
return ExpandThread.contract(thread, a, threadRoot); return ExpandThread.contract(thread, a, threadRoot);
} else { } else {
return ExpandThread.expand(thread, a, threadRoot); return ExpandThread.expand(thread, a);
} }
}, },
expand: function(thread, a, threadRoot) { expand: function(thread, a) {
var status; var status;
ExpandThread.statuses[thread] = status = {}; ExpandThread.statuses[thread] = status = {};
a.textContent = ExpandThread.text.apply(ExpandThread, ['...'].concat(__slice.call(a.textContent.match(/\d+/g)))); 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); return RemoveSpoilers.unspoiler(this.nodes.comment);
}, },
unspoiler: function(el) { unspoiler: function(el) {

Binary file not shown.

View File

@ -1,7 +1,7 @@
// Generated by CoffeeScript // Generated by CoffeeScript
// ==UserScript== // ==UserScript==
// @name 4chan X // @name 4chan X
// @version 1.10.1.0 // @version 1.10.1.1
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X
@ -24,7 +24,7 @@
// ==/UserScript== // ==/UserScript==
/* /*
* 4chan X - Version 1.10.1.0 * 4chan X - Version 1.10.1.1
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/ccd0/4chan-x/blob/master/LICENSE * https://github.com/ccd0/4chan-x/blob/master/LICENSE
@ -180,7 +180,6 @@
'Image Expansion': [true, 'Expand images / videos.'], 'Image Expansion': [true, 'Expand images / videos.'],
'Image Hover': [true, 'Show full image / video on mouseover.'], 'Image Hover': [true, 'Show full image / video on mouseover.'],
'Image Hover in Catalog': [false, 'Show full image / video on mouseover in 4chan X catalog.'], '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.'], 'Gallery': [true, 'Adds a simple and cute image gallery.'],
'Fullscreen Gallery': [false, 'Open gallery in fullscreen mode.', 1], 'Fullscreen Gallery': [false, 'Open gallery in fullscreen mode.', 1],
'PDF in Gallery': [false, 'Show PDF files in gallery.', 1], 'PDF in Gallery': [false, 'Show PDF files in gallery.', 1],
@ -199,6 +198,7 @@
'Show Controls': [true, 'Show controls on videos expanded inline.'], '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], '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.'], '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.'], '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.'] '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; doc = d.documentElement;
g = { g = {
VERSION: '1.10.1.0', VERSION: '1.10.1.1',
NAMESPACE: '4chan X.', NAMESPACE: '4chan X.',
NAME: '4chan X', NAME: '4chan X',
FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions', FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions',
@ -1210,18 +1210,12 @@
return this.ID; 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; var capcode, clone, date, email, flag, info, name, post, subject, tripcode, uniqueID, _i, _len, _ref;
this.thread = thread; this.thread = thread;
this.board = board; this.board = board;
if (that == null) {
that = {};
}
this.ID = +root.id.slice(2); this.ID = +root.id.slice(2);
this.fullID = "" + this.board + "." + this.ID; this.fullID = "" + this.board + "." + this.ID;
if (that.isOriginalMarkup) {
this.cleanup(root);
}
post = $('.post', root); post = $('.post', root);
info = $('.postInfo', post); info = $('.postInfo', post);
this.nodes = { this.nodes = {
@ -1280,7 +1274,7 @@
} }
this.parseComment(); this.parseComment();
this.parseQuotes(); this.parseQuotes();
this.parseFile(that); this.parseFile();
this.isDead = false; this.isDead = false;
this.isHidden = false; this.isHidden = false;
this.clones = []; this.clones = [];
@ -1294,9 +1288,6 @@
} }
} }
g.posts.push(this.fullID, thread.posts.push(this, board.posts.push(this, this))); g.posts.push(this.fullID, thread.posts.push(this, board.posts.push(this, this)));
if (that.isArchived) {
this.kill();
}
} }
Post.prototype.parseComment = function() { 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; var anchor, fileEl, fileText, nameNode, size, thumb, unit;
if (!((fileEl = $('.file', this.nodes.post)) && (thumb = $('img[data-md5]', fileEl)))) { if (!((fileEl = $('.file', this.nodes.post)) && (thumb = $('img[data-md5]', fileEl)))) {
return; return;
@ -1391,20 +1382,6 @@
return this.file.name = fileText.title || nameNode.title || nameNode.textContent; 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) { Post.prototype.kill = function(file) {
var clone, quotelink, strong, _i, _j, _len, _len1, _ref, _ref1; var clone, quotelink, strong, _i, _j, _len, _len1, _ref, _ref1;
if (file) { if (file) {
@ -2290,9 +2267,8 @@
} }
board = g.boards[this.boardID] || new Board(this.boardID); board = g.boards[this.boardID] || new Board(this.boardID);
thread = g.threads["" + this.boardID + "." + this.threadID] || new Thread(this.threadID, board); thread = g.threads["" + this.boardID + "." + this.threadID] || new Thread(this.threadID, board);
post = new Post(Build.post(o), thread, board, { post = new Post(Build.post(o), thread, board);
isArchived: true post.kill();
});
if (post.file) { if (post.file) {
post.file.thumbURL = o.file.turl; post.file.thumbURL = o.file.turl;
} }
@ -2805,7 +2781,7 @@
return $.rmClass(Header.bar, 'autohide'); return $.rmClass(Header.bar, 'autohide');
} }
}, },
toggleHideBarOnScroll: function(e) { toggleHideBarOnScroll: function() {
var hide; var hide;
hide = this.checked; hide = this.checked;
$.cb.checked.call(this); $.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') { if (d.activeElement && QR.nodes.el.contains(d.activeElement) && d.activeElement.nodeName === 'IFRAME') {
return window.scroll(window.scrollX, QR.scrollY); return window.scroll(window.scrollX, QR.scrollY);
} else { } else {
@ -8594,11 +8570,9 @@
return _this.rm(); return _this.rm();
}; };
})(this)); })(this));
$.on(this.nodes.label, 'click', (function(_this) { $.on(this.nodes.label, 'click', function(e) {
return function(e) { return e.stopPropagation();
return e.stopPropagation(); });
};
})(this));
$.on(this.nodes.spoiler, 'change', (function(_this) { $.on(this.nodes.spoiler, 'change', (function(_this) {
return function(e) { return function(e) {
_this.spoiler = e.target.checked; _this.spoiler = e.target.checked;
@ -9066,6 +9040,9 @@
nodes.menu = new UI.Menu('gallery'); nodes.menu = new UI.Menu('gallery');
cb = Gallery.cb; cb = Gallery.cb;
$.on(nodes.frame, 'click', cb.blank); $.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.next, 'click', cb.click);
$.on(nodes.name, 'click', ImageCommon.download); $.on(nodes.name, 'click', ImageCommon.download);
$.on($('.gal-prev', dialog), 'click', cb.prev); $.on($('.gal-prev', dialog), 'click', cb.prev);
@ -9666,7 +9643,7 @@
} }
}); });
}, },
playVideos: function(e) { playVideos: function() {
return g.posts.forEach(function(post) { return g.posts.forEach(function(post) {
var file, video, visible, _i, _len, _ref; var file, video, visible, _i, _len, _ref;
_ref = [post].concat(__slice.call(post.clones)); _ref = [post].concat(__slice.call(post.clones));
@ -9993,10 +9970,7 @@
if (!(this.file && (this.file.isImage || this.file.isVideo))) { if (!(this.file && (this.file.isImage || this.file.isVideo))) {
return; return;
} }
$.on(this.file.thumb, 'mouseover', ImageHover.mouseover(this)); 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);
}
}, },
catalogNode: function() { catalogNode: function() {
var file; var file;
@ -10004,10 +9978,7 @@
if (!(file && (file.isImage || file.isVideo))) { if (!(file && (file.isImage || file.isVideo))) {
return; return;
} }
$.on(this.nodes.thumb, 'mouseover', ImageHover.mouseover(this.thread.OP)); 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);
}
}, },
mouseover: function(post) { mouseover: function(post) {
return function(e) { return function(e) {
@ -10096,24 +10067,6 @@
}; };
})(this)); })(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, el: unmuteEntry,
order: 200 order: 200
}); });
return Header.menu.addEntry({ Header.menu.addEntry({
el: volumeEntry, el: volumeEntry,
order: 201 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) { setup: function(video) {
video.muted = !Conf['Allow Sound']; video.muted = !Conf['Allow Sound'];
@ -10532,6 +10495,40 @@
Volume.inputs.unmute.checked = !muted; Volume.inputs.unmute.checked = !muted;
return Volume.inputs.volume.value = volume; 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: "<div class=\"move\" title=\"" + E(statsTitle) + "\">" + statsHTML.innerHTML + "</div>" innerHTML: "<div class=\"move\" title=\"" + E(statsTitle) + "\">" + statsHTML.innerHTML + "</div>"
}); });
$.addClass(doc, 'float'); $.addClass(doc, 'float');
$.ready((function(_this) { $.ready(function() {
return function() { return $.add(d.body, sc);
return $.add(d.body, sc); });
};
})(this));
} }
this.postCountEl = $('#post-count', sc); this.postCountEl = $('#post-count', sc);
this.fileCountEl = $('#file-count', sc); this.fileCountEl = $('#file-count', sc);
@ -12060,7 +12055,7 @@
return !d.hidden; return !d.hidden;
}; };
}, },
autoUpdate: function(e) { autoUpdate: function() {
return ThreadUpdater.count(ThreadUpdater.isUpdating = this.checked); return ThreadUpdater.count(ThreadUpdater.isUpdating = this.checked);
}, },
interval: function(e) { interval: function(e) {
@ -12074,7 +12069,7 @@
return $.cb.value.call(this); return $.cb.value.call(this);
} }
}, },
load: function(e) { load: function() {
var req; var req;
req = ThreadUpdater.req; req = ThreadUpdater.req;
switch (req.status) { switch (req.status) {
@ -13498,7 +13493,7 @@
}); });
return $.sync('hiddenPSA', PSAHiding.sync); return $.sync('hiddenPSA', PSAHiding.sync);
}, },
toggle: function(e) { toggle: function() {
var UTC; var UTC;
if ($.hasClass(this, 'hide-announcement')) { if ($.hasClass(this, 'hide-announcement')) {
UTC = +$.id('globalMessage').dataset.utc; UTC = +$.id('globalMessage').dataset.utc;
@ -14067,10 +14062,10 @@
if (thread.ID in ExpandThread.statuses) { if (thread.ID in ExpandThread.statuses) {
return ExpandThread.contract(thread, a, threadRoot); return ExpandThread.contract(thread, a, threadRoot);
} else { } else {
return ExpandThread.expand(thread, a, threadRoot); return ExpandThread.expand(thread, a);
} }
}, },
expand: function(thread, a, threadRoot) { expand: function(thread, a) {
var status; var status;
ExpandThread.statuses[thread] = status = {}; ExpandThread.statuses[thread] = status = {};
a.textContent = ExpandThread.text.apply(ExpandThread, ['...'].concat(__slice.call(a.textContent.match(/\d+/g)))); 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); return RemoveSpoilers.unspoiler(this.nodes.comment);
}, },
unspoiler: function(el) { unspoiler: function(el) {

Binary file not shown.

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name 4chan X // @name 4chan X
// @version 1.10.1.0 // @version 1.10.1.1
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X

View File

@ -1,7 +1,7 @@
// Generated by CoffeeScript // Generated by CoffeeScript
// ==UserScript== // ==UserScript==
// @name 4chan X // @name 4chan X
// @version 1.10.1.0 // @version 1.10.1.1
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X
@ -25,7 +25,7 @@
// ==/UserScript== // ==/UserScript==
/* /*
* 4chan X - Version 1.10.1.0 * 4chan X - Version 1.10.1.1
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/ccd0/4chan-x/blob/master/LICENSE * https://github.com/ccd0/4chan-x/blob/master/LICENSE
@ -181,7 +181,6 @@
'Image Expansion': [true, 'Expand images / videos.'], 'Image Expansion': [true, 'Expand images / videos.'],
'Image Hover': [true, 'Show full image / video on mouseover.'], 'Image Hover': [true, 'Show full image / video on mouseover.'],
'Image Hover in Catalog': [false, 'Show full image / video on mouseover in 4chan X catalog.'], '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.'], 'Gallery': [true, 'Adds a simple and cute image gallery.'],
'Fullscreen Gallery': [false, 'Open gallery in fullscreen mode.', 1], 'Fullscreen Gallery': [false, 'Open gallery in fullscreen mode.', 1],
'PDF in Gallery': [false, 'Show PDF files in gallery.', 1], 'PDF in Gallery': [false, 'Show PDF files in gallery.', 1],
@ -200,6 +199,7 @@
'Show Controls': [true, 'Show controls on videos expanded inline.'], '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], '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.'], '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.'], '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.'] '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; doc = d.documentElement;
g = { g = {
VERSION: '1.10.1.0', VERSION: '1.10.1.1',
NAMESPACE: '4chan X.', NAMESPACE: '4chan X.',
NAME: '4chan X', NAME: '4chan X',
FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions', FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions',
@ -1211,18 +1211,12 @@
return this.ID; 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; var capcode, clone, date, email, flag, info, name, post, subject, tripcode, uniqueID, _i, _len, _ref;
this.thread = thread; this.thread = thread;
this.board = board; this.board = board;
if (that == null) {
that = {};
}
this.ID = +root.id.slice(2); this.ID = +root.id.slice(2);
this.fullID = "" + this.board + "." + this.ID; this.fullID = "" + this.board + "." + this.ID;
if (that.isOriginalMarkup) {
this.cleanup(root);
}
post = $('.post', root); post = $('.post', root);
info = $('.postInfo', post); info = $('.postInfo', post);
this.nodes = { this.nodes = {
@ -1281,7 +1275,7 @@
} }
this.parseComment(); this.parseComment();
this.parseQuotes(); this.parseQuotes();
this.parseFile(that); this.parseFile();
this.isDead = false; this.isDead = false;
this.isHidden = false; this.isHidden = false;
this.clones = []; this.clones = [];
@ -1295,9 +1289,6 @@
} }
} }
g.posts.push(this.fullID, thread.posts.push(this, board.posts.push(this, this))); g.posts.push(this.fullID, thread.posts.push(this, board.posts.push(this, this)));
if (that.isArchived) {
this.kill();
}
} }
Post.prototype.parseComment = function() { 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; var anchor, fileEl, fileText, nameNode, size, thumb, unit;
if (!((fileEl = $('.file', this.nodes.post)) && (thumb = $('img[data-md5]', fileEl)))) { if (!((fileEl = $('.file', this.nodes.post)) && (thumb = $('img[data-md5]', fileEl)))) {
return; return;
@ -1392,20 +1383,6 @@
return this.file.name = fileText.title || nameNode.title || nameNode.textContent; 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) { Post.prototype.kill = function(file) {
var clone, quotelink, strong, _i, _j, _len, _len1, _ref, _ref1; var clone, quotelink, strong, _i, _j, _len, _len1, _ref, _ref1;
if (file) { if (file) {
@ -2291,9 +2268,8 @@
} }
board = g.boards[this.boardID] || new Board(this.boardID); board = g.boards[this.boardID] || new Board(this.boardID);
thread = g.threads["" + this.boardID + "." + this.threadID] || new Thread(this.threadID, board); thread = g.threads["" + this.boardID + "." + this.threadID] || new Thread(this.threadID, board);
post = new Post(Build.post(o), thread, board, { post = new Post(Build.post(o), thread, board);
isArchived: true post.kill();
});
if (post.file) { if (post.file) {
post.file.thumbURL = o.file.turl; post.file.thumbURL = o.file.turl;
} }
@ -2806,7 +2782,7 @@
return $.rmClass(Header.bar, 'autohide'); return $.rmClass(Header.bar, 'autohide');
} }
}, },
toggleHideBarOnScroll: function(e) { toggleHideBarOnScroll: function() {
var hide; var hide;
hide = this.checked; hide = this.checked;
$.cb.checked.call(this); $.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') { if (d.activeElement && QR.nodes.el.contains(d.activeElement) && d.activeElement.nodeName === 'IFRAME') {
return window.scroll(window.scrollX, QR.scrollY); return window.scroll(window.scrollX, QR.scrollY);
} else { } else {
@ -8595,11 +8571,9 @@
return _this.rm(); return _this.rm();
}; };
})(this)); })(this));
$.on(this.nodes.label, 'click', (function(_this) { $.on(this.nodes.label, 'click', function(e) {
return function(e) { return e.stopPropagation();
return e.stopPropagation(); });
};
})(this));
$.on(this.nodes.spoiler, 'change', (function(_this) { $.on(this.nodes.spoiler, 'change', (function(_this) {
return function(e) { return function(e) {
_this.spoiler = e.target.checked; _this.spoiler = e.target.checked;
@ -9067,6 +9041,9 @@
nodes.menu = new UI.Menu('gallery'); nodes.menu = new UI.Menu('gallery');
cb = Gallery.cb; cb = Gallery.cb;
$.on(nodes.frame, 'click', cb.blank); $.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.next, 'click', cb.click);
$.on(nodes.name, 'click', ImageCommon.download); $.on(nodes.name, 'click', ImageCommon.download);
$.on($('.gal-prev', dialog), 'click', cb.prev); $.on($('.gal-prev', dialog), 'click', cb.prev);
@ -9667,7 +9644,7 @@
} }
}); });
}, },
playVideos: function(e) { playVideos: function() {
return g.posts.forEach(function(post) { return g.posts.forEach(function(post) {
var file, video, visible, _i, _len, _ref; var file, video, visible, _i, _len, _ref;
_ref = [post].concat(__slice.call(post.clones)); _ref = [post].concat(__slice.call(post.clones));
@ -9994,10 +9971,7 @@
if (!(this.file && (this.file.isImage || this.file.isVideo))) { if (!(this.file && (this.file.isImage || this.file.isVideo))) {
return; return;
} }
$.on(this.file.thumb, 'mouseover', ImageHover.mouseover(this)); 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);
}
}, },
catalogNode: function() { catalogNode: function() {
var file; var file;
@ -10005,10 +9979,7 @@
if (!(file && (file.isImage || file.isVideo))) { if (!(file && (file.isImage || file.isVideo))) {
return; return;
} }
$.on(this.nodes.thumb, 'mouseover', ImageHover.mouseover(this.thread.OP)); 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);
}
}, },
mouseover: function(post) { mouseover: function(post) {
return function(e) { return function(e) {
@ -10097,24 +10068,6 @@
}; };
})(this)); })(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, el: unmuteEntry,
order: 200 order: 200
}); });
return Header.menu.addEntry({ Header.menu.addEntry({
el: volumeEntry, el: volumeEntry,
order: 201 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) { setup: function(video) {
video.muted = !Conf['Allow Sound']; video.muted = !Conf['Allow Sound'];
@ -10533,6 +10496,40 @@
Volume.inputs.unmute.checked = !muted; Volume.inputs.unmute.checked = !muted;
return Volume.inputs.volume.value = volume; 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: "<div class=\"move\" title=\"" + E(statsTitle) + "\">" + statsHTML.innerHTML + "</div>" innerHTML: "<div class=\"move\" title=\"" + E(statsTitle) + "\">" + statsHTML.innerHTML + "</div>"
}); });
$.addClass(doc, 'float'); $.addClass(doc, 'float');
$.ready((function(_this) { $.ready(function() {
return function() { return $.add(d.body, sc);
return $.add(d.body, sc); });
};
})(this));
} }
this.postCountEl = $('#post-count', sc); this.postCountEl = $('#post-count', sc);
this.fileCountEl = $('#file-count', sc); this.fileCountEl = $('#file-count', sc);
@ -12061,7 +12056,7 @@
return !d.hidden; return !d.hidden;
}; };
}, },
autoUpdate: function(e) { autoUpdate: function() {
return ThreadUpdater.count(ThreadUpdater.isUpdating = this.checked); return ThreadUpdater.count(ThreadUpdater.isUpdating = this.checked);
}, },
interval: function(e) { interval: function(e) {
@ -12075,7 +12070,7 @@
return $.cb.value.call(this); return $.cb.value.call(this);
} }
}, },
load: function(e) { load: function() {
var req; var req;
req = ThreadUpdater.req; req = ThreadUpdater.req;
switch (req.status) { switch (req.status) {
@ -13499,7 +13494,7 @@
}); });
return $.sync('hiddenPSA', PSAHiding.sync); return $.sync('hiddenPSA', PSAHiding.sync);
}, },
toggle: function(e) { toggle: function() {
var UTC; var UTC;
if ($.hasClass(this, 'hide-announcement')) { if ($.hasClass(this, 'hide-announcement')) {
UTC = +$.id('globalMessage').dataset.utc; UTC = +$.id('globalMessage').dataset.utc;
@ -14068,10 +14063,10 @@
if (thread.ID in ExpandThread.statuses) { if (thread.ID in ExpandThread.statuses) {
return ExpandThread.contract(thread, a, threadRoot); return ExpandThread.contract(thread, a, threadRoot);
} else { } else {
return ExpandThread.expand(thread, a, threadRoot); return ExpandThread.expand(thread, a);
} }
}, },
expand: function(thread, a, threadRoot) { expand: function(thread, a) {
var status; var status;
ExpandThread.statuses[thread] = status = {}; ExpandThread.statuses[thread] = status = {};
a.textContent = ExpandThread.text.apply(ExpandThread, ['...'].concat(__slice.call(a.textContent.match(/\d+/g)))); 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); return RemoveSpoilers.unspoiler(this.nodes.comment);
}, },
unspoiler: function(el) { unspoiler: function(el) {

Binary file not shown.

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'> <gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
<app appid='lacclbnghgdicfifcamcmcnilckjamag'> <app appid='lacclbnghgdicfifcamcmcnilckjamag'>
<updatecheck codebase='https://ccd0.github.io/4chan-x/builds/4chan-X-beta.crx' version='1.10.1.0' /> <updatecheck codebase='https://ccd0.github.io/4chan-x/builds/4chan-X-beta.crx' version='1.10.1.1' />
</app> </app>
</gupdate> </gupdate>

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'> <gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
<app appid='lacclbnghgdicfifcamcmcnilckjamag'> <app appid='lacclbnghgdicfifcamcmcnilckjamag'>
<updatecheck codebase='https://ccd0.github.io/4chan-x/builds/4chan-X.crx' version='1.10.1.0' /> <updatecheck codebase='https://ccd0.github.io/4chan-x/builds/4chan-X.crx' version='1.10.1.1' />
</app> </app>
</gupdate> </gupdate>

View File

@ -3,7 +3,7 @@
"description": "Cross-browser userscript for maximum lurking on 4chan.", "description": "Cross-browser userscript for maximum lurking on 4chan.",
"meta": { "meta": {
"name": "4chan X", "name": "4chan X",
"version": "1.10.1.0", "version": "1.10.1.1",
"repo": "https://github.com/ccd0/4chan-x/", "repo": "https://github.com/ccd0/4chan-x/",
"page": "https://github.com/ccd0/4chan-x", "page": "https://github.com/ccd0/4chan-x",
"downloads": "https://ccd0.github.io/4chan-x/builds/", "downloads": "https://ccd0.github.io/4chan-x/builds/",

View File

@ -318,7 +318,7 @@ chrome.storage.onChanged.addListener (changes, area) ->
return return
$.sync = (key, cb) -> $.sync = (key, cb) ->
$.syncing[key] = cb $.syncing[key] = cb
$.forceSync = (key) -> return $.forceSync = -> return
$.get = (key, val, cb) -> $.get = (key, val, cb) ->
if typeof cb is 'function' if typeof cb is 'function'

View File

@ -44,13 +44,15 @@ ExpandThread =
if thread.ID of ExpandThread.statuses if thread.ID of ExpandThread.statuses
ExpandThread.contract thread, a, threadRoot ExpandThread.contract thread, a, threadRoot
else else
ExpandThread.expand thread, a, threadRoot ExpandThread.expand thread, a
expand: (thread, a, threadRoot) ->
expand: (thread, a) ->
ExpandThread.statuses[thread] = status = {} ExpandThread.statuses[thread] = status = {}
a.textContent = ExpandThread.text '...', a.textContent.match(/\d+/g)... a.textContent = ExpandThread.text '...', a.textContent.match(/\d+/g)...
status.req = $.cache "//a.4cdn.org/#{thread.board}/thread/#{thread}.json", -> status.req = $.cache "//a.4cdn.org/#{thread.board}/thread/#{thread}.json", ->
delete status.req delete status.req
ExpandThread.parse @, thread, a ExpandThread.parse @, thread, a
contract: (thread, a, threadRoot) -> contract: (thread, a, threadRoot) ->
status = ExpandThread.statuses[thread] status = ExpandThread.statuses[thread]
delete ExpandThread.statuses[thread] delete ExpandThread.statuses[thread]
@ -78,6 +80,7 @@ ExpandThread =
filesCount++ if 'file' of Get.postFromRoot reply filesCount++ if 'file' of Get.postFromRoot reply
$.rm reply $.rm reply
a.textContent = ExpandThread.text '+', postsCount, filesCount a.textContent = ExpandThread.text '+', postsCount, filesCount
parse: (req, thread, a) -> parse: (req, thread, a) ->
if req.status not in [200, 304] if req.status not in [200, 304]
a.textContent = "Error #{req.statusText} (#{req.status})" a.textContent = "Error #{req.statusText} (#{req.status})"

View File

@ -16,7 +16,7 @@ RemoveSpoilers =
if g.VIEW is 'archive' if g.VIEW is 'archive'
$.ready -> RemoveSpoilers.unspoiler $.id 'arc-list' $.ready -> RemoveSpoilers.unspoiler $.id 'arc-list'
node: (post) -> node: ->
RemoveSpoilers.unspoiler @nodes.comment RemoveSpoilers.unspoiler @nodes.comment
unspoiler: (el) -> unspoiler: (el) ->

View File

@ -23,7 +23,7 @@ ThreadStats =
@dialog = sc = UI.dialog 'thread-stats', 'bottom: 0px; right: 0px;', @dialog = sc = UI.dialog 'thread-stats', 'bottom: 0px; right: 0px;',
<%= html('<div class="move" title="${statsTitle}">&{statsHTML}</div>') %> <%= html('<div class="move" title="${statsTitle}">&{statsHTML}</div>') %>
$.addClass doc, 'float' $.addClass doc, 'float'
$.ready => $.ready ->
$.add d.body, sc $.add d.body, sc
@postCountEl = $ '#post-count', sc @postCountEl = $ '#post-count', sc

View File

@ -15,7 +15,7 @@ QR.post = class
$.on el, 'click', @select $.on el, 'click', @select
$.on @nodes.rm, 'click', (e) => e.stopPropagation(); @rm() $.on @nodes.rm, 'click', (e) => e.stopPropagation(); @rm()
$.on @nodes.label, 'click', (e) => e.stopPropagation() $.on @nodes.label, 'click', (e) -> e.stopPropagation()
$.on @nodes.spoiler, 'change', (e) => $.on @nodes.spoiler, 'change', (e) =>
@spoiler = e.target.checked @spoiler = e.target.checked
QR.nodes.spoiler.checked = @spoiler if @ is QR.selected QR.nodes.spoiler.checked = @spoiler if @ is QR.selected