Release 4chan X v1.7.20.
This commit is contained in:
parent
9bae0f28ac
commit
d6f9d136b0
@ -1,3 +1,6 @@
|
||||
### v1.7.20
|
||||
*2014-04-27*
|
||||
|
||||
**ccd0**
|
||||
- Fix features broken/disabled in catalog: settings link, thread watcher, start thread button, and keybinds.
|
||||
|
||||
|
||||
2
LICENSE
2
LICENSE
@ -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.
|
||||
* https://github.com/ccd0/4chan-x/blob/master/LICENSE
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// ==UserScript==
|
||||
// @name 4chan X
|
||||
// @version 1.7.19
|
||||
// @version 1.7.20
|
||||
// @minGMVer 1.14
|
||||
// @minFFVer 26
|
||||
// @namespace 4chan-X
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// Generated by CoffeeScript
|
||||
// ==UserScript==
|
||||
// @name 4chan X
|
||||
// @version 1.7.19
|
||||
// @version 1.7.20
|
||||
// @minGMVer 1.14
|
||||
// @minFFVer 26
|
||||
// @namespace 4chan-X
|
||||
@ -24,7 +24,7 @@
|
||||
// ==/UserScript==
|
||||
|
||||
/*
|
||||
* 4chan X - Version 1.7.19 - 2014-04-25
|
||||
* 4chan X - Version 1.7.20 - 2014-04-27
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/ccd0/4chan-x/blob/master/LICENSE
|
||||
@ -106,7 +106,7 @@
|
||||
'use strict';
|
||||
|
||||
(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,
|
||||
__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,
|
||||
@ -372,7 +372,7 @@
|
||||
doc = d.documentElement;
|
||||
|
||||
g = {
|
||||
VERSION: '1.7.19',
|
||||
VERSION: '1.7.20',
|
||||
NAMESPACE: '4chan X.',
|
||||
boards: {}
|
||||
};
|
||||
@ -1905,10 +1905,12 @@
|
||||
a.className = 'current';
|
||||
}
|
||||
cs = $.el('a', {
|
||||
id: 'settingsWindowLink',
|
||||
href: 'javascript:;',
|
||||
textContent: 'Catalog Settings'
|
||||
});
|
||||
$.on(cs, 'click', function() {
|
||||
return $.id('settingsWindowLink').click();
|
||||
});
|
||||
if (g.VIEW === 'catalog') {
|
||||
_this.addShortcut(cs);
|
||||
}
|
||||
@ -5712,7 +5714,7 @@
|
||||
return $.rmClass($('.qr-shortcut'), 'disabled');
|
||||
}
|
||||
});
|
||||
$.before($.id('postForm'), link);
|
||||
$.before($.id('togglePostForm') || $.id('postForm'), link);
|
||||
$.on(d, 'QRGetSelectedPost', function(_arg) {
|
||||
var cb;
|
||||
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 = {
|
||||
init: function() {
|
||||
var hotkey, init;
|
||||
if (g.VIEW === 'catalog' || !Conf['Keybinds']) {
|
||||
if (!Conf['Keybinds']) {
|
||||
return;
|
||||
}
|
||||
for (hotkey in Conf.hotkeys) {
|
||||
@ -11696,9 +11525,11 @@
|
||||
return;
|
||||
}
|
||||
}
|
||||
threadRoot = Nav.getThread();
|
||||
if (op = $('.op', threadRoot)) {
|
||||
thread = Get.postFromNode(op).thread;
|
||||
if (g.VIEW !== 'catalog') {
|
||||
threadRoot = Nav.getThread();
|
||||
if (op = $('.op', threadRoot)) {
|
||||
thread = Get.postFromNode(op).thread;
|
||||
}
|
||||
}
|
||||
switch (key) {
|
||||
case Conf['Toggle board list']:
|
||||
@ -11710,10 +11541,13 @@
|
||||
Header.toggleBarVisibility();
|
||||
break;
|
||||
case Conf['Open empty QR']:
|
||||
Keybinds.qr(threadRoot);
|
||||
Keybinds.qr();
|
||||
break;
|
||||
case Conf['Open QR']:
|
||||
Keybinds.qr(threadRoot, true);
|
||||
if (g.VIEW === 'catalog') {
|
||||
return;
|
||||
}
|
||||
Keybinds.qr(threadRoot);
|
||||
break;
|
||||
case Conf['Open settings']:
|
||||
Settings.open();
|
||||
@ -11780,23 +11614,41 @@
|
||||
}
|
||||
break;
|
||||
case Conf['Watch']:
|
||||
if (g.VIEW === 'catalog') {
|
||||
return;
|
||||
}
|
||||
ThreadWatcher.toggle(thread);
|
||||
break;
|
||||
case Conf['Expand image']:
|
||||
if (g.VIEW === 'catalog') {
|
||||
return;
|
||||
}
|
||||
Keybinds.img(threadRoot);
|
||||
break;
|
||||
case Conf['Expand images']:
|
||||
if (g.VIEW === 'catalog') {
|
||||
return;
|
||||
}
|
||||
Keybinds.img(threadRoot, true);
|
||||
break;
|
||||
case Conf['Open Gallery']:
|
||||
if (g.VIEW === 'catalog') {
|
||||
return;
|
||||
}
|
||||
Gallery.cb.toggle();
|
||||
break;
|
||||
case Conf['fappeTyme']:
|
||||
if (g.VIEW === 'catalog') {
|
||||
return;
|
||||
}
|
||||
FappeTyme.cb.toggle.call({
|
||||
name: 'fappe'
|
||||
});
|
||||
break;
|
||||
case Conf['werkTyme']:
|
||||
if (g.VIEW === 'catalog') {
|
||||
return;
|
||||
}
|
||||
FappeTyme.cb.toggle.call({
|
||||
name: 'werk'
|
||||
});
|
||||
@ -11840,6 +11692,9 @@
|
||||
}
|
||||
break;
|
||||
case Conf['Search form']:
|
||||
if (g.VIEW !== 'index') {
|
||||
return;
|
||||
}
|
||||
searchInput = Conf['JSON Navigation'] ? Index.searchInput : $.id('search-box');
|
||||
Header.scrollToIfNeeded(searchInput);
|
||||
searchInput.focus();
|
||||
@ -11864,32 +11719,59 @@
|
||||
Nav.scroll(-1);
|
||||
break;
|
||||
case Conf['Expand thread']:
|
||||
if (g.VIEW !== 'index') {
|
||||
return;
|
||||
}
|
||||
ExpandThread.toggle(thread);
|
||||
break;
|
||||
case Conf['Open thread']:
|
||||
if (g.VIEW !== 'index') {
|
||||
return;
|
||||
}
|
||||
Keybinds.open(thread);
|
||||
break;
|
||||
case Conf['Open thread tab']:
|
||||
if (g.VIEW !== 'index') {
|
||||
return;
|
||||
}
|
||||
Keybinds.open(thread, true);
|
||||
break;
|
||||
case Conf['Next reply']:
|
||||
if (g.VIEW === 'catalog') {
|
||||
return;
|
||||
}
|
||||
Keybinds.hl(+1, threadRoot);
|
||||
break;
|
||||
case Conf['Previous reply']:
|
||||
if (g.VIEW === 'catalog') {
|
||||
return;
|
||||
}
|
||||
Keybinds.hl(-1, threadRoot);
|
||||
break;
|
||||
case Conf['Deselect reply']:
|
||||
if (g.VIEW === 'catalog') {
|
||||
return;
|
||||
}
|
||||
Keybinds.hl(0, threadRoot);
|
||||
break;
|
||||
case Conf['Hide']:
|
||||
if (g.VIEW === 'catalog') {
|
||||
return;
|
||||
}
|
||||
if (ThreadHiding.db) {
|
||||
ThreadHiding.toggle(thread);
|
||||
}
|
||||
break;
|
||||
case Conf['Previous Post Quoting You']:
|
||||
if (g.VIEW === 'catalog') {
|
||||
return;
|
||||
}
|
||||
QuoteYou.cb.seek('preceding');
|
||||
break;
|
||||
case Conf['Next Post Quoting You']:
|
||||
if (g.VIEW === 'catalog') {
|
||||
return;
|
||||
}
|
||||
QuoteYou.cb.seek('following');
|
||||
break;
|
||||
default:
|
||||
@ -11940,12 +11822,12 @@
|
||||
}
|
||||
return key;
|
||||
},
|
||||
qr: function(thread, quote) {
|
||||
qr: function(thread) {
|
||||
if (!(Conf['Quick Reply'] && QR.postingIsEnabled)) {
|
||||
return;
|
||||
}
|
||||
QR.open();
|
||||
if (quote) {
|
||||
if (thread != null) {
|
||||
QR.quote.call($('input', $('.post.highlight', thread) || thread));
|
||||
}
|
||||
QR.nodes.com.focus();
|
||||
@ -13589,6 +13471,8 @@
|
||||
Main.callbackNodesDB(Post, posts, function() {
|
||||
return $.event('4chanXInitFinished');
|
||||
});
|
||||
} else {
|
||||
$.event('4chanXInitFinished');
|
||||
}
|
||||
return $.get('previousversion', null, function(_arg) {
|
||||
var changelog, el, previousversion;
|
||||
|
||||
BIN
builds/crx.crx
BIN
builds/crx.crx
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "4chan X",
|
||||
"version": "1.7.19",
|
||||
"version": "1.7.20",
|
||||
"manifest_version": 2,
|
||||
"description": "Cross-browser userscript for maximum lurking on 4chan.",
|
||||
"icons": {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// 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.
|
||||
* https://github.com/ccd0/4chan-x/blob/master/LICENSE
|
||||
@ -82,7 +82,7 @@
|
||||
'use strict';
|
||||
|
||||
(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,
|
||||
__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,
|
||||
@ -348,7 +348,7 @@
|
||||
doc = d.documentElement;
|
||||
|
||||
g = {
|
||||
VERSION: '1.7.19',
|
||||
VERSION: '1.7.20',
|
||||
NAMESPACE: '4chan X.',
|
||||
boards: {}
|
||||
};
|
||||
@ -1946,10 +1946,12 @@
|
||||
a.className = 'current';
|
||||
}
|
||||
cs = $.el('a', {
|
||||
id: 'settingsWindowLink',
|
||||
href: 'javascript:;',
|
||||
textContent: 'Catalog Settings'
|
||||
});
|
||||
$.on(cs, 'click', function() {
|
||||
return $.id('settingsWindowLink').click();
|
||||
});
|
||||
if (g.VIEW === 'catalog') {
|
||||
_this.addShortcut(cs);
|
||||
}
|
||||
@ -5746,7 +5748,7 @@
|
||||
return $.rmClass($('.qr-shortcut'), 'disabled');
|
||||
}
|
||||
});
|
||||
$.before($.id('postForm'), link);
|
||||
$.before($.id('togglePostForm') || $.id('postForm'), link);
|
||||
$.on(d, 'QRGetSelectedPost', function(_arg) {
|
||||
var cb;
|
||||
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 = {
|
||||
init: function() {
|
||||
var hotkey, init;
|
||||
if (g.VIEW === 'catalog' || !Conf['Keybinds']) {
|
||||
if (!Conf['Keybinds']) {
|
||||
return;
|
||||
}
|
||||
for (hotkey in Conf.hotkeys) {
|
||||
@ -11699,9 +11528,11 @@
|
||||
return;
|
||||
}
|
||||
}
|
||||
threadRoot = Nav.getThread();
|
||||
if (op = $('.op', threadRoot)) {
|
||||
thread = Get.postFromNode(op).thread;
|
||||
if (g.VIEW !== 'catalog') {
|
||||
threadRoot = Nav.getThread();
|
||||
if (op = $('.op', threadRoot)) {
|
||||
thread = Get.postFromNode(op).thread;
|
||||
}
|
||||
}
|
||||
switch (key) {
|
||||
case Conf['Toggle board list']:
|
||||
@ -11713,10 +11544,13 @@
|
||||
Header.toggleBarVisibility();
|
||||
break;
|
||||
case Conf['Open empty QR']:
|
||||
Keybinds.qr(threadRoot);
|
||||
Keybinds.qr();
|
||||
break;
|
||||
case Conf['Open QR']:
|
||||
Keybinds.qr(threadRoot, true);
|
||||
if (g.VIEW === 'catalog') {
|
||||
return;
|
||||
}
|
||||
Keybinds.qr(threadRoot);
|
||||
break;
|
||||
case Conf['Open settings']:
|
||||
Settings.open();
|
||||
@ -11783,23 +11617,41 @@
|
||||
}
|
||||
break;
|
||||
case Conf['Watch']:
|
||||
if (g.VIEW === 'catalog') {
|
||||
return;
|
||||
}
|
||||
ThreadWatcher.toggle(thread);
|
||||
break;
|
||||
case Conf['Expand image']:
|
||||
if (g.VIEW === 'catalog') {
|
||||
return;
|
||||
}
|
||||
Keybinds.img(threadRoot);
|
||||
break;
|
||||
case Conf['Expand images']:
|
||||
if (g.VIEW === 'catalog') {
|
||||
return;
|
||||
}
|
||||
Keybinds.img(threadRoot, true);
|
||||
break;
|
||||
case Conf['Open Gallery']:
|
||||
if (g.VIEW === 'catalog') {
|
||||
return;
|
||||
}
|
||||
Gallery.cb.toggle();
|
||||
break;
|
||||
case Conf['fappeTyme']:
|
||||
if (g.VIEW === 'catalog') {
|
||||
return;
|
||||
}
|
||||
FappeTyme.cb.toggle.call({
|
||||
name: 'fappe'
|
||||
});
|
||||
break;
|
||||
case Conf['werkTyme']:
|
||||
if (g.VIEW === 'catalog') {
|
||||
return;
|
||||
}
|
||||
FappeTyme.cb.toggle.call({
|
||||
name: 'werk'
|
||||
});
|
||||
@ -11843,6 +11695,9 @@
|
||||
}
|
||||
break;
|
||||
case Conf['Search form']:
|
||||
if (g.VIEW !== 'index') {
|
||||
return;
|
||||
}
|
||||
searchInput = Conf['JSON Navigation'] ? Index.searchInput : $.id('search-box');
|
||||
Header.scrollToIfNeeded(searchInput);
|
||||
searchInput.focus();
|
||||
@ -11867,32 +11722,59 @@
|
||||
Nav.scroll(-1);
|
||||
break;
|
||||
case Conf['Expand thread']:
|
||||
if (g.VIEW !== 'index') {
|
||||
return;
|
||||
}
|
||||
ExpandThread.toggle(thread);
|
||||
break;
|
||||
case Conf['Open thread']:
|
||||
if (g.VIEW !== 'index') {
|
||||
return;
|
||||
}
|
||||
Keybinds.open(thread);
|
||||
break;
|
||||
case Conf['Open thread tab']:
|
||||
if (g.VIEW !== 'index') {
|
||||
return;
|
||||
}
|
||||
Keybinds.open(thread, true);
|
||||
break;
|
||||
case Conf['Next reply']:
|
||||
if (g.VIEW === 'catalog') {
|
||||
return;
|
||||
}
|
||||
Keybinds.hl(+1, threadRoot);
|
||||
break;
|
||||
case Conf['Previous reply']:
|
||||
if (g.VIEW === 'catalog') {
|
||||
return;
|
||||
}
|
||||
Keybinds.hl(-1, threadRoot);
|
||||
break;
|
||||
case Conf['Deselect reply']:
|
||||
if (g.VIEW === 'catalog') {
|
||||
return;
|
||||
}
|
||||
Keybinds.hl(0, threadRoot);
|
||||
break;
|
||||
case Conf['Hide']:
|
||||
if (g.VIEW === 'catalog') {
|
||||
return;
|
||||
}
|
||||
if (ThreadHiding.db) {
|
||||
ThreadHiding.toggle(thread);
|
||||
}
|
||||
break;
|
||||
case Conf['Previous Post Quoting You']:
|
||||
if (g.VIEW === 'catalog') {
|
||||
return;
|
||||
}
|
||||
QuoteYou.cb.seek('preceding');
|
||||
break;
|
||||
case Conf['Next Post Quoting You']:
|
||||
if (g.VIEW === 'catalog') {
|
||||
return;
|
||||
}
|
||||
QuoteYou.cb.seek('following');
|
||||
break;
|
||||
default:
|
||||
@ -11943,12 +11825,12 @@
|
||||
}
|
||||
return key;
|
||||
},
|
||||
qr: function(thread, quote) {
|
||||
qr: function(thread) {
|
||||
if (!(Conf['Quick Reply'] && QR.postingIsEnabled)) {
|
||||
return;
|
||||
}
|
||||
QR.open();
|
||||
if (quote) {
|
||||
if (thread != null) {
|
||||
QR.quote.call($('input', $('.post.highlight', thread) || thread));
|
||||
}
|
||||
QR.nodes.com.focus();
|
||||
@ -13574,6 +13456,8 @@
|
||||
Main.callbackNodesDB(Post, posts, function() {
|
||||
return $.event('4chanXInitFinished');
|
||||
});
|
||||
} else {
|
||||
$.event('4chanXInitFinished');
|
||||
}
|
||||
return $.get('previousversion', null, function(_arg) {
|
||||
var changelog, el, previousversion;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
|
||||
<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>
|
||||
</gupdate>
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "4chan-X",
|
||||
"version": "1.7.19",
|
||||
"version": "1.7.20",
|
||||
"description": "Cross-browser userscript for maximum lurking on 4chan.",
|
||||
"meta": {
|
||||
"name": "4chan X",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user