Release 4chan X v1.7.20.

This commit is contained in:
ccd0 2014-04-27 00:25:02 -07:00
parent 9bae0f28ac
commit d6f9d136b0
9 changed files with 149 additions and 378 deletions

View File

@ -1,3 +1,6 @@
### v1.7.20
*2014-04-27*
**ccd0** **ccd0**
- Fix features broken/disabled in catalog: settings link, thread watcher, start thread button, and keybinds. - Fix features broken/disabled in catalog: settings link, thread watcher, start thread button, and keybinds.

View File

@ -1,5 +1,5 @@
/* /*
* 4chan X - Version 1.7.19 - 2014-04-25 * 4chan X - Version 1.7.20 - 2014-04-27
* *
* 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

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name 4chan X // @name 4chan X
// @version 1.7.19 // @version 1.7.20
// @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.7.19 // @version 1.7.20
// @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.7.19 - 2014-04-25 * 4chan X - Version 1.7.20 - 2014-04-27
* *
* 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
@ -106,7 +106,7 @@
'use strict'; 'use strict';
(function() { (function() {
var $, $$, Anonymize, ArchiveLink, AutoGIF, Banner, Board, Build, Callbacks, CatalogLinks, Clone, Conf, Config, CustomCSS, DataBoard, DeleteLink, Dice, DownloadLink, Emoji, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Fourchan, Gallery, Get, Header, IDColor, ImageExpand, ImageHover, ImageLoader, Index, InfiniScroll, Keybinds, Linkify, Main, Menu, Nav, Navigate, Notice, PSAHiding, Polyfill, Post, PostHiding, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, RandomAccessList, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Sauce, Settings, SimpleDict, Thread, ThreadExcerpt, ThreadHiding, ThreadStats, ThreadUpdater, ThreadWatcher, Time, TrashQueue, UI, Unread, Video, c, d, doc, g, var $, $$, Anonymize, ArchiveLink, AutoGIF, Banner, Board, Build, Callbacks, CatalogLinks, Clone, Conf, Config, CustomCSS, DataBoard, DeleteLink, Dice, DownloadLink, Emoji, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Fourchan, Gallery, Get, Header, IDColor, ImageExpand, ImageHover, ImageLoader, Index, Keybinds, Linkify, Main, Menu, Nav, Navigate, Notice, PSAHiding, Polyfill, Post, PostHiding, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, RandomAccessList, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Sauce, Settings, SimpleDict, Thread, ThreadExcerpt, ThreadHiding, ThreadStats, ThreadUpdater, ThreadWatcher, Time, TrashQueue, UI, Unread, Video, c, d, doc, g,
__slice = [].slice, __slice = [].slice,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
__hasProp = {}.hasOwnProperty, __hasProp = {}.hasOwnProperty,
@ -372,7 +372,7 @@
doc = d.documentElement; doc = d.documentElement;
g = { g = {
VERSION: '1.7.19', VERSION: '1.7.20',
NAMESPACE: '4chan X.', NAMESPACE: '4chan X.',
boards: {} boards: {}
}; };
@ -1905,10 +1905,12 @@
a.className = 'current'; a.className = 'current';
} }
cs = $.el('a', { cs = $.el('a', {
id: 'settingsWindowLink',
href: 'javascript:;', href: 'javascript:;',
textContent: 'Catalog Settings' textContent: 'Catalog Settings'
}); });
$.on(cs, 'click', function() {
return $.id('settingsWindowLink').click();
});
if (g.VIEW === 'catalog') { if (g.VIEW === 'catalog') {
_this.addShortcut(cs); _this.addShortcut(cs);
} }
@ -5712,7 +5714,7 @@
return $.rmClass($('.qr-shortcut'), 'disabled'); return $.rmClass($('.qr-shortcut'), 'disabled');
} }
}); });
$.before($.id('postForm'), link); $.before($.id('togglePostForm') || $.id('postForm'), link);
$.on(d, 'QRGetSelectedPost', function(_arg) { $.on(d, 'QRGetSelectedPost', function(_arg) {
var cb; var cb;
cb = _arg.detail; cb = _arg.detail;
@ -11488,183 +11490,10 @@
} }
}; };
InfiniScroll = {
init: function() {
if (!(Conf['Infinite Scrolling'] && g.VIEW === 'index' && g.BOARD !== 'f')) {
return;
}
this.threads = g.threads;
return $.on(d, '4chanXInitFinished', this.ready);
},
ready: function() {
$.off(d, '4chanXInitFinished', InfiniScroll.ready);
$.on(d, 'scroll', InfiniScroll.scroll);
return InfiniScroll.scroll();
},
scroll: $.debounce(100, function() {
var url;
if (InfiniScroll.isFetching || ((d.body.scrollTop || doc.scrollTop) <= doc.scrollHeight - (300 + window.innerHeight))) {
return;
}
if (InfiniScroll.isDead) {
return InfiniScroll.notice();
}
if (InfiniScroll.cache && InfiniScroll.cache.time > Date.now() - $.MINUTE) {
return InfiniScroll.parse(InfiniScroll.cache);
}
new Notice('info', "Fetching next page.", 2);
InfiniScroll.isFetching = true;
url = "//a.4cdn.org/" + g.BOARD + "/catalog.json";
return $.ajax(url, {
onloadend: InfiniScroll.cb.load
}, {
whenModified: true
});
}),
parse: function(response) {
var botPostForm, el, nodes, omitted_images, omitted_posts, op, post, postlink, posts, replylink, thread, threadID, threadNodes, threads, _i, _j, _len, _len1, _ref;
threads = InfiniScroll.parsePages(response);
threadNodes = [];
nodes = [];
if (!threads.length) {
InfiniScroll.notice();
return InfiniScroll.isDead = true;
}
for (_i = 0, _len = threads.length; _i < _len; _i++) {
thread = threads[_i];
posts = [];
omitted_posts = thread.omitted_posts, omitted_images = thread.omitted_images;
threadID = thread.no;
el = $.el('div', {
className: 'thread',
id: "t" + threadID
});
op = Build.postFromObject(thread, g.BOARD);
posts.push(op);
replylink = $.el('a', {
href: "thread/" + threadID,
className: 'replylink',
textContent: 'Reply'
});
postlink = $.el('div', {
className: "postLink mobile",
innerHTML: "<a href=\"thread/" + threadID + "\" class=\"button\">View Thread</a>"
});
if (omitted_posts) {
posts.push($.el('span', {
className: 'summary desktop',
innerHTML: "" + omitted_posts + " posts " + (omitted_images ? "and " + omitted_images + " image replies" : void 0) + " omitted. Click <a class=\"replylink\" href=\"thread/" + threadID + "\">here</a> to view."
}));
$.prepend(postlink, $.el('span', {
className: 'info',
innerHTML: "<strong>" + omitted_posts + " posts omitted</strong>" + (omitted_images ? "<br><em>(" + omitted_images + " have images)</em>" : "")
}));
}
$.add($('.postInfo', op), [$.tn('\u00A0\u00A0\u00A0['), replylink, $.tn(']\u00A0')]);
$.add(op, postlink);
if (thread.last_replies) {
_ref = thread.last_replies;
for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
post = _ref[_j];
posts.push(Build.postFromObject(post, g.BOARD));
}
}
$.add(el, posts);
threadNodes.push(el);
nodes.push(el);
nodes.push($.el('hr'));
}
InfiniScroll.features(threadNodes);
if (botPostForm = $('.board > .mobile.center')) {
return $.before(botPostForm, nodes);
}
},
parsePages: function(response) {
var newThreads, number, page, pages, thread, threads, _i, _len;
pages = JSON.parse(response);
newThreads = [];
for (number in pages) {
page = pages[number];
if (!(pages.hasOwnProperty(number))) {
continue;
}
threads = page.threads;
for (_i = 0, _len = threads.length; _i < _len; _i++) {
thread = threads[_i];
if (g.threads["" + g.BOARD + "." + thread.no]) {
continue;
}
newThreads.push(thread);
if (newThreads.length === 15) {
return newThreads;
}
}
}
return newThreads;
},
features: function(threadNodes) {
var err, errors, post, posts, thread, threadRoot, threads, _i, _j, _len, _len1, _ref;
posts = [];
threads = [];
for (_i = 0, _len = threadNodes.length; _i < _len; _i++) {
threadRoot = threadNodes[_i];
thread = new Thread(+threadRoot.id.slice(1), g.BOARD);
threads.push(thread);
_ref = $$('.thread > .postContainer', threadRoot);
for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
post = _ref[_j];
try {
posts.push(new Post(post, thread, g.BOARD));
} catch (_error) {
err = _error;
if (!errors) {
errors = [];
}
errors.push({
message: "Parsing of Post No." + (postRoot.id.match(/\d+/)) + " failed. Post will be skipped.",
error: err
});
}
}
}
if (errors) {
Main.handleErrors(errors);
}
Main.callbackNodes(Thread, threads);
return Main.callbackNodes(Post, posts);
},
notice: (function() {
var notify, reset;
notify = false;
reset = function() {
return notify = false;
};
return function() {
if (notify) {
return;
}
notify = true;
new Notice('info', "Last page reached.", 2);
return setTimeout(reset, 3 * $.SECOND);
};
})(),
cb: {
load: function() {
InfiniScroll.isFetching = false;
if (this.status !== 200) {
return;
}
InfiniScroll.cache = new String(this.response);
InfiniScroll.cache.time = Date.now();
return InfiniScroll.parse(this.response);
}
}
};
Keybinds = { Keybinds = {
init: function() { init: function() {
var hotkey, init; var hotkey, init;
if (g.VIEW === 'catalog' || !Conf['Keybinds']) { if (!Conf['Keybinds']) {
return; return;
} }
for (hotkey in Conf.hotkeys) { for (hotkey in Conf.hotkeys) {
@ -11696,9 +11525,11 @@
return; return;
} }
} }
threadRoot = Nav.getThread(); if (g.VIEW !== 'catalog') {
if (op = $('.op', threadRoot)) { threadRoot = Nav.getThread();
thread = Get.postFromNode(op).thread; if (op = $('.op', threadRoot)) {
thread = Get.postFromNode(op).thread;
}
} }
switch (key) { switch (key) {
case Conf['Toggle board list']: case Conf['Toggle board list']:
@ -11710,10 +11541,13 @@
Header.toggleBarVisibility(); Header.toggleBarVisibility();
break; break;
case Conf['Open empty QR']: case Conf['Open empty QR']:
Keybinds.qr(threadRoot); Keybinds.qr();
break; break;
case Conf['Open QR']: case Conf['Open QR']:
Keybinds.qr(threadRoot, true); if (g.VIEW === 'catalog') {
return;
}
Keybinds.qr(threadRoot);
break; break;
case Conf['Open settings']: case Conf['Open settings']:
Settings.open(); Settings.open();
@ -11780,23 +11614,41 @@
} }
break; break;
case Conf['Watch']: case Conf['Watch']:
if (g.VIEW === 'catalog') {
return;
}
ThreadWatcher.toggle(thread); ThreadWatcher.toggle(thread);
break; break;
case Conf['Expand image']: case Conf['Expand image']:
if (g.VIEW === 'catalog') {
return;
}
Keybinds.img(threadRoot); Keybinds.img(threadRoot);
break; break;
case Conf['Expand images']: case Conf['Expand images']:
if (g.VIEW === 'catalog') {
return;
}
Keybinds.img(threadRoot, true); Keybinds.img(threadRoot, true);
break; break;
case Conf['Open Gallery']: case Conf['Open Gallery']:
if (g.VIEW === 'catalog') {
return;
}
Gallery.cb.toggle(); Gallery.cb.toggle();
break; break;
case Conf['fappeTyme']: case Conf['fappeTyme']:
if (g.VIEW === 'catalog') {
return;
}
FappeTyme.cb.toggle.call({ FappeTyme.cb.toggle.call({
name: 'fappe' name: 'fappe'
}); });
break; break;
case Conf['werkTyme']: case Conf['werkTyme']:
if (g.VIEW === 'catalog') {
return;
}
FappeTyme.cb.toggle.call({ FappeTyme.cb.toggle.call({
name: 'werk' name: 'werk'
}); });
@ -11840,6 +11692,9 @@
} }
break; break;
case Conf['Search form']: case Conf['Search form']:
if (g.VIEW !== 'index') {
return;
}
searchInput = Conf['JSON Navigation'] ? Index.searchInput : $.id('search-box'); searchInput = Conf['JSON Navigation'] ? Index.searchInput : $.id('search-box');
Header.scrollToIfNeeded(searchInput); Header.scrollToIfNeeded(searchInput);
searchInput.focus(); searchInput.focus();
@ -11864,32 +11719,59 @@
Nav.scroll(-1); Nav.scroll(-1);
break; break;
case Conf['Expand thread']: case Conf['Expand thread']:
if (g.VIEW !== 'index') {
return;
}
ExpandThread.toggle(thread); ExpandThread.toggle(thread);
break; break;
case Conf['Open thread']: case Conf['Open thread']:
if (g.VIEW !== 'index') {
return;
}
Keybinds.open(thread); Keybinds.open(thread);
break; break;
case Conf['Open thread tab']: case Conf['Open thread tab']:
if (g.VIEW !== 'index') {
return;
}
Keybinds.open(thread, true); Keybinds.open(thread, true);
break; break;
case Conf['Next reply']: case Conf['Next reply']:
if (g.VIEW === 'catalog') {
return;
}
Keybinds.hl(+1, threadRoot); Keybinds.hl(+1, threadRoot);
break; break;
case Conf['Previous reply']: case Conf['Previous reply']:
if (g.VIEW === 'catalog') {
return;
}
Keybinds.hl(-1, threadRoot); Keybinds.hl(-1, threadRoot);
break; break;
case Conf['Deselect reply']: case Conf['Deselect reply']:
if (g.VIEW === 'catalog') {
return;
}
Keybinds.hl(0, threadRoot); Keybinds.hl(0, threadRoot);
break; break;
case Conf['Hide']: case Conf['Hide']:
if (g.VIEW === 'catalog') {
return;
}
if (ThreadHiding.db) { if (ThreadHiding.db) {
ThreadHiding.toggle(thread); ThreadHiding.toggle(thread);
} }
break; break;
case Conf['Previous Post Quoting You']: case Conf['Previous Post Quoting You']:
if (g.VIEW === 'catalog') {
return;
}
QuoteYou.cb.seek('preceding'); QuoteYou.cb.seek('preceding');
break; break;
case Conf['Next Post Quoting You']: case Conf['Next Post Quoting You']:
if (g.VIEW === 'catalog') {
return;
}
QuoteYou.cb.seek('following'); QuoteYou.cb.seek('following');
break; break;
default: default:
@ -11940,12 +11822,12 @@
} }
return key; return key;
}, },
qr: function(thread, quote) { qr: function(thread) {
if (!(Conf['Quick Reply'] && QR.postingIsEnabled)) { if (!(Conf['Quick Reply'] && QR.postingIsEnabled)) {
return; return;
} }
QR.open(); QR.open();
if (quote) { if (thread != null) {
QR.quote.call($('input', $('.post.highlight', thread) || thread)); QR.quote.call($('input', $('.post.highlight', thread) || thread));
} }
QR.nodes.com.focus(); QR.nodes.com.focus();
@ -13589,6 +13471,8 @@
Main.callbackNodesDB(Post, posts, function() { Main.callbackNodesDB(Post, posts, function() {
return $.event('4chanXInitFinished'); return $.event('4chanXInitFinished');
}); });
} else {
$.event('4chanXInitFinished');
} }
return $.get('previousversion', null, function(_arg) { return $.get('previousversion', null, function(_arg) {
var changelog, el, previousversion; var changelog, el, previousversion;

Binary file not shown.

View File

@ -1,6 +1,6 @@
{ {
"name": "4chan X", "name": "4chan X",
"version": "1.7.19", "version": "1.7.20",
"manifest_version": 2, "manifest_version": 2,
"description": "Cross-browser userscript for maximum lurking on 4chan.", "description": "Cross-browser userscript for maximum lurking on 4chan.",
"icons": { "icons": {

View File

@ -1,6 +1,6 @@
// Generated by CoffeeScript // Generated by CoffeeScript
/* /*
* 4chan X - Version 1.7.19 - 2014-04-25 * 4chan X - Version 1.7.20 - 2014-04-27
* *
* 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
@ -82,7 +82,7 @@
'use strict'; 'use strict';
(function() { (function() {
var $, $$, Anonymize, ArchiveLink, AutoGIF, Banner, Board, Build, Callbacks, CatalogLinks, Clone, Conf, Config, CustomCSS, DataBoard, DeleteLink, Dice, DownloadLink, Emoji, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Fourchan, Gallery, Get, Header, IDColor, ImageExpand, ImageHover, ImageLoader, Index, InfiniScroll, Keybinds, Linkify, Main, Menu, Nav, Navigate, Notice, PSAHiding, Polyfill, Post, PostHiding, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, RandomAccessList, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Sauce, Settings, SimpleDict, Thread, ThreadExcerpt, ThreadHiding, ThreadStats, ThreadUpdater, ThreadWatcher, Time, TrashQueue, UI, Unread, Video, c, d, doc, g, var $, $$, Anonymize, ArchiveLink, AutoGIF, Banner, Board, Build, Callbacks, CatalogLinks, Clone, Conf, Config, CustomCSS, DataBoard, DeleteLink, Dice, DownloadLink, Emoji, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Fourchan, Gallery, Get, Header, IDColor, ImageExpand, ImageHover, ImageLoader, Index, Keybinds, Linkify, Main, Menu, Nav, Navigate, Notice, PSAHiding, Polyfill, Post, PostHiding, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, RandomAccessList, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Sauce, Settings, SimpleDict, Thread, ThreadExcerpt, ThreadHiding, ThreadStats, ThreadUpdater, ThreadWatcher, Time, TrashQueue, UI, Unread, Video, c, d, doc, g,
__slice = [].slice, __slice = [].slice,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
__hasProp = {}.hasOwnProperty, __hasProp = {}.hasOwnProperty,
@ -348,7 +348,7 @@
doc = d.documentElement; doc = d.documentElement;
g = { g = {
VERSION: '1.7.19', VERSION: '1.7.20',
NAMESPACE: '4chan X.', NAMESPACE: '4chan X.',
boards: {} boards: {}
}; };
@ -1946,10 +1946,12 @@
a.className = 'current'; a.className = 'current';
} }
cs = $.el('a', { cs = $.el('a', {
id: 'settingsWindowLink',
href: 'javascript:;', href: 'javascript:;',
textContent: 'Catalog Settings' textContent: 'Catalog Settings'
}); });
$.on(cs, 'click', function() {
return $.id('settingsWindowLink').click();
});
if (g.VIEW === 'catalog') { if (g.VIEW === 'catalog') {
_this.addShortcut(cs); _this.addShortcut(cs);
} }
@ -5746,7 +5748,7 @@
return $.rmClass($('.qr-shortcut'), 'disabled'); return $.rmClass($('.qr-shortcut'), 'disabled');
} }
}); });
$.before($.id('postForm'), link); $.before($.id('togglePostForm') || $.id('postForm'), link);
$.on(d, 'QRGetSelectedPost', function(_arg) { $.on(d, 'QRGetSelectedPost', function(_arg) {
var cb; var cb;
cb = _arg.detail; cb = _arg.detail;
@ -11491,183 +11493,10 @@
} }
}; };
InfiniScroll = {
init: function() {
if (!(Conf['Infinite Scrolling'] && g.VIEW === 'index' && g.BOARD !== 'f')) {
return;
}
this.threads = g.threads;
return $.on(d, '4chanXInitFinished', this.ready);
},
ready: function() {
$.off(d, '4chanXInitFinished', InfiniScroll.ready);
$.on(d, 'scroll', InfiniScroll.scroll);
return InfiniScroll.scroll();
},
scroll: $.debounce(100, function() {
var url;
if (InfiniScroll.isFetching || ((d.body.scrollTop || doc.scrollTop) <= doc.scrollHeight - (300 + window.innerHeight))) {
return;
}
if (InfiniScroll.isDead) {
return InfiniScroll.notice();
}
if (InfiniScroll.cache && InfiniScroll.cache.time > Date.now() - $.MINUTE) {
return InfiniScroll.parse(InfiniScroll.cache);
}
new Notice('info', "Fetching next page.", 2);
InfiniScroll.isFetching = true;
url = "//a.4cdn.org/" + g.BOARD + "/catalog.json";
return $.ajax(url, {
onloadend: InfiniScroll.cb.load
}, {
whenModified: true
});
}),
parse: function(response) {
var botPostForm, el, nodes, omitted_images, omitted_posts, op, post, postlink, posts, replylink, thread, threadID, threadNodes, threads, _i, _j, _len, _len1, _ref;
threads = InfiniScroll.parsePages(response);
threadNodes = [];
nodes = [];
if (!threads.length) {
InfiniScroll.notice();
return InfiniScroll.isDead = true;
}
for (_i = 0, _len = threads.length; _i < _len; _i++) {
thread = threads[_i];
posts = [];
omitted_posts = thread.omitted_posts, omitted_images = thread.omitted_images;
threadID = thread.no;
el = $.el('div', {
className: 'thread',
id: "t" + threadID
});
op = Build.postFromObject(thread, g.BOARD);
posts.push(op);
replylink = $.el('a', {
href: "thread/" + threadID,
className: 'replylink',
textContent: 'Reply'
});
postlink = $.el('div', {
className: "postLink mobile",
innerHTML: "<a href=\"thread/" + threadID + "\" class=\"button\">View Thread</a>"
});
if (omitted_posts) {
posts.push($.el('span', {
className: 'summary desktop',
innerHTML: "" + omitted_posts + " posts " + (omitted_images ? "and " + omitted_images + " image replies" : void 0) + " omitted. Click <a class=\"replylink\" href=\"thread/" + threadID + "\">here</a> to view."
}));
$.prepend(postlink, $.el('span', {
className: 'info',
innerHTML: "<strong>" + omitted_posts + " posts omitted</strong>" + (omitted_images ? "<br><em>(" + omitted_images + " have images)</em>" : "")
}));
}
$.add($('.postInfo', op), [$.tn('\u00A0\u00A0\u00A0['), replylink, $.tn(']\u00A0')]);
$.add(op, postlink);
if (thread.last_replies) {
_ref = thread.last_replies;
for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
post = _ref[_j];
posts.push(Build.postFromObject(post, g.BOARD));
}
}
$.add(el, posts);
threadNodes.push(el);
nodes.push(el);
nodes.push($.el('hr'));
}
InfiniScroll.features(threadNodes);
if (botPostForm = $('.board > .mobile.center')) {
return $.before(botPostForm, nodes);
}
},
parsePages: function(response) {
var newThreads, number, page, pages, thread, threads, _i, _len;
pages = JSON.parse(response);
newThreads = [];
for (number in pages) {
page = pages[number];
if (!(pages.hasOwnProperty(number))) {
continue;
}
threads = page.threads;
for (_i = 0, _len = threads.length; _i < _len; _i++) {
thread = threads[_i];
if (g.threads["" + g.BOARD + "." + thread.no]) {
continue;
}
newThreads.push(thread);
if (newThreads.length === 15) {
return newThreads;
}
}
}
return newThreads;
},
features: function(threadNodes) {
var err, errors, post, posts, thread, threadRoot, threads, _i, _j, _len, _len1, _ref;
posts = [];
threads = [];
for (_i = 0, _len = threadNodes.length; _i < _len; _i++) {
threadRoot = threadNodes[_i];
thread = new Thread(+threadRoot.id.slice(1), g.BOARD);
threads.push(thread);
_ref = $$('.thread > .postContainer', threadRoot);
for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
post = _ref[_j];
try {
posts.push(new Post(post, thread, g.BOARD));
} catch (_error) {
err = _error;
if (!errors) {
errors = [];
}
errors.push({
message: "Parsing of Post No." + (postRoot.id.match(/\d+/)) + " failed. Post will be skipped.",
error: err
});
}
}
}
if (errors) {
Main.handleErrors(errors);
}
Main.callbackNodes(Thread, threads);
return Main.callbackNodes(Post, posts);
},
notice: (function() {
var notify, reset;
notify = false;
reset = function() {
return notify = false;
};
return function() {
if (notify) {
return;
}
notify = true;
new Notice('info', "Last page reached.", 2);
return setTimeout(reset, 3 * $.SECOND);
};
})(),
cb: {
load: function() {
InfiniScroll.isFetching = false;
if (this.status !== 200) {
return;
}
InfiniScroll.cache = new String(this.response);
InfiniScroll.cache.time = Date.now();
return InfiniScroll.parse(this.response);
}
}
};
Keybinds = { Keybinds = {
init: function() { init: function() {
var hotkey, init; var hotkey, init;
if (g.VIEW === 'catalog' || !Conf['Keybinds']) { if (!Conf['Keybinds']) {
return; return;
} }
for (hotkey in Conf.hotkeys) { for (hotkey in Conf.hotkeys) {
@ -11699,9 +11528,11 @@
return; return;
} }
} }
threadRoot = Nav.getThread(); if (g.VIEW !== 'catalog') {
if (op = $('.op', threadRoot)) { threadRoot = Nav.getThread();
thread = Get.postFromNode(op).thread; if (op = $('.op', threadRoot)) {
thread = Get.postFromNode(op).thread;
}
} }
switch (key) { switch (key) {
case Conf['Toggle board list']: case Conf['Toggle board list']:
@ -11713,10 +11544,13 @@
Header.toggleBarVisibility(); Header.toggleBarVisibility();
break; break;
case Conf['Open empty QR']: case Conf['Open empty QR']:
Keybinds.qr(threadRoot); Keybinds.qr();
break; break;
case Conf['Open QR']: case Conf['Open QR']:
Keybinds.qr(threadRoot, true); if (g.VIEW === 'catalog') {
return;
}
Keybinds.qr(threadRoot);
break; break;
case Conf['Open settings']: case Conf['Open settings']:
Settings.open(); Settings.open();
@ -11783,23 +11617,41 @@
} }
break; break;
case Conf['Watch']: case Conf['Watch']:
if (g.VIEW === 'catalog') {
return;
}
ThreadWatcher.toggle(thread); ThreadWatcher.toggle(thread);
break; break;
case Conf['Expand image']: case Conf['Expand image']:
if (g.VIEW === 'catalog') {
return;
}
Keybinds.img(threadRoot); Keybinds.img(threadRoot);
break; break;
case Conf['Expand images']: case Conf['Expand images']:
if (g.VIEW === 'catalog') {
return;
}
Keybinds.img(threadRoot, true); Keybinds.img(threadRoot, true);
break; break;
case Conf['Open Gallery']: case Conf['Open Gallery']:
if (g.VIEW === 'catalog') {
return;
}
Gallery.cb.toggle(); Gallery.cb.toggle();
break; break;
case Conf['fappeTyme']: case Conf['fappeTyme']:
if (g.VIEW === 'catalog') {
return;
}
FappeTyme.cb.toggle.call({ FappeTyme.cb.toggle.call({
name: 'fappe' name: 'fappe'
}); });
break; break;
case Conf['werkTyme']: case Conf['werkTyme']:
if (g.VIEW === 'catalog') {
return;
}
FappeTyme.cb.toggle.call({ FappeTyme.cb.toggle.call({
name: 'werk' name: 'werk'
}); });
@ -11843,6 +11695,9 @@
} }
break; break;
case Conf['Search form']: case Conf['Search form']:
if (g.VIEW !== 'index') {
return;
}
searchInput = Conf['JSON Navigation'] ? Index.searchInput : $.id('search-box'); searchInput = Conf['JSON Navigation'] ? Index.searchInput : $.id('search-box');
Header.scrollToIfNeeded(searchInput); Header.scrollToIfNeeded(searchInput);
searchInput.focus(); searchInput.focus();
@ -11867,32 +11722,59 @@
Nav.scroll(-1); Nav.scroll(-1);
break; break;
case Conf['Expand thread']: case Conf['Expand thread']:
if (g.VIEW !== 'index') {
return;
}
ExpandThread.toggle(thread); ExpandThread.toggle(thread);
break; break;
case Conf['Open thread']: case Conf['Open thread']:
if (g.VIEW !== 'index') {
return;
}
Keybinds.open(thread); Keybinds.open(thread);
break; break;
case Conf['Open thread tab']: case Conf['Open thread tab']:
if (g.VIEW !== 'index') {
return;
}
Keybinds.open(thread, true); Keybinds.open(thread, true);
break; break;
case Conf['Next reply']: case Conf['Next reply']:
if (g.VIEW === 'catalog') {
return;
}
Keybinds.hl(+1, threadRoot); Keybinds.hl(+1, threadRoot);
break; break;
case Conf['Previous reply']: case Conf['Previous reply']:
if (g.VIEW === 'catalog') {
return;
}
Keybinds.hl(-1, threadRoot); Keybinds.hl(-1, threadRoot);
break; break;
case Conf['Deselect reply']: case Conf['Deselect reply']:
if (g.VIEW === 'catalog') {
return;
}
Keybinds.hl(0, threadRoot); Keybinds.hl(0, threadRoot);
break; break;
case Conf['Hide']: case Conf['Hide']:
if (g.VIEW === 'catalog') {
return;
}
if (ThreadHiding.db) { if (ThreadHiding.db) {
ThreadHiding.toggle(thread); ThreadHiding.toggle(thread);
} }
break; break;
case Conf['Previous Post Quoting You']: case Conf['Previous Post Quoting You']:
if (g.VIEW === 'catalog') {
return;
}
QuoteYou.cb.seek('preceding'); QuoteYou.cb.seek('preceding');
break; break;
case Conf['Next Post Quoting You']: case Conf['Next Post Quoting You']:
if (g.VIEW === 'catalog') {
return;
}
QuoteYou.cb.seek('following'); QuoteYou.cb.seek('following');
break; break;
default: default:
@ -11943,12 +11825,12 @@
} }
return key; return key;
}, },
qr: function(thread, quote) { qr: function(thread) {
if (!(Conf['Quick Reply'] && QR.postingIsEnabled)) { if (!(Conf['Quick Reply'] && QR.postingIsEnabled)) {
return; return;
} }
QR.open(); QR.open();
if (quote) { if (thread != null) {
QR.quote.call($('input', $('.post.highlight', thread) || thread)); QR.quote.call($('input', $('.post.highlight', thread) || thread));
} }
QR.nodes.com.focus(); QR.nodes.com.focus();
@ -13574,6 +13456,8 @@
Main.callbackNodesDB(Post, posts, function() { Main.callbackNodesDB(Post, posts, function() {
return $.event('4chanXInitFinished'); return $.event('4chanXInitFinished');
}); });
} else {
$.event('4chanXInitFinished');
} }
return $.get('previousversion', null, function(_arg) { return $.get('previousversion', null, function(_arg) {
var changelog, el, previousversion; var changelog, el, previousversion;

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/crx.crx' version='1.7.19' /> <updatecheck codebase='https://ccd0.github.io/4chan-x/builds/crx.crx' version='1.7.20' />
</app> </app>
</gupdate> </gupdate>

View File

@ -1,6 +1,6 @@
{ {
"name": "4chan-X", "name": "4chan-X",
"version": "1.7.19", "version": "1.7.20",
"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",