Release 4chan X v1.11.24.0.

This commit is contained in:
ccd0 2016-01-31 21:45:36 -08:00
parent 711d1914e4
commit 94502f64cb
13 changed files with 787 additions and 513 deletions

View File

@ -2,6 +2,13 @@
Sometimes the changelog has notes (not comprehensive) acknowledging people's work. This does not mean the changes are their fault, only that their code was used. All changes to the script are chosen by and the fault of the maintainer (ccd0). Sometimes the changelog has notes (not comprehensive) acknowledging people's work. This does not mean the changes are their fault, only that their code was used. All changes to the script are chosen by and the fault of the maintainer (ccd0).
### v1.11.24
**v1.11.24.0** *(2016-01-31)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.24.0/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.24.0/builds/4chan-X-noupdate.crx "Chromium version")]
- Based on v1.11.23.2.
- Bug fixes.
- `JSON Navigation` option is now `JSON Index` to more accurately reflect what it does.
### v1.11.23 ### v1.11.23
**v1.11.23.2** *(2016-01-28)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.23.2/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.23.2/builds/4chan-X-noupdate.crx "Chromium version")] **v1.11.23.2** *(2016-01-28)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.23.2/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.23.2/builds/4chan-X-noupdate.crx "Chromium version")]

Binary file not shown.

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name 4chan X beta // @name 4chan X beta
// @version 1.11.23.2 // @version 1.11.24.0
// @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.11.23.2 // @version 1.11.24.0
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X
@ -125,7 +125,7 @@
Config = { Config = {
main: { main: {
'Miscellaneous': { 'Miscellaneous': {
'JSON Navigation': [true, 'Replace the original board index with one supporting searching, sorting, infinite scrolling, and a catalog mode.'], 'JSON Index': [true, 'Replace the original board index with one supporting searching, sorting, infinite scrolling, and a catalog mode.'],
'Use 4chan X Catalog': [true, 'Link to 4chan X\'s catalog instead of the native 4chan one.', 1], 'Use 4chan X Catalog': [true, 'Link to 4chan X\'s catalog instead of the native 4chan one.', 1],
'Index Refresh Notifications': [false, 'Show a notice at the top of the page when the index is refreshed.', 1], 'Index Refresh Notifications': [false, 'Show a notice at the top of the page when the index is refreshed.', 1],
'Open Threads in New Tab': [false, 'Make links to threads in the index / 4chan X catalog open in a new tab.'], 'Open Threads in New Tab': [false, 'Make links to threads in the index / 4chan X catalog open in a new tab.'],
@ -140,7 +140,7 @@
'Time Formatting': [true, 'Localize and format timestamps.'], 'Time Formatting': [true, 'Localize and format timestamps.'],
'Relative Post Dates': [true, 'Display dates like "3 minutes ago". Tooltip shows the timestamp.'], 'Relative Post Dates': [true, 'Display dates like "3 minutes ago". Tooltip shows the timestamp.'],
'Relative Date Title': [true, 'Show Relative Post Date only when hovering over dates.', 1], 'Relative Date Title': [true, 'Show Relative Post Date only when hovering over dates.', 1],
'Comment Expansion': [true, 'Expand comments that are too long to display on the index. Not applicable with JSON Navigation.'], 'Comment Expansion': [true, 'Expand comments that are too long to display on the index. Not applicable with JSON Index.'],
'File Info Formatting': [true, 'Reformat the file information.'], 'File Info Formatting': [true, 'Reformat the file information.'],
'Thread Expansion': [true, 'Add buttons to expand threads.'], 'Thread Expansion': [true, 'Add buttons to expand threads.'],
'Index Navigation': [false, 'Add buttons to navigate between threads.'], 'Index Navigation': [false, 'Add buttons to navigate between threads.'],
@ -434,7 +434,7 @@
doc = d.documentElement; doc = d.documentElement;
g = { g = {
VERSION: '1.11.23.2', VERSION: '1.11.24.0',
NAMESPACE: '4chan X.', NAMESPACE: '4chan X.',
boards: {} boards: {}
}; };
@ -539,12 +539,12 @@
innerHTML: "4chan X was blocked from loading the following URL:<br><span></span><br>[<a href=\"https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions#why-was-4chan-x-blocked-from-loading-a-url\" target=\"_blank\">More info</a>]" innerHTML: "4chan X was blocked from loading the following URL:<br><span></span><br>[<a href=\"https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions#why-was-4chan-x-blocked-from-loading-a-url\" target=\"_blank\">More info</a>]"
}); });
$('span', message).textContent = (/^\/\//.test(url) ? location.protocol : '') + url; $('span', message).textContent = (/^\/\//.test(url) ? location.protocol : '') + url;
return new Notice('error', message, 30, function() { return new Notice('warning', message, 30, function() {
return delete blockedURLs[url]; return delete blockedURLs[url];
}); });
}; };
return function(url, options, extra) { return function(url, options, extra) {
var err, form, r, ref, type, upCallbacks, whenModified; var err, event, form, k, len1, r, ref, ref1, type, upCallbacks, whenModified;
if (options == null) { if (options == null) {
options = {}; options = {};
} }
@ -560,13 +560,16 @@
} catch (_error) { } catch (_error) {
err = _error; err = _error;
blockedError(url); blockedError(url);
if (typeof options.onerror === "function") { ref = ['error', 'loadend'];
options.onerror(); for (k = 0, len1 = ref.length; k < len1; k++) {
event = ref[k];
r["on" + event] = options["on" + event];
$.queueTask($.event, event, null, r);
} }
return; return;
} }
if (whenModified) { if (whenModified) {
if (((ref = lastModified[whenModified]) != null ? ref[url] : void 0) != null) { if (((ref1 = lastModified[whenModified]) != null ? ref1[url] : void 0) != null) {
r.setRequestHeader('If-Modified-Since', lastModified[whenModified][url]); r.setRequestHeader('If-Modified-Since', lastModified[whenModified][url]);
} }
$.on(r, 'load', function() { $.on(r, 'load', function() {
@ -1990,7 +1993,9 @@
DataBoard.prototype.ajaxCleanParse = function(boardID, response1, response2) { DataBoard.prototype.ajaxCleanParse = function(boardID, response1, response2) {
var ID, board, k, len1, len2, len3, page, q, ref, thread, threads, u; var ID, board, k, len1, len2, len3, page, q, ref, thread, threads, u;
board = this.data.boards[boardID]; if (!(board = this.data.boards[boardID])) {
return;
}
threads = {}; threads = {};
if (response1) { if (response1) {
for (k = 0, len1 = response1.length; k < len1; k++) { for (k = 0, len1 = response1.length; k < len1; k++) {
@ -3267,7 +3272,7 @@
changed: {}, changed: {},
init: function() { init: function() {
var anchorEntry, input, k, label, len1, len2, name, pinEntry, q, ref, ref1, ref2, ref3, ref4, ref5, refNavEntry, repliesEntry, select; var anchorEntry, input, k, label, len1, len2, name, pinEntry, q, ref, ref1, ref2, ref3, ref4, ref5, refNavEntry, repliesEntry, select;
if (g.BOARD.ID === 'f' || !Conf['JSON Navigation'] || g.VIEW !== 'index') { if (g.BOARD.ID === 'f' || !Conf['JSON Index'] || g.VIEW !== 'index') {
return; return;
} }
CatalogThread.callbacks.push({ CatalogThread.callbacks.push({
@ -3448,7 +3453,7 @@
})(), })(),
menu: { menu: {
init: function() { init: function() {
if (g.VIEW !== 'index' || !Conf['JSON Navigation'] || !Conf['Menu'] || !Conf['Thread Hiding Link'] || g.BOARD.ID === 'f') { if (g.VIEW !== 'index' || !Conf['JSON Index'] || !Conf['Menu'] || !Conf['Thread Hiding Link'] || g.BOARD.ID === 'f') {
return; return;
} }
return Menu.menu.addEntry({ return Menu.menu.addEntry({
@ -3613,7 +3618,7 @@
} }
}, },
scrollToIndex: function() { scrollToIndex: function() {
return Header.scrollToIfNeeded(Index.navLinks); return Header.scrollToIfNeeded((Index.navLinks.getBoundingClientRect().height ? Index.navLinks : Index.root));
}, },
getCurrentPage: function() { getCurrentPage: function() {
return +window.location.pathname.split(/\/+/)[2] || 1; return +window.location.pathname.split(/\/+/)[2] || 1;
@ -3829,6 +3834,7 @@
return; return;
} }
Index.req = $.ajax("//a.4cdn.org/" + g.BOARD + "/catalog.json", { Index.req = $.ajax("//a.4cdn.org/" + g.BOARD + "/catalog.json", {
onabort: Index.load,
onloadend: Index.load onloadend: Index.load
}, { }, {
whenModified: 'Index' whenModified: 'Index'
@ -3847,7 +3853,9 @@
delete Index.notice; delete Index.notice;
if (e.type === 'abort') { if (e.type === 'abort') {
req.onloadend = null; req.onloadend = null;
if (notice != null) {
notice.close(); notice.close();
}
return; return;
} }
if ((ref = req.status) !== 200 && ref !== 304) { if ((ref = req.status) !== 200 && ref !== 304) {
@ -3902,8 +3910,9 @@
return Index.pageLoad(); return Index.pageLoad();
}, },
parseThreadList: function(pages) { parseThreadList: function(pages) {
var ref;
Index.pagesNum = pages.length; Index.pagesNum = pages.length;
Index.threadsNumPerPage = pages[0].threads.length; Index.threadsNumPerPage = ((ref = pages[0]) != null ? ref.threads.length : void 0) || 1;
Index.liveThreadData = pages.reduce((function(arr, next) { Index.liveThreadData = pages.reduce((function(arr, next) {
return arr.concat(next.threads); return arr.concat(next.threads);
}), []); }), []);
@ -3911,8 +3920,8 @@
return data.no; return data.no;
}); });
g.BOARD.threads.forEach(function(thread) { g.BOARD.threads.forEach(function(thread) {
var ref; var ref1;
if (ref = thread.ID, indexOf.call(Index.liveThreadIDs, ref) < 0) { if (ref1 = thread.ID, indexOf.call(Index.liveThreadIDs, ref1) < 0) {
return thread.collect(); return thread.collect();
} }
}); });
@ -4039,8 +4048,10 @@
sort: function() { sort: function() {
var k, len1, liveThreadData, liveThreadIDs, nodes, sortedNodes, sortedThreadIDs, threadID; var k, len1, liveThreadData, liveThreadIDs, nodes, sortedNodes, sortedThreadIDs, threadID;
liveThreadIDs = Index.liveThreadIDs, liveThreadData = Index.liveThreadData; liveThreadIDs = Index.liveThreadIDs, liveThreadData = Index.liveThreadData;
sortedThreadIDs = { sortedThreadIDs = (function() {
lastreply: slice.call(liveThreadData).sort(function(a, b) { switch (Conf['Index Sort']) {
case 'lastreply':
return slice.call(liveThreadData).sort(function(a, b) {
var num; var num;
if ((num = a.last_replies)) { if ((num = a.last_replies)) {
a = num[num.length - 1]; a = num[num.length - 1];
@ -4051,22 +4062,27 @@
return b.no - a.no; return b.no - a.no;
}).map(function(post) { }).map(function(post) {
return post.no; return post.no;
}), });
bump: liveThreadIDs, case 'bump':
birth: slice.call(liveThreadIDs).sort(function(a, b) { return liveThreadIDs;
case 'birth':
return slice.call(liveThreadIDs).sort(function(a, b) {
return b - a; return b - a;
}), });
replycount: slice.call(liveThreadData).sort(function(a, b) { case 'replycount':
return slice.call(liveThreadData).sort(function(a, b) {
return b.replies - a.replies; return b.replies - a.replies;
}).map(function(post) { }).map(function(post) {
return post.no; return post.no;
}), });
filecount: slice.call(liveThreadData).sort(function(a, b) { case 'filecount':
return slice.call(liveThreadData).sort(function(a, b) {
return b.images - a.images; return b.images - a.images;
}).map(function(post) { }).map(function(post) {
return post.no; return post.no;
}) });
}[Conf['Index Sort']]; }
})();
Index.sortedNodes = sortedNodes = []; Index.sortedNodes = sortedNodes = [];
nodes = Index.nodes; nodes = Index.nodes;
for (k = 0, len1 = sortedThreadIDs.length; k < len1; k++) { for (k = 0, len1 = sortedThreadIDs.length; k < len1; k++) {
@ -4321,10 +4337,9 @@
} }
return o; return o;
}, },
parseComment: function(o) { parseComment: function(html) {
var html; html = html.replace(/<br\b[^<]*>/gi, '\n').replace(/\n\n<span\b[^<]* class="abbr"[^]*$/i, '').replace(/^<b\b[^<]*>Rolled [^<]*<\/b>/i, '').replace(/<span\b[^<]* class="fortune"[^]*$/i, '').replace(/<[^>]*>/g, '');
html = o.info.commentHTML.innerHTML.replace(/<br\b[^<]*>/gi, '\n').replace(/\n\n<span\b[^<]* class="abbr"[^]*$/i, '').replace(/^<b\b[^<]*>Rolled [^<]*<\/b>/i, '').replace(/<span\b[^<]* class="fortune"[^]*$/i, '').replace(/<[^>]*>/g, ''); return Build.unescape(html);
return o.info.comment = Build.unescape(html);
}, },
postFromObject: function(data, boardID, suppressThumb) { postFromObject: function(data, boardID, suppressThumb) {
var o; var o;
@ -5413,8 +5428,8 @@
return post.info.subject; return post.info.subject;
}, },
comment: function(post) { comment: function(post) {
var ref; var base1;
return (ref = post.info.comment) != null ? ref : Build.parseComment(post); return (base1 = post.info).comment != null ? base1.comment : base1.comment = Build.parseComment(post.info.commentHTML.innerHTML);
}, },
flag: function(post) { flag: function(post) {
return post.info.flag; return post.info.flag;
@ -5877,7 +5892,7 @@
ThreadHiding = { ThreadHiding = {
init: function() { init: function() {
var ref; var ref;
if (((ref = g.VIEW) !== 'index' && ref !== 'catalog') || !Conf['Thread Hiding Buttons'] && !(Conf['Menu'] && Conf['Thread Hiding Link']) && !Conf['JSON Navigation']) { if (((ref = g.VIEW) !== 'index' && ref !== 'catalog') || !Conf['Thread Hiding Buttons'] && !(Conf['Menu'] && Conf['Thread Hiding Link']) && !Conf['JSON Index']) {
return; return;
} }
this.db = new DataBoard('hiddenThreads'); this.db = new DataBoard('hiddenThreads');
@ -5989,7 +6004,7 @@
open: function(arg) { open: function(arg) {
var isReply, thread; var isReply, thread;
thread = arg.thread, isReply = arg.isReply; thread = arg.thread, isReply = arg.isReply;
if (isReply || thread.isHidden || Conf['JSON Navigation'] && Conf['Index Mode'] === 'catalog') { if (isReply || thread.isHidden || Conf['JSON Index'] && Conf['Index Mode'] === 'catalog') {
return false; return false;
} }
ThreadHiding.menu.thread = thread; ThreadHiding.menu.thread = thread;
@ -6015,7 +6030,7 @@
open: function(arg) { open: function(arg) {
var isReply, thread; var isReply, thread;
thread = arg.thread, isReply = arg.isReply; thread = arg.thread, isReply = arg.isReply;
if (isReply || !thread.isHidden || Conf['JSON Navigation'] && Conf['Index Mode'] === 'catalog') { if (isReply || !thread.isHidden || Conf['JSON Index'] && Conf['Index Mode'] === 'catalog') {
return false; return false;
} }
ThreadHiding.menu.thread = thread; ThreadHiding.menu.thread = thread;
@ -6033,7 +6048,7 @@
open: function(arg) { open: function(arg) {
var isReply, thread; var isReply, thread;
thread = arg.thread, isReply = arg.isReply; thread = arg.thread, isReply = arg.isReply;
if (isReply || !thread.isHidden || Conf['JSON Navigation'] && Conf['Index Mode'] === 'catalog') { if (isReply || !thread.isHidden || Conf['JSON Index'] && Conf['Index Mode'] === 'catalog') {
return false; return false;
} }
return ThreadHiding.menu.thread = thread; return ThreadHiding.menu.thread = thread;
@ -6133,7 +6148,7 @@
} }
threadRoot = thread.OP.nodes.root.parentNode; threadRoot = thread.OP.nodes.root.parentNode;
thread.isHidden = true; thread.isHidden = true;
if (Conf['JSON Navigation']) { if (Conf['JSON Index']) {
Index.updateHideLabel(); Index.updateHideLabel();
} }
if (!makeStub) { if (!makeStub) {
@ -6149,7 +6164,7 @@
} }
threadRoot = thread.OP.nodes.root.parentNode; threadRoot = thread.OP.nodes.root.parentNode;
threadRoot.hidden = thread.isHidden = false; threadRoot.hidden = thread.isHidden = false;
if (Conf['JSON Navigation']) { if (Conf['JSON Index']) {
return Index.updateHideLabel(); return Index.updateHideLabel();
} }
} }
@ -6176,7 +6191,7 @@
if (this.isClone || !this.quotes.length || this.isRebuilt) { if (this.isClone || !this.quotes.length || this.isRebuilt) {
return; return;
} }
markYours = Conf['Mark Quotes of You'] && ((ref = QR.db) != null ? ref.get({ markYours = Conf['Mark Quotes of You'] && ((ref = QuoteYou.db) != null ? ref.get({
boardID: this.board.ID, boardID: this.board.ID,
threadID: this.thread.ID, threadID: this.thread.ID,
postID: this.ID postID: this.ID
@ -6745,9 +6760,26 @@
QuoteYou = { QuoteYou = {
init: function() { init: function() {
var ref; var ref;
if (!(((ref = g.VIEW) === 'index' || ref === 'thread') && Conf['Remember Your Posts'] && Conf['Quick Reply'])) { if (!(((ref = g.VIEW) === 'index' || ref === 'thread') && Conf['Remember Your Posts'])) {
return; return;
} }
this.db = new DataBoard('yourPosts');
$.sync('Remember Your Posts', function(enabled) {
return Conf['Remember Your Posts'] = enabled;
});
$.on(d, 'QRPostSuccessful', function(e) {
var boardID, postID, ref1, threadID;
$.forceSync('Remember Your Posts');
if (Conf['Remember Your Posts']) {
ref1 = e.detail, boardID = ref1.boardID, threadID = ref1.threadID, postID = ref1.postID;
return QuoteYou.db.set({
boardID: boardID,
threadID: threadID,
postID: postID,
val: true
});
}
});
if (Conf['Highlight Own Posts']) { if (Conf['Highlight Own Posts']) {
$.addClass(doc, 'highlight-own'); $.addClass(doc, 'highlight-own');
} }
@ -6768,7 +6800,7 @@
if (this.isClone) { if (this.isClone) {
return; return;
} }
if (QR.db.get({ if (QuoteYou.db.get({
boardID: this.board.ID, boardID: this.board.ID,
threadID: this.thread.ID, threadID: this.thread.ID,
postID: this.ID postID: this.ID
@ -6781,7 +6813,7 @@
ref = this.nodes.quotelinks; ref = this.nodes.quotelinks;
for (k = 0, len1 = ref.length; k < len1; k++) { for (k = 0, len1 = ref.length; k < len1; k++) {
quotelink = ref[k]; quotelink = ref[k];
if (!(QR.db.get(Get.postDataFromLink(quotelink)))) { if (!(QuoteYou.db.get(Get.postDataFromLink(quotelink)))) {
continue; continue;
} }
if (Conf['Mark Quotes of You']) { if (Conf['Mark Quotes of You']) {
@ -6969,12 +7001,6 @@
if (!Conf['Quick Reply']) { if (!Conf['Quick Reply']) {
return; return;
} }
if (Conf['Remember Your Posts']) {
$.sync('Remember Your Posts', function(enabled) {
return Conf['Remember Your Posts'] = enabled;
});
this.db = new DataBoard('yourPosts');
}
this.posts = []; this.posts = [];
if (g.VIEW === 'archive') { if (g.VIEW === 'archive') {
return; return;
@ -7436,7 +7462,7 @@
} }
QR.nodes.fileButton.focus(); QR.nodes.fileButton.focus();
return CrossOrigin.file(url, function(blob) { return CrossOrigin.file(url, function(blob) {
if (blob) { if (blob && !/^text\//.test(blob.type)) {
return QR.handleFiles([blob]); return QR.handleFiles([blob]);
} else { } else {
return QR.error("Can't load file."); return QR.error("Can't load file.");
@ -7803,7 +7829,7 @@
return QR.status(); return QR.status();
}, },
response: function() { response: function() {
var URL, _, ban, err, h1, isReply, lastPostToThread, m, open, post, postID, postsCount, ref, ref1, ref2, ref3, req, resDoc, seconds, threadID; var URL, _, ban, err, h1, isReply, lastPostToThread, m, open, post, postID, postsCount, ref, ref1, ref2, req, resDoc, seconds, threadID;
req = QR.req; req = QR.req;
delete QR.req; delete QR.req;
post = QR.posts[0]; post = QR.posts[0];
@ -7863,17 +7889,6 @@
postID = +postID; postID = +postID;
threadID = +threadID || postID; threadID = +threadID || postID;
isReply = threadID !== postID; isReply = threadID !== postID;
$.forceSync('Remember Your Posts');
if (Conf['Remember Your Posts']) {
if ((ref3 = QR.db) != null) {
ref3.set({
boardID: g.BOARD.ID,
threadID: threadID,
postID: postID,
val: true
});
}
}
$.event('QRPostSuccessful', { $.event('QRPostSuccessful', {
boardID: g.BOARD.ID, boardID: g.BOARD.ID,
threadID: threadID, threadID: threadID,
@ -7887,10 +7902,10 @@
postsCount = QR.posts.length - 1; postsCount = QR.posts.length - 1;
QR.cooldown.auto = postsCount && isReply; QR.cooldown.auto = postsCount && isReply;
lastPostToThread = !((function() { lastPostToThread = !((function() {
var k, len1, p, ref4; var k, len1, p, ref3;
ref4 = QR.posts.slice(1); ref3 = QR.posts.slice(1);
for (k = 0, len1 = ref4.length; k < len1; k++) { for (k = 0, len1 = ref3.length; k < len1; k++) {
p = ref4[k]; p = ref3[k];
if (p.thread === post.thread) { if (p.thread === post.thread) {
return true; return true;
} }
@ -8143,6 +8158,15 @@
if (!(d.cookie.indexOf('pass_enabled=1') < 0)) { if (!(d.cookie.indexOf('pass_enabled=1') < 0)) {
return; return;
} }
if (location.hostname === 'sys.4chan.org' && /[?&]altc\b/.test(location.search) && Main.jsEnabled) {
$.onExists(doc, 'script[src="//www.google.com/recaptcha/api/js/recaptcha_ajax.js"]', function() {
$.global(function() {
return window.el.onload = null;
});
return Captcha.v1.create();
});
return;
}
if (((Conf['Use Recaptcha v1'] && location.hostname === 'boards.4chan.org') || (Conf['Use Recaptcha v1 in Reports'] && location.hostname === 'sys.4chan.org')) && Main.jsEnabled) { if (((Conf['Use Recaptcha v1'] && location.hostname === 'boards.4chan.org') || (Conf['Use Recaptcha v1 in Reports'] && location.hostname === 'sys.4chan.org')) && Main.jsEnabled) {
$.ready(Captcha.replace.v1); $.ready(Captcha.replace.v1);
return; return;
@ -8306,7 +8330,55 @@
} }
}, },
create: function() { create: function() {
return $.globalEval('(function() {\n var container = document.getElementById("captchaContainerAlt");\n if (container.firstChild) return;\n var options = {\n theme: "clean",\n tabindex: {"boards.4chan.org": 5, "sys.4chan.org": 3}[location.hostname]\n };\n if (window.Recaptcha) {\n window.Recaptcha.create("6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc", container, options);\n } else {\n var script = document.head.querySelector(\'script[src="//www.google.com/recaptcha/api/js/recaptcha_ajax.js"]\');\n script.addEventListener(\'load\', function() {\n window.Recaptcha.create("6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc", container, options);\n }, false);\n }\n})();'); var cont, lang;
cont = $.id('captchaContainerAlt');
if (this.occupied) {
return;
}
this.occupied = true;
if ((lang = Conf['captchaLanguage'].trim())) {
cont.dataset.lang = lang;
}
$.onExists(cont, '#recaptcha_image', function(image) {
return $.on(image, 'click', function() {
if ($.id('recaptcha_challenge_image')) {
return $.global(function() {
return window.Recaptcha.reload();
});
}
});
});
$.onExists(cont, '#recaptcha_response_field', function(field) {
$.on(field, 'keydown', function(e) {
if (e.keyCode === 8 && !field.value) {
return $.global(function() {
return window.Recaptcha.reload();
});
}
});
if (location.hostname === 'sys.4chan.org') {
return field.focus();
}
});
return $.global(function() {
var container, options, script;
container = document.getElementById('captchaContainerAlt');
options = {
theme: 'clean',
tabindex: {
"boards.4chan.org": 5
}[location.hostname],
lang: container.dataset.lang
};
if (window.Recaptcha) {
return window.Recaptcha.create('6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc', container, options);
} else {
script = document.head.querySelector('script[src="//www.google.com/recaptcha/api/js/recaptcha_ajax.js"]');
return script.addEventListener('load', function() {
return window.Recaptcha.create('6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc', container, options);
}, false);
}
});
}, },
cb: { cb: {
focus: function() { focus: function() {
@ -8359,7 +8431,11 @@
return QR.captcha.lifetime = e.detail; return QR.captcha.lifetime = e.detail;
}; };
$.on(window, 'captcha:timeout', setLifetime); $.on(window, 'captcha:timeout', setLifetime);
$.globalEval('window.dispatchEvent(new CustomEvent("captcha:timeout", {detail: RecaptchaState.timeout}))'); $.global(function() {
return window.dispatchEvent(new CustomEvent('captcha:timeout', {
detail: window.RecaptchaState.timeout
}));
});
$.off(window, 'captcha:timeout', setLifetime); $.off(window, 'captcha:timeout', setLifetime);
ref = QR.captcha.nodes, img = ref.img, input = ref.input; ref = QR.captcha.nodes, img = ref.img, input = ref.input;
img.parentNode.hidden = false; img.parentNode.hidden = false;
@ -8382,7 +8458,10 @@
if (!this.script) { if (!this.script) {
return; return;
} }
$.globalEval('window.Recaptcha.destroy();'); $.global(function() {
return window.Recaptcha.destroy();
});
delete this.occupied;
if (this.nodes) { if (this.nodes) {
return this.beforeSetup(); return this.beforeSetup();
} }
@ -8502,7 +8581,14 @@
} }
}, },
reload: function(focus) { reload: function(focus) {
$.globalEval('if (window.Recaptcha.type === "image") {\n window.Recaptcha.reload();\n} else {\n window.Recaptcha.switch_type("image");\n}\nwindow.Recaptcha.should_focus = false;'); $.global(function() {
if (window.Recaptcha.type === 'image') {
window.Recaptcha.reload();
} else {
window.Recaptcha.switch_type('image');
}
return window.Recaptcha.should_focus = false;
});
if (focus) { if (focus) {
return this.nodes.input.focus(); return this.nodes.input.focus();
} }
@ -8707,6 +8793,9 @@
} }
}, },
setupIFrame: function(iframe) { setupIFrame: function(iframe) {
if (!doc.contains(iframe)) {
return;
}
Captcha.replace.iframe(iframe); Captcha.replace.iframe(iframe);
$.addClass(QR.nodes.el, 'captcha-open'); $.addClass(QR.nodes.el, 'captcha-open');
this.fixQRPosition(); this.fixQRPosition();
@ -9583,9 +9672,7 @@
QR.status(); QR.status();
return this.updateFlashURL(); return this.updateFlashURL();
case 'com': case 'com':
this.nodes.span.textContent = this.com; this.updateComment();
QR.captcha.onPostChange();
QR.characterCount();
if (QR.cooldown.auto && this === QR.posts[0] && (0 < (ref = QR.cooldown.seconds) && ref <= 5)) { if (QR.cooldown.auto && this === QR.posts[0] && (0 < (ref = QR.cooldown.seconds) && ref <= 5)) {
return QR.cooldown.auto = false; return QR.cooldown.auto = false;
} }
@ -9617,6 +9704,24 @@
} }
}; };
_Class.prototype.setComment = function(com) {
this.com = com || null;
if (this === QR.selected) {
QR.nodes.com.value = this.com;
}
return this.updateComment();
};
_Class.prototype.updateComment = function() {
if (this === QR.selected) {
QR.characterCount();
}
this.nodes.span.textContent = this.com;
return $.queueTask(function() {
return QR.captcha.onPostChange();
});
};
_Class.rmErrored = function(e) { _Class.rmErrored = function(e) {
var error, errors, k, len1, post, q, ref; var error, errors, k, len1, post, q, ref;
e.stopPropagation(); e.stopPropagation();
@ -9701,7 +9806,9 @@
this.filesize = $.bytesToString(this.file.size); this.filesize = $.bytesToString(this.file.size);
this.checkSize(); this.checkSize();
$.addClass(this.nodes.el, 'has-file'); $.addClass(this.nodes.el, 'has-file');
QR.captcha.onPostChange(); $.queueTask(function() {
return QR.captcha.onPostChange();
});
URL.revokeObjectURL(this.URL); URL.revokeObjectURL(this.URL);
this.saveFilename(); this.saveFilename();
if (this === QR.selected) { if (this === QR.selected) {
@ -9883,7 +9990,7 @@
}; };
_Class.prototype.updateFlashURL = function() { _Class.prototype.updateFlashURL = function() {
var oldURL, ref, url; var com, oldURL, ref, url;
if (g.BOARD.ID !== 'f') { if (g.BOARD.ID !== 'f') {
return; return;
} }
@ -9899,14 +10006,9 @@
} }
oldURL = this.flashURL || ''; oldURL = this.flashURL || '';
if (url !== oldURL) { if (url !== oldURL) {
this.com || (this.com = ''); com = this.com || '';
if (this.com.slice(0, oldURL.length) === oldURL) { if (com.slice(0, oldURL.length) === oldURL) {
this.com = this.com.slice(oldURL.length); this.setComment(url + com.slice(oldURL.length));
}
this.com = (url + this.com) || null;
if (this === QR.selected) {
QR.nodes.com.value = this.com;
QR.characterCount();
} }
return this.flashURL = url; return this.flashURL = url;
} }
@ -9918,17 +10020,9 @@
reader = new FileReader(); reader = new FileReader();
reader.onload = (function(_this) { reader.onload = (function(_this) {
return function(e) { return function(e) {
var text; var result;
text = e.target.result; result = e.target.result;
if (_this.com) { _this.setComment((_this.com ? _this.com + "\n" + result : result));
_this.com += "\n" + text;
} else {
_this.com = text;
}
if (QR.selected === _this) {
QR.nodes.com.value = _this.com;
}
_this.nodes.span.textContent = _this.com;
return delete _this.pasting; return delete _this.pasting;
}; };
})(this); })(this);
@ -12859,7 +12953,12 @@
if (!(post.isDead || (post.thread.isDead && !post.thread.isArchived))) { if (!(post.isDead || (post.thread.isDead && !post.thread.isArchived))) {
a.textContent = 'Report'; a.textContent = 'Report';
ReportLink.url = "//sys.4chan.org/" + post.board + "/imgboard.php?mode=report&no=" + post; ReportLink.url = "//sys.4chan.org/" + post.board + "/imgboard.php?mode=report&no=" + post;
ReportLink.dims = Conf['Use Recaptcha v1 in Reports'] || d.cookie.indexOf('pass_enabled=1') >= 0 ? 'width=350,height=275' : 'width=400,height=550'; if ((Conf['Use Recaptcha v1 in Reports'] && Main.jsEnabled) || d.cookie.indexOf('pass_enabled=1') >= 0) {
ReportLink.url += '&altc=1';
ReportLink.dims = 'width=350,height=275';
} else {
ReportLink.dims = 'width=400,height=550';
}
} else if (Conf['Archive Report']) { } else if (Conf['Archive Report']) {
a.textContent = 'Report to archive'; a.textContent = 'Report to archive';
ReportLink.url = Redirect.to('report', { ReportLink.url = Redirect.to('report', {
@ -13598,7 +13697,7 @@
$.addClass(doc, 'toggleable-watcher'); $.addClass(doc, 'toggleable-watcher');
} }
ThreadWatcher.fetchAuto(); ThreadWatcher.fetchAuto();
if (g.VIEW === 'index' && Conf['JSON Navigation'] && Conf['Menu'] && g.BOARD.ID !== 'f') { if (g.VIEW === 'index' && Conf['JSON Index'] && Conf['Menu'] && g.BOARD.ID !== 'f') {
Menu.menu.addEntry({ Menu.menu.addEntry({
el: $.el('a', { el: $.el('a', {
href: 'javascript:;', href: 'javascript:;',
@ -13849,7 +13948,7 @@
var k, len1, ref, thread, threads; var k, len1, ref, thread, threads;
ThreadWatcher.db.forceSync(); ThreadWatcher.db.forceSync();
ThreadWatcher.unreaddb.forceSync(); ThreadWatcher.unreaddb.forceSync();
if ((ref = QR.db) != null) { if ((ref = QuoteYou.db) != null) {
ref.forceSync(); ref.forceSync();
} }
if (!(threads = ThreadWatcher.getAll()).length) { if (!(threads = ThreadWatcher.getAll()).length) {
@ -13911,7 +14010,7 @@
if (!(postObj.no > lastReadPost)) { if (!(postObj.no > lastReadPost)) {
continue; continue;
} }
if ((ref1 = QR.db) != null ? ref1.get({ if ((ref1 = QuoteYou.db) != null ? ref1.get({
boardID: boardID, boardID: boardID,
threadID: threadID, threadID: threadID,
postID: postObj.no postID: postObj.no
@ -13919,13 +14018,13 @@
continue; continue;
} }
unread++; unread++;
if (!(QR.db && postObj.com)) { if (!(QuoteYou.db && postObj.com)) {
continue; continue;
} }
quotesYou = false; quotesYou = false;
regexp = /<a [^>]*\bhref="(?:\/([^\/]+)\/thread\/)?(\d+)?(?:#p(\d+))?"/g; regexp = /<a [^>]*\bhref="(?:\/([^\/]+)\/thread\/)?(\d+)?(?:#p(\d+))?"/g;
while (match = regexp.exec(postObj.com)) { while (match = regexp.exec(postObj.com)) {
if (QR.db.get({ if (QuoteYou.db.get({
boardID: match[1] || boardID, boardID: match[1] || boardID,
threadID: match[2] || threadID, threadID: match[2] || threadID,
postID: match[3] || match[2] || threadID postID: match[3] || match[2] || threadID
@ -14439,7 +14538,7 @@
return; return;
} }
Unread.order.push(this); Unread.order.push(this);
if (this.ID <= Unread.lastReadPost || this.isHidden || ((ref = QR.db) != null ? ref.get({ if (this.ID <= Unread.lastReadPost || this.isHidden || ((ref = QuoteYou.db) != null ? ref.get({
boardID: this.board.ID, boardID: this.board.ID,
threadID: this.thread.ID, threadID: this.thread.ID,
postID: this.ID postID: this.ID
@ -14455,7 +14554,7 @@
ref = post.nodes.quotelinks; ref = post.nodes.quotelinks;
for (k = 0, len1 = ref.length; k < len1; k++) { for (k = 0, len1 = ref.length; k < len1; k++) {
quotelink = ref[k]; quotelink = ref[k];
if (!((ref1 = QR.db) != null ? ref1.get(Get.postDataFromLink(quotelink)) : void 0)) { if (!((ref1 = QuoteYou.db) != null ? ref1.get(Get.postDataFromLink(quotelink)) : void 0)) {
continue; continue;
} }
Unread.postsQuotingYou.add(post.ID); Unread.postsQuotingYou.add(post.ID);
@ -14524,7 +14623,7 @@
count++; count++;
Unread.posts["delete"](ID); Unread.posts["delete"](ID);
Unread.postsQuotingYou["delete"](ID); Unread.postsQuotingYou["delete"](ID);
if ((ref1 = QR.db) != null ? ref1.get({ if ((ref1 = QuoteYou.db) != null ? ref1.get({
boardID: data.board.ID, boardID: data.board.ID,
threadID: data.thread.ID, threadID: data.thread.ID,
postID: ID postID: ID
@ -15053,7 +15152,7 @@
CatalogLinks = { CatalogLinks = {
init: function() { init: function() {
var el, input, selector; var el, input, selector;
if ((Conf['External Catalog'] || Conf['JSON Navigation']) && !(Conf['JSON Navigation'] && g.VIEW === 'index')) { if ((Conf['External Catalog'] || Conf['JSON Index']) && !(Conf['JSON Index'] && g.VIEW === 'index')) {
selector = (function() { selector = (function() {
switch (g.VIEW) { switch (g.VIEW) {
case 'thread': case 'thread':
@ -15072,7 +15171,7 @@
link = ref[k]; link = ref[k];
switch (link.pathname.replace(/\/+/g, '/')) { switch (link.pathname.replace(/\/+/g, '/')) {
case "/" + g.BOARD + "/": case "/" + g.BOARD + "/":
if (Conf['JSON Navigation']) { if (Conf['JSON Index']) {
link.textContent = 'Index'; link.textContent = 'Index';
} }
link.href = CatalogLinks.index(); link.href = CatalogLinks.index();
@ -15080,7 +15179,7 @@
case "/" + g.BOARD + "/catalog": case "/" + g.BOARD + "/catalog":
link.href = CatalogLinks.catalog(); link.href = CatalogLinks.catalog();
} }
if (g.VIEW === 'catalog' && Conf['JSON Navigation'] && Conf['Use 4chan X Catalog']) { if (g.VIEW === 'catalog' && Conf['JSON Index'] && Conf['Use 4chan X Catalog']) {
catalogLink = link.parentNode.cloneNode(true); catalogLink = link.parentNode.cloneNode(true);
catalogLink.firstElementChild.textContent = '4chan X Catalog'; catalogLink.firstElementChild.textContent = '4chan X Catalog';
catalogLink.firstElementChild.href = CatalogLinks.catalog(); catalogLink.firstElementChild.href = CatalogLinks.catalog();
@ -15089,7 +15188,7 @@
} }
}); });
} }
if (Conf['JSON Navigation'] && Conf['Use 4chan X Catalog']) { if (Conf['JSON Index'] && Conf['Use 4chan X Catalog']) {
Post.callbacks.push({ Post.callbacks.push({
name: 'Catalog Link Rewrite', name: 'Catalog Link Rewrite',
cb: this.node cb: this.node
@ -15151,7 +15250,7 @@
} }
if (Conf['External Catalog'] && (board === 'a' || board === 'c' || board === 'g' || board === 'biz' || board === 'k' || board === 'm' || board === 'o' || board === 'p' || board === 'v' || board === 'vg' || board === 'vr' || board === 'w' || board === 'wg' || board === 'cm' || board === '3' || board === 'adv' || board === 'an' || board === 'asp' || board === 'cgl' || board === 'ck' || board === 'co' || board === 'diy' || board === 'fa' || board === 'fit' || board === 'gd' || board === 'int' || board === 'jp' || board === 'lit' || board === 'mlp' || board === 'mu' || board === 'n' || board === 'out' || board === 'po' || board === 'sci' || board === 'sp' || board === 'tg' || board === 'toy' || board === 'trv' || board === 'tv' || board === 'vp' || board === 'wsg' || board === 'x' || board === 'f' || board === 'pol' || board === 's4s' || board === 'lgbt')) { if (Conf['External Catalog'] && (board === 'a' || board === 'c' || board === 'g' || board === 'biz' || board === 'k' || board === 'm' || board === 'o' || board === 'p' || board === 'v' || board === 'vg' || board === 'vr' || board === 'w' || board === 'wg' || board === 'cm' || board === '3' || board === 'adv' || board === 'an' || board === 'asp' || board === 'cgl' || board === 'ck' || board === 'co' || board === 'diy' || board === 'fa' || board === 'fit' || board === 'gd' || board === 'int' || board === 'jp' || board === 'lit' || board === 'mlp' || board === 'mu' || board === 'n' || board === 'out' || board === 'po' || board === 'sci' || board === 'sp' || board === 'tg' || board === 'toy' || board === 'trv' || board === 'tv' || board === 'vp' || board === 'wsg' || board === 'x' || board === 'f' || board === 'pol' || board === 's4s' || board === 'lgbt')) {
return "http://catalog.neet.tv/" + board + "/"; return "http://catalog.neet.tv/" + board + "/";
} else if (Conf['JSON Navigation'] && Conf['Use 4chan X Catalog']) { } else if (Conf['JSON Index'] && Conf['Use 4chan X Catalog']) {
if (g.BOARD.ID === board && g.VIEW === 'index') { if (g.BOARD.ID === board && g.VIEW === 'index') {
return '#catalog'; return '#catalog';
} else { } else {
@ -15165,7 +15264,7 @@
if (board == null) { if (board == null) {
board = g.BOARD.ID; board = g.BOARD.ID;
} }
if (Conf['JSON Navigation'] && board !== 'f') { if (Conf['JSON Index'] && board !== 'f') {
if (g.BOARD.ID === board && g.VIEW === 'index') { if (g.BOARD.ID === board && g.VIEW === 'index') {
return '#index'; return '#index';
} else { } else {
@ -15203,7 +15302,7 @@
ExpandComment = { ExpandComment = {
init: function() { init: function() {
if (g.VIEW !== 'index' || !Conf['Comment Expansion'] || Conf['JSON Navigation']) { if (g.VIEW !== 'index' || !Conf['Comment Expansion'] || Conf['JSON Index']) {
return; return;
} }
if (g.BOARD.ID === 'g') { if (g.BOARD.ID === 'g') {
@ -15309,7 +15408,7 @@
if (g.VIEW === 'thread' || !Conf['Thread Expansion']) { if (g.VIEW === 'thread' || !Conf['Thread Expansion']) {
return; return;
} }
if (Conf['JSON Navigation']) { if (Conf['JSON Index']) {
return $.on(d, 'IndexRefresh', this.onIndexRefresh); return $.on(d, 'IndexRefresh', this.onIndexRefresh);
} else { } else {
return Thread.callbacks.push({ return Thread.callbacks.push({
@ -15395,7 +15494,7 @@
return; return;
} }
replies = $$('.thread > .replyContainer', threadRoot); replies = $$('.thread > .replyContainer', threadRoot);
if (!Conf['JSON Navigation'] || Conf['Show Replies']) { if (!Conf['JSON Index'] || Conf['Show Replies']) {
num = (function() { num = (function() {
if (thread.isSticky) { if (thread.isSticky) {
return 1; return 1;
@ -15823,7 +15922,7 @@
return; return;
} }
} }
if (!(((ref1 = g.VIEW) !== 'index' && ref1 !== 'thread') || g.VIEW === 'index' && Conf['JSON Navigation'] && Conf['Index Mode'] === 'catalog' || g.VIEW === 'index' && g.BOARD.ID === 'f')) { if (!(((ref1 = g.VIEW) !== 'index' && ref1 !== 'thread') || g.VIEW === 'index' && Conf['JSON Index'] && Conf['Index Mode'] === 'catalog' || g.VIEW === 'index' && g.BOARD.ID === 'f')) {
threadRoot = Nav.getThread(); threadRoot = Nav.getThread();
if (op = $('.op', threadRoot)) { if (op = $('.op', threadRoot)) {
thread = Get.postFromNode(op).thread; thread = Get.postFromNode(op).thread;
@ -15927,7 +16026,7 @@
ThreadUpdater.update(); ThreadUpdater.update();
break; break;
case 'index': case 'index':
if (!(Conf['JSON Navigation'] && g.BOARD.ID !== 'f')) { if (!(Conf['JSON Index'] && g.BOARD.ID !== 'f')) {
return; return;
} }
Index.update(); Index.update();
@ -15973,7 +16072,7 @@
FappeTyme.toggle('werk'); FappeTyme.toggle('werk');
break; break;
case Conf['Front page']: case Conf['Front page']:
if (Conf['JSON Navigation'] && g.VIEW === 'index' && g.BOARD.ID !== 'f') { if (Conf['JSON Index'] && g.VIEW === 'index' && g.BOARD.ID !== 'f') {
Index.userPageNav(1); Index.userPageNav(1);
} else { } else {
window.location = "/" + g.BOARD + "/"; window.location = "/" + g.BOARD + "/";
@ -15986,7 +16085,7 @@
if (!(g.VIEW === 'index' && g.BOARD.ID !== 'f')) { if (!(g.VIEW === 'index' && g.BOARD.ID !== 'f')) {
return; return;
} }
if (Conf['JSON Navigation']) { if (Conf['JSON Index']) {
if ((ref4 = Conf['Index Mode']) !== 'paged' && ref4 !== 'infinite') { if ((ref4 = Conf['Index Mode']) !== 'paged' && ref4 !== 'infinite') {
return; return;
} }
@ -16001,7 +16100,7 @@
if (!(g.VIEW === 'index' && g.BOARD.ID !== 'f')) { if (!(g.VIEW === 'index' && g.BOARD.ID !== 'f')) {
return; return;
} }
if (Conf['JSON Navigation']) { if (Conf['JSON Index']) {
if ((ref5 = Conf['Index Mode']) !== 'paged' && ref5 !== 'infinite') { if ((ref5 = Conf['Index Mode']) !== 'paged' && ref5 !== 'infinite') {
return; return;
} }
@ -16016,24 +16115,24 @@
if (!(g.VIEW === 'index' && g.BOARD.ID !== 'f')) { if (!(g.VIEW === 'index' && g.BOARD.ID !== 'f')) {
return; return;
} }
searchInput = Conf['JSON Navigation'] ? Index.searchInput : $.id('search-box'); searchInput = Conf['JSON Index'] ? Index.searchInput : $.id('search-box');
Header.scrollToIfNeeded(searchInput); Header.scrollToIfNeeded(searchInput);
searchInput.focus(); searchInput.focus();
break; break;
case Conf['Paged mode']: case Conf['Paged mode']:
if (!(Conf['JSON Navigation'] && g.BOARD.ID !== 'f')) { if (!(Conf['JSON Index'] && g.BOARD.ID !== 'f')) {
return; return;
} }
window.location = g.VIEW === 'index' ? '#paged' : "/" + g.BOARD + "/#paged"; window.location = g.VIEW === 'index' ? '#paged' : "/" + g.BOARD + "/#paged";
break; break;
case Conf['Infinite scrolling mode']: case Conf['Infinite scrolling mode']:
if (!(Conf['JSON Navigation'] && g.BOARD.ID !== 'f')) { if (!(Conf['JSON Index'] && g.BOARD.ID !== 'f')) {
return; return;
} }
window.location = g.VIEW === 'index' ? '#infinite' : "/" + g.BOARD + "/#infinite"; window.location = g.VIEW === 'index' ? '#infinite' : "/" + g.BOARD + "/#infinite";
break; break;
case Conf['All pages mode']: case Conf['All pages mode']:
if (!(Conf['JSON Navigation'] && g.BOARD.ID !== 'f')) { if (!(Conf['JSON Index'] && g.BOARD.ID !== 'f')) {
return; return;
} }
window.location = g.VIEW === 'index' ? '#all-pages' : "/" + g.BOARD + "/#all-pages"; window.location = g.VIEW === 'index' ? '#all-pages' : "/" + g.BOARD + "/#all-pages";
@ -16045,7 +16144,7 @@
window.location = CatalogLinks.catalog(); window.location = CatalogLinks.catalog();
break; break;
case Conf['Cycle sort type']: case Conf['Cycle sort type']:
if (!(Conf['JSON Navigation'] && g.VIEW === 'index' && g.BOARD.ID !== 'f')) { if (!(Conf['JSON Index'] && g.VIEW === 'index' && g.BOARD.ID !== 'f')) {
return; return;
} }
Index.cycleSortType(); Index.cycleSortType();
@ -16107,13 +16206,13 @@
} }
break; break;
case Conf['Previous Post Quoting You']: case Conf['Previous Post Quoting You']:
if (!(threadRoot && QR.db)) { if (!(threadRoot && QuoteYou.db)) {
return; return;
} }
QuoteYou.cb.seek('preceding'); QuoteYou.cb.seek('preceding');
break; break;
case Conf['Next Post Quoting You']: case Conf['Next Post Quoting You']:
if (!(threadRoot && QR.db)) { if (!(threadRoot && QuoteYou.db)) {
return; return;
} }
QuoteYou.cb.seek('following'); QuoteYou.cb.seek('following');
@ -16407,7 +16506,7 @@
INTERVAL: $.MINUTE / 2, INTERVAL: $.MINUTE / 2,
init: function() { init: function() {
var ref; var ref;
if (((ref = g.VIEW) === 'index' || ref === 'thread') && Conf['Relative Post Dates'] && !Conf['Relative Date Title'] || g.VIEW === 'index' && Conf['JSON Navigation'] && g.BOARD.ID !== 'f') { if (((ref = g.VIEW) === 'index' || ref === 'thread') && Conf['Relative Post Dates'] && !Conf['Relative Date Title'] || g.VIEW === 'index' && Conf['JSON Index'] && g.BOARD.ID !== 'f') {
this.flush(); this.flush();
$.on(d, 'visibilitychange ThreadUpdate', this.flush); $.on(d, 'visibilitychange ThreadUpdate', this.flush);
} }
@ -16541,7 +16640,8 @@
}; };
Report = { Report = {
css: ":root:not(.js-enabled) #captchaContainerAlt {\n" + css: ":root:not(.js-enabled) #g-recaptcha,\n" +
":root:not(.js-enabled) #captchaContainerAlt {\n" +
" height: auto;\n" + " height: auto;\n" +
"}\n" + "}\n" +
"#captchaContainerAlt td:nth-child(2) {\n" + "#captchaContainerAlt td:nth-child(2) {\n" +
@ -16580,7 +16680,7 @@
]); ]);
} }
if (!Conf['Use Recaptcha v1 in Reports'] && !Conf['Force Noscript Captcha'] && Main.jsEnabled) { if (!Conf['Use Recaptcha v1 in Reports'] && !Conf['Force Noscript Captcha'] && Main.jsEnabled) {
new MutationObserver(function() { return new MutationObserver(function() {
Report.fit('iframe[src^="https://www.google.com/recaptcha/api2/frame"]'); Report.fit('iframe[src^="https://www.google.com/recaptcha/api2/frame"]');
return Report.fit('body'); return Report.fit('body');
}).observe(d.body, { }).observe(d.body, {
@ -16589,27 +16689,7 @@
subtree: true subtree: true
}); });
} else { } else {
Report.fit('body'); return Report.fit('body');
}
if (Conf['Use Recaptcha v1 in Reports'] && Main.jsEnabled && d.cookie.indexOf('pass_enabled=1') < 0) {
$.onExists(d.body, '#recaptcha_image', function(image) {
return $.on(image, 'click', function() {
if ($.id('recaptcha_challenge_image')) {
return $.global(function() {
return window.Recaptcha.reload();
});
}
});
});
return $.onExists(d.body, '#recaptcha_response_field', function(field) {
return $.on(field, 'keydown', function(e) {
if (e.keyCode === 8 && !field.value) {
return $.global(function() {
return window.Recaptcha.reload();
});
}
});
});
} }
}, },
fit: function(selector) { fit: function(selector) {
@ -17035,7 +17115,6 @@
}, },
"export": function() { "export": function() {
return $.get(Conf, function(Conf) { return $.get(Conf, function(Conf) {
delete Conf['archives'];
return Settings.downloadExport({ return Settings.downloadExport({
version: g.VERSION, version: g.VERSION,
date: Date.now(), date: Date.now(),
@ -17302,6 +17381,11 @@
set('Use Recaptcha v1 in Reports', true); set('Use Recaptcha v1 in Reports', true);
} }
} }
if (compareString < '00001.00011.00024.00000') {
if ((data['JSON Navigation'] != null) && (data['JSON Index'] == null)) {
set('JSON Index', data['JSON Navigation']);
}
}
return changes; return changes;
}, },
loadSettings: function(data, cb) { loadSettings: function(data, cb) {
@ -17702,6 +17786,7 @@
Conf['selectedArchives'] = {}; Conf['selectedArchives'] = {};
Conf['cooldowns'] = {}; Conf['cooldowns'] = {};
Conf['Except Archives from Encryption'] = false; Conf['Except Archives from Encryption'] = false;
Conf['JSON Navigation'] = true;
items = {}; items = {};
for (key in Conf) { for (key in Conf) {
items[key] = void 0; items[key] = void 0;
@ -17885,6 +17970,7 @@
setStyle = function() { setStyle = function() {
var k, len1, styleSheet; var k, len1, styleSheet;
$.rmClass(doc, style); $.rmClass(doc, style);
style = null;
for (k = 0, len1 = styleSheets.length; k < len1; k++) { for (k = 0, len1 = styleSheets.length; k < len1; k++) {
styleSheet = styleSheets[k]; styleSheet = styleSheets[k];
if (styleSheet.href === (mainStyleSheet != null ? mainStyleSheet.href : void 0)) { if (styleSheet.href === (mainStyleSheet != null ? mainStyleSheet.href : void 0)) {
@ -17892,7 +17978,9 @@
break; break;
} }
} }
if (style) {
return $.addClass(doc, style); return $.addClass(doc, style);
}
}; };
setStyle(); setStyle();
if (!mainStyleSheet) { if (!mainStyleSheet) {
@ -17929,7 +18017,7 @@
}); });
new Notice('warning', msg); new Notice('warning', msg);
} }
if (!(Conf['JSON Navigation'] && g.VIEW === 'index')) { if (!(Conf['JSON Index'] && g.VIEW === 'index')) {
return Main.initThread(); return Main.initThread();
} else { } else {
Main.expectInitFinished = true; Main.expectInitFinished = true;
@ -18744,6 +18832,7 @@
".dialog {\n" + ".dialog {\n" +
" border: 1px solid;\n" + " border: 1px solid;\n" +
" display: block;\n" + " display: block;\n" +
" background-color: inherit;\n" +
"}\n" + "}\n" +
".dialog:not(#qr):not(#thread-watcher):not(#header-bar) {\n" + ".dialog:not(#qr):not(#thread-watcher):not(#header-bar) {\n" +
" box-shadow: 0 1px 2px rgba(0, 0, 0, .15);\n" + " box-shadow: 0 1px 2px rgba(0, 0, 0, .15);\n" +

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.11.23.2 // @version 1.11.24.0
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X
@ -125,7 +125,7 @@
Config = { Config = {
main: { main: {
'Miscellaneous': { 'Miscellaneous': {
'JSON Navigation': [true, 'Replace the original board index with one supporting searching, sorting, infinite scrolling, and a catalog mode.'], 'JSON Index': [true, 'Replace the original board index with one supporting searching, sorting, infinite scrolling, and a catalog mode.'],
'Use 4chan X Catalog': [true, 'Link to 4chan X\'s catalog instead of the native 4chan one.', 1], 'Use 4chan X Catalog': [true, 'Link to 4chan X\'s catalog instead of the native 4chan one.', 1],
'Index Refresh Notifications': [false, 'Show a notice at the top of the page when the index is refreshed.', 1], 'Index Refresh Notifications': [false, 'Show a notice at the top of the page when the index is refreshed.', 1],
'Open Threads in New Tab': [false, 'Make links to threads in the index / 4chan X catalog open in a new tab.'], 'Open Threads in New Tab': [false, 'Make links to threads in the index / 4chan X catalog open in a new tab.'],
@ -140,7 +140,7 @@
'Time Formatting': [true, 'Localize and format timestamps.'], 'Time Formatting': [true, 'Localize and format timestamps.'],
'Relative Post Dates': [true, 'Display dates like "3 minutes ago". Tooltip shows the timestamp.'], 'Relative Post Dates': [true, 'Display dates like "3 minutes ago". Tooltip shows the timestamp.'],
'Relative Date Title': [true, 'Show Relative Post Date only when hovering over dates.', 1], 'Relative Date Title': [true, 'Show Relative Post Date only when hovering over dates.', 1],
'Comment Expansion': [true, 'Expand comments that are too long to display on the index. Not applicable with JSON Navigation.'], 'Comment Expansion': [true, 'Expand comments that are too long to display on the index. Not applicable with JSON Index.'],
'File Info Formatting': [true, 'Reformat the file information.'], 'File Info Formatting': [true, 'Reformat the file information.'],
'Thread Expansion': [true, 'Add buttons to expand threads.'], 'Thread Expansion': [true, 'Add buttons to expand threads.'],
'Index Navigation': [false, 'Add buttons to navigate between threads.'], 'Index Navigation': [false, 'Add buttons to navigate between threads.'],
@ -434,7 +434,7 @@
doc = d.documentElement; doc = d.documentElement;
g = { g = {
VERSION: '1.11.23.2', VERSION: '1.11.24.0',
NAMESPACE: '4chan X.', NAMESPACE: '4chan X.',
boards: {} boards: {}
}; };
@ -539,12 +539,12 @@
innerHTML: "4chan X was blocked from loading the following URL:<br><span></span><br>[<a href=\"https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions#why-was-4chan-x-blocked-from-loading-a-url\" target=\"_blank\">More info</a>]" innerHTML: "4chan X was blocked from loading the following URL:<br><span></span><br>[<a href=\"https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions#why-was-4chan-x-blocked-from-loading-a-url\" target=\"_blank\">More info</a>]"
}); });
$('span', message).textContent = (/^\/\//.test(url) ? location.protocol : '') + url; $('span', message).textContent = (/^\/\//.test(url) ? location.protocol : '') + url;
return new Notice('error', message, 30, function() { return new Notice('warning', message, 30, function() {
return delete blockedURLs[url]; return delete blockedURLs[url];
}); });
}; };
return function(url, options, extra) { return function(url, options, extra) {
var err, form, r, ref, type, upCallbacks, whenModified; var err, event, form, k, len1, r, ref, ref1, type, upCallbacks, whenModified;
if (options == null) { if (options == null) {
options = {}; options = {};
} }
@ -560,13 +560,16 @@
} catch (_error) { } catch (_error) {
err = _error; err = _error;
blockedError(url); blockedError(url);
if (typeof options.onerror === "function") { ref = ['error', 'loadend'];
options.onerror(); for (k = 0, len1 = ref.length; k < len1; k++) {
event = ref[k];
r["on" + event] = options["on" + event];
$.queueTask($.event, event, null, r);
} }
return; return;
} }
if (whenModified) { if (whenModified) {
if (((ref = lastModified[whenModified]) != null ? ref[url] : void 0) != null) { if (((ref1 = lastModified[whenModified]) != null ? ref1[url] : void 0) != null) {
r.setRequestHeader('If-Modified-Since', lastModified[whenModified][url]); r.setRequestHeader('If-Modified-Since', lastModified[whenModified][url]);
} }
$.on(r, 'load', function() { $.on(r, 'load', function() {
@ -1990,7 +1993,9 @@
DataBoard.prototype.ajaxCleanParse = function(boardID, response1, response2) { DataBoard.prototype.ajaxCleanParse = function(boardID, response1, response2) {
var ID, board, k, len1, len2, len3, page, q, ref, thread, threads, u; var ID, board, k, len1, len2, len3, page, q, ref, thread, threads, u;
board = this.data.boards[boardID]; if (!(board = this.data.boards[boardID])) {
return;
}
threads = {}; threads = {};
if (response1) { if (response1) {
for (k = 0, len1 = response1.length; k < len1; k++) { for (k = 0, len1 = response1.length; k < len1; k++) {
@ -3267,7 +3272,7 @@
changed: {}, changed: {},
init: function() { init: function() {
var anchorEntry, input, k, label, len1, len2, name, pinEntry, q, ref, ref1, ref2, ref3, ref4, ref5, refNavEntry, repliesEntry, select; var anchorEntry, input, k, label, len1, len2, name, pinEntry, q, ref, ref1, ref2, ref3, ref4, ref5, refNavEntry, repliesEntry, select;
if (g.BOARD.ID === 'f' || !Conf['JSON Navigation'] || g.VIEW !== 'index') { if (g.BOARD.ID === 'f' || !Conf['JSON Index'] || g.VIEW !== 'index') {
return; return;
} }
CatalogThread.callbacks.push({ CatalogThread.callbacks.push({
@ -3448,7 +3453,7 @@
})(), })(),
menu: { menu: {
init: function() { init: function() {
if (g.VIEW !== 'index' || !Conf['JSON Navigation'] || !Conf['Menu'] || !Conf['Thread Hiding Link'] || g.BOARD.ID === 'f') { if (g.VIEW !== 'index' || !Conf['JSON Index'] || !Conf['Menu'] || !Conf['Thread Hiding Link'] || g.BOARD.ID === 'f') {
return; return;
} }
return Menu.menu.addEntry({ return Menu.menu.addEntry({
@ -3613,7 +3618,7 @@
} }
}, },
scrollToIndex: function() { scrollToIndex: function() {
return Header.scrollToIfNeeded(Index.navLinks); return Header.scrollToIfNeeded((Index.navLinks.getBoundingClientRect().height ? Index.navLinks : Index.root));
}, },
getCurrentPage: function() { getCurrentPage: function() {
return +window.location.pathname.split(/\/+/)[2] || 1; return +window.location.pathname.split(/\/+/)[2] || 1;
@ -3829,6 +3834,7 @@
return; return;
} }
Index.req = $.ajax("//a.4cdn.org/" + g.BOARD + "/catalog.json", { Index.req = $.ajax("//a.4cdn.org/" + g.BOARD + "/catalog.json", {
onabort: Index.load,
onloadend: Index.load onloadend: Index.load
}, { }, {
whenModified: 'Index' whenModified: 'Index'
@ -3847,7 +3853,9 @@
delete Index.notice; delete Index.notice;
if (e.type === 'abort') { if (e.type === 'abort') {
req.onloadend = null; req.onloadend = null;
if (notice != null) {
notice.close(); notice.close();
}
return; return;
} }
if ((ref = req.status) !== 200 && ref !== 304) { if ((ref = req.status) !== 200 && ref !== 304) {
@ -3902,8 +3910,9 @@
return Index.pageLoad(); return Index.pageLoad();
}, },
parseThreadList: function(pages) { parseThreadList: function(pages) {
var ref;
Index.pagesNum = pages.length; Index.pagesNum = pages.length;
Index.threadsNumPerPage = pages[0].threads.length; Index.threadsNumPerPage = ((ref = pages[0]) != null ? ref.threads.length : void 0) || 1;
Index.liveThreadData = pages.reduce((function(arr, next) { Index.liveThreadData = pages.reduce((function(arr, next) {
return arr.concat(next.threads); return arr.concat(next.threads);
}), []); }), []);
@ -3911,8 +3920,8 @@
return data.no; return data.no;
}); });
g.BOARD.threads.forEach(function(thread) { g.BOARD.threads.forEach(function(thread) {
var ref; var ref1;
if (ref = thread.ID, indexOf.call(Index.liveThreadIDs, ref) < 0) { if (ref1 = thread.ID, indexOf.call(Index.liveThreadIDs, ref1) < 0) {
return thread.collect(); return thread.collect();
} }
}); });
@ -4039,8 +4048,10 @@
sort: function() { sort: function() {
var k, len1, liveThreadData, liveThreadIDs, nodes, sortedNodes, sortedThreadIDs, threadID; var k, len1, liveThreadData, liveThreadIDs, nodes, sortedNodes, sortedThreadIDs, threadID;
liveThreadIDs = Index.liveThreadIDs, liveThreadData = Index.liveThreadData; liveThreadIDs = Index.liveThreadIDs, liveThreadData = Index.liveThreadData;
sortedThreadIDs = { sortedThreadIDs = (function() {
lastreply: slice.call(liveThreadData).sort(function(a, b) { switch (Conf['Index Sort']) {
case 'lastreply':
return slice.call(liveThreadData).sort(function(a, b) {
var num; var num;
if ((num = a.last_replies)) { if ((num = a.last_replies)) {
a = num[num.length - 1]; a = num[num.length - 1];
@ -4051,22 +4062,27 @@
return b.no - a.no; return b.no - a.no;
}).map(function(post) { }).map(function(post) {
return post.no; return post.no;
}), });
bump: liveThreadIDs, case 'bump':
birth: slice.call(liveThreadIDs).sort(function(a, b) { return liveThreadIDs;
case 'birth':
return slice.call(liveThreadIDs).sort(function(a, b) {
return b - a; return b - a;
}), });
replycount: slice.call(liveThreadData).sort(function(a, b) { case 'replycount':
return slice.call(liveThreadData).sort(function(a, b) {
return b.replies - a.replies; return b.replies - a.replies;
}).map(function(post) { }).map(function(post) {
return post.no; return post.no;
}), });
filecount: slice.call(liveThreadData).sort(function(a, b) { case 'filecount':
return slice.call(liveThreadData).sort(function(a, b) {
return b.images - a.images; return b.images - a.images;
}).map(function(post) { }).map(function(post) {
return post.no; return post.no;
}) });
}[Conf['Index Sort']]; }
})();
Index.sortedNodes = sortedNodes = []; Index.sortedNodes = sortedNodes = [];
nodes = Index.nodes; nodes = Index.nodes;
for (k = 0, len1 = sortedThreadIDs.length; k < len1; k++) { for (k = 0, len1 = sortedThreadIDs.length; k < len1; k++) {
@ -4321,10 +4337,9 @@
} }
return o; return o;
}, },
parseComment: function(o) { parseComment: function(html) {
var html; html = html.replace(/<br\b[^<]*>/gi, '\n').replace(/\n\n<span\b[^<]* class="abbr"[^]*$/i, '').replace(/^<b\b[^<]*>Rolled [^<]*<\/b>/i, '').replace(/<span\b[^<]* class="fortune"[^]*$/i, '').replace(/<[^>]*>/g, '');
html = o.info.commentHTML.innerHTML.replace(/<br\b[^<]*>/gi, '\n').replace(/\n\n<span\b[^<]* class="abbr"[^]*$/i, '').replace(/^<b\b[^<]*>Rolled [^<]*<\/b>/i, '').replace(/<span\b[^<]* class="fortune"[^]*$/i, '').replace(/<[^>]*>/g, ''); return Build.unescape(html);
return o.info.comment = Build.unescape(html);
}, },
postFromObject: function(data, boardID, suppressThumb) { postFromObject: function(data, boardID, suppressThumb) {
var o; var o;
@ -5413,8 +5428,8 @@
return post.info.subject; return post.info.subject;
}, },
comment: function(post) { comment: function(post) {
var ref; var base1;
return (ref = post.info.comment) != null ? ref : Build.parseComment(post); return (base1 = post.info).comment != null ? base1.comment : base1.comment = Build.parseComment(post.info.commentHTML.innerHTML);
}, },
flag: function(post) { flag: function(post) {
return post.info.flag; return post.info.flag;
@ -5877,7 +5892,7 @@
ThreadHiding = { ThreadHiding = {
init: function() { init: function() {
var ref; var ref;
if (((ref = g.VIEW) !== 'index' && ref !== 'catalog') || !Conf['Thread Hiding Buttons'] && !(Conf['Menu'] && Conf['Thread Hiding Link']) && !Conf['JSON Navigation']) { if (((ref = g.VIEW) !== 'index' && ref !== 'catalog') || !Conf['Thread Hiding Buttons'] && !(Conf['Menu'] && Conf['Thread Hiding Link']) && !Conf['JSON Index']) {
return; return;
} }
this.db = new DataBoard('hiddenThreads'); this.db = new DataBoard('hiddenThreads');
@ -5989,7 +6004,7 @@
open: function(arg) { open: function(arg) {
var isReply, thread; var isReply, thread;
thread = arg.thread, isReply = arg.isReply; thread = arg.thread, isReply = arg.isReply;
if (isReply || thread.isHidden || Conf['JSON Navigation'] && Conf['Index Mode'] === 'catalog') { if (isReply || thread.isHidden || Conf['JSON Index'] && Conf['Index Mode'] === 'catalog') {
return false; return false;
} }
ThreadHiding.menu.thread = thread; ThreadHiding.menu.thread = thread;
@ -6015,7 +6030,7 @@
open: function(arg) { open: function(arg) {
var isReply, thread; var isReply, thread;
thread = arg.thread, isReply = arg.isReply; thread = arg.thread, isReply = arg.isReply;
if (isReply || !thread.isHidden || Conf['JSON Navigation'] && Conf['Index Mode'] === 'catalog') { if (isReply || !thread.isHidden || Conf['JSON Index'] && Conf['Index Mode'] === 'catalog') {
return false; return false;
} }
ThreadHiding.menu.thread = thread; ThreadHiding.menu.thread = thread;
@ -6033,7 +6048,7 @@
open: function(arg) { open: function(arg) {
var isReply, thread; var isReply, thread;
thread = arg.thread, isReply = arg.isReply; thread = arg.thread, isReply = arg.isReply;
if (isReply || !thread.isHidden || Conf['JSON Navigation'] && Conf['Index Mode'] === 'catalog') { if (isReply || !thread.isHidden || Conf['JSON Index'] && Conf['Index Mode'] === 'catalog') {
return false; return false;
} }
return ThreadHiding.menu.thread = thread; return ThreadHiding.menu.thread = thread;
@ -6133,7 +6148,7 @@
} }
threadRoot = thread.OP.nodes.root.parentNode; threadRoot = thread.OP.nodes.root.parentNode;
thread.isHidden = true; thread.isHidden = true;
if (Conf['JSON Navigation']) { if (Conf['JSON Index']) {
Index.updateHideLabel(); Index.updateHideLabel();
} }
if (!makeStub) { if (!makeStub) {
@ -6149,7 +6164,7 @@
} }
threadRoot = thread.OP.nodes.root.parentNode; threadRoot = thread.OP.nodes.root.parentNode;
threadRoot.hidden = thread.isHidden = false; threadRoot.hidden = thread.isHidden = false;
if (Conf['JSON Navigation']) { if (Conf['JSON Index']) {
return Index.updateHideLabel(); return Index.updateHideLabel();
} }
} }
@ -6176,7 +6191,7 @@
if (this.isClone || !this.quotes.length || this.isRebuilt) { if (this.isClone || !this.quotes.length || this.isRebuilt) {
return; return;
} }
markYours = Conf['Mark Quotes of You'] && ((ref = QR.db) != null ? ref.get({ markYours = Conf['Mark Quotes of You'] && ((ref = QuoteYou.db) != null ? ref.get({
boardID: this.board.ID, boardID: this.board.ID,
threadID: this.thread.ID, threadID: this.thread.ID,
postID: this.ID postID: this.ID
@ -6745,9 +6760,26 @@
QuoteYou = { QuoteYou = {
init: function() { init: function() {
var ref; var ref;
if (!(((ref = g.VIEW) === 'index' || ref === 'thread') && Conf['Remember Your Posts'] && Conf['Quick Reply'])) { if (!(((ref = g.VIEW) === 'index' || ref === 'thread') && Conf['Remember Your Posts'])) {
return; return;
} }
this.db = new DataBoard('yourPosts');
$.sync('Remember Your Posts', function(enabled) {
return Conf['Remember Your Posts'] = enabled;
});
$.on(d, 'QRPostSuccessful', function(e) {
var boardID, postID, ref1, threadID;
$.forceSync('Remember Your Posts');
if (Conf['Remember Your Posts']) {
ref1 = e.detail, boardID = ref1.boardID, threadID = ref1.threadID, postID = ref1.postID;
return QuoteYou.db.set({
boardID: boardID,
threadID: threadID,
postID: postID,
val: true
});
}
});
if (Conf['Highlight Own Posts']) { if (Conf['Highlight Own Posts']) {
$.addClass(doc, 'highlight-own'); $.addClass(doc, 'highlight-own');
} }
@ -6768,7 +6800,7 @@
if (this.isClone) { if (this.isClone) {
return; return;
} }
if (QR.db.get({ if (QuoteYou.db.get({
boardID: this.board.ID, boardID: this.board.ID,
threadID: this.thread.ID, threadID: this.thread.ID,
postID: this.ID postID: this.ID
@ -6781,7 +6813,7 @@
ref = this.nodes.quotelinks; ref = this.nodes.quotelinks;
for (k = 0, len1 = ref.length; k < len1; k++) { for (k = 0, len1 = ref.length; k < len1; k++) {
quotelink = ref[k]; quotelink = ref[k];
if (!(QR.db.get(Get.postDataFromLink(quotelink)))) { if (!(QuoteYou.db.get(Get.postDataFromLink(quotelink)))) {
continue; continue;
} }
if (Conf['Mark Quotes of You']) { if (Conf['Mark Quotes of You']) {
@ -6969,12 +7001,6 @@
if (!Conf['Quick Reply']) { if (!Conf['Quick Reply']) {
return; return;
} }
if (Conf['Remember Your Posts']) {
$.sync('Remember Your Posts', function(enabled) {
return Conf['Remember Your Posts'] = enabled;
});
this.db = new DataBoard('yourPosts');
}
this.posts = []; this.posts = [];
if (g.VIEW === 'archive') { if (g.VIEW === 'archive') {
return; return;
@ -7436,7 +7462,7 @@
} }
QR.nodes.fileButton.focus(); QR.nodes.fileButton.focus();
return CrossOrigin.file(url, function(blob) { return CrossOrigin.file(url, function(blob) {
if (blob) { if (blob && !/^text\//.test(blob.type)) {
return QR.handleFiles([blob]); return QR.handleFiles([blob]);
} else { } else {
return QR.error("Can't load file."); return QR.error("Can't load file.");
@ -7803,7 +7829,7 @@
return QR.status(); return QR.status();
}, },
response: function() { response: function() {
var URL, _, ban, err, h1, isReply, lastPostToThread, m, open, post, postID, postsCount, ref, ref1, ref2, ref3, req, resDoc, seconds, threadID; var URL, _, ban, err, h1, isReply, lastPostToThread, m, open, post, postID, postsCount, ref, ref1, ref2, req, resDoc, seconds, threadID;
req = QR.req; req = QR.req;
delete QR.req; delete QR.req;
post = QR.posts[0]; post = QR.posts[0];
@ -7863,17 +7889,6 @@
postID = +postID; postID = +postID;
threadID = +threadID || postID; threadID = +threadID || postID;
isReply = threadID !== postID; isReply = threadID !== postID;
$.forceSync('Remember Your Posts');
if (Conf['Remember Your Posts']) {
if ((ref3 = QR.db) != null) {
ref3.set({
boardID: g.BOARD.ID,
threadID: threadID,
postID: postID,
val: true
});
}
}
$.event('QRPostSuccessful', { $.event('QRPostSuccessful', {
boardID: g.BOARD.ID, boardID: g.BOARD.ID,
threadID: threadID, threadID: threadID,
@ -7887,10 +7902,10 @@
postsCount = QR.posts.length - 1; postsCount = QR.posts.length - 1;
QR.cooldown.auto = postsCount && isReply; QR.cooldown.auto = postsCount && isReply;
lastPostToThread = !((function() { lastPostToThread = !((function() {
var k, len1, p, ref4; var k, len1, p, ref3;
ref4 = QR.posts.slice(1); ref3 = QR.posts.slice(1);
for (k = 0, len1 = ref4.length; k < len1; k++) { for (k = 0, len1 = ref3.length; k < len1; k++) {
p = ref4[k]; p = ref3[k];
if (p.thread === post.thread) { if (p.thread === post.thread) {
return true; return true;
} }
@ -8143,6 +8158,15 @@
if (!(d.cookie.indexOf('pass_enabled=1') < 0)) { if (!(d.cookie.indexOf('pass_enabled=1') < 0)) {
return; return;
} }
if (location.hostname === 'sys.4chan.org' && /[?&]altc\b/.test(location.search) && Main.jsEnabled) {
$.onExists(doc, 'script[src="//www.google.com/recaptcha/api/js/recaptcha_ajax.js"]', function() {
$.global(function() {
return window.el.onload = null;
});
return Captcha.v1.create();
});
return;
}
if (((Conf['Use Recaptcha v1'] && location.hostname === 'boards.4chan.org') || (Conf['Use Recaptcha v1 in Reports'] && location.hostname === 'sys.4chan.org')) && Main.jsEnabled) { if (((Conf['Use Recaptcha v1'] && location.hostname === 'boards.4chan.org') || (Conf['Use Recaptcha v1 in Reports'] && location.hostname === 'sys.4chan.org')) && Main.jsEnabled) {
$.ready(Captcha.replace.v1); $.ready(Captcha.replace.v1);
return; return;
@ -8306,7 +8330,55 @@
} }
}, },
create: function() { create: function() {
return $.globalEval('(function() {\n var container = document.getElementById("captchaContainerAlt");\n if (container.firstChild) return;\n var options = {\n theme: "clean",\n tabindex: {"boards.4chan.org": 5, "sys.4chan.org": 3}[location.hostname]\n };\n if (window.Recaptcha) {\n window.Recaptcha.create("6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc", container, options);\n } else {\n var script = document.head.querySelector(\'script[src="//www.google.com/recaptcha/api/js/recaptcha_ajax.js"]\');\n script.addEventListener(\'load\', function() {\n window.Recaptcha.create("6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc", container, options);\n }, false);\n }\n})();'); var cont, lang;
cont = $.id('captchaContainerAlt');
if (this.occupied) {
return;
}
this.occupied = true;
if ((lang = Conf['captchaLanguage'].trim())) {
cont.dataset.lang = lang;
}
$.onExists(cont, '#recaptcha_image', function(image) {
return $.on(image, 'click', function() {
if ($.id('recaptcha_challenge_image')) {
return $.global(function() {
return window.Recaptcha.reload();
});
}
});
});
$.onExists(cont, '#recaptcha_response_field', function(field) {
$.on(field, 'keydown', function(e) {
if (e.keyCode === 8 && !field.value) {
return $.global(function() {
return window.Recaptcha.reload();
});
}
});
if (location.hostname === 'sys.4chan.org') {
return field.focus();
}
});
return $.global(function() {
var container, options, script;
container = document.getElementById('captchaContainerAlt');
options = {
theme: 'clean',
tabindex: {
"boards.4chan.org": 5
}[location.hostname],
lang: container.dataset.lang
};
if (window.Recaptcha) {
return window.Recaptcha.create('6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc', container, options);
} else {
script = document.head.querySelector('script[src="//www.google.com/recaptcha/api/js/recaptcha_ajax.js"]');
return script.addEventListener('load', function() {
return window.Recaptcha.create('6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc', container, options);
}, false);
}
});
}, },
cb: { cb: {
focus: function() { focus: function() {
@ -8359,7 +8431,11 @@
return QR.captcha.lifetime = e.detail; return QR.captcha.lifetime = e.detail;
}; };
$.on(window, 'captcha:timeout', setLifetime); $.on(window, 'captcha:timeout', setLifetime);
$.globalEval('window.dispatchEvent(new CustomEvent("captcha:timeout", {detail: RecaptchaState.timeout}))'); $.global(function() {
return window.dispatchEvent(new CustomEvent('captcha:timeout', {
detail: window.RecaptchaState.timeout
}));
});
$.off(window, 'captcha:timeout', setLifetime); $.off(window, 'captcha:timeout', setLifetime);
ref = QR.captcha.nodes, img = ref.img, input = ref.input; ref = QR.captcha.nodes, img = ref.img, input = ref.input;
img.parentNode.hidden = false; img.parentNode.hidden = false;
@ -8382,7 +8458,10 @@
if (!this.script) { if (!this.script) {
return; return;
} }
$.globalEval('window.Recaptcha.destroy();'); $.global(function() {
return window.Recaptcha.destroy();
});
delete this.occupied;
if (this.nodes) { if (this.nodes) {
return this.beforeSetup(); return this.beforeSetup();
} }
@ -8502,7 +8581,14 @@
} }
}, },
reload: function(focus) { reload: function(focus) {
$.globalEval('if (window.Recaptcha.type === "image") {\n window.Recaptcha.reload();\n} else {\n window.Recaptcha.switch_type("image");\n}\nwindow.Recaptcha.should_focus = false;'); $.global(function() {
if (window.Recaptcha.type === 'image') {
window.Recaptcha.reload();
} else {
window.Recaptcha.switch_type('image');
}
return window.Recaptcha.should_focus = false;
});
if (focus) { if (focus) {
return this.nodes.input.focus(); return this.nodes.input.focus();
} }
@ -8707,6 +8793,9 @@
} }
}, },
setupIFrame: function(iframe) { setupIFrame: function(iframe) {
if (!doc.contains(iframe)) {
return;
}
Captcha.replace.iframe(iframe); Captcha.replace.iframe(iframe);
$.addClass(QR.nodes.el, 'captcha-open'); $.addClass(QR.nodes.el, 'captcha-open');
this.fixQRPosition(); this.fixQRPosition();
@ -9583,9 +9672,7 @@
QR.status(); QR.status();
return this.updateFlashURL(); return this.updateFlashURL();
case 'com': case 'com':
this.nodes.span.textContent = this.com; this.updateComment();
QR.captcha.onPostChange();
QR.characterCount();
if (QR.cooldown.auto && this === QR.posts[0] && (0 < (ref = QR.cooldown.seconds) && ref <= 5)) { if (QR.cooldown.auto && this === QR.posts[0] && (0 < (ref = QR.cooldown.seconds) && ref <= 5)) {
return QR.cooldown.auto = false; return QR.cooldown.auto = false;
} }
@ -9617,6 +9704,24 @@
} }
}; };
_Class.prototype.setComment = function(com) {
this.com = com || null;
if (this === QR.selected) {
QR.nodes.com.value = this.com;
}
return this.updateComment();
};
_Class.prototype.updateComment = function() {
if (this === QR.selected) {
QR.characterCount();
}
this.nodes.span.textContent = this.com;
return $.queueTask(function() {
return QR.captcha.onPostChange();
});
};
_Class.rmErrored = function(e) { _Class.rmErrored = function(e) {
var error, errors, k, len1, post, q, ref; var error, errors, k, len1, post, q, ref;
e.stopPropagation(); e.stopPropagation();
@ -9701,7 +9806,9 @@
this.filesize = $.bytesToString(this.file.size); this.filesize = $.bytesToString(this.file.size);
this.checkSize(); this.checkSize();
$.addClass(this.nodes.el, 'has-file'); $.addClass(this.nodes.el, 'has-file');
QR.captcha.onPostChange(); $.queueTask(function() {
return QR.captcha.onPostChange();
});
URL.revokeObjectURL(this.URL); URL.revokeObjectURL(this.URL);
this.saveFilename(); this.saveFilename();
if (this === QR.selected) { if (this === QR.selected) {
@ -9883,7 +9990,7 @@
}; };
_Class.prototype.updateFlashURL = function() { _Class.prototype.updateFlashURL = function() {
var oldURL, ref, url; var com, oldURL, ref, url;
if (g.BOARD.ID !== 'f') { if (g.BOARD.ID !== 'f') {
return; return;
} }
@ -9899,14 +10006,9 @@
} }
oldURL = this.flashURL || ''; oldURL = this.flashURL || '';
if (url !== oldURL) { if (url !== oldURL) {
this.com || (this.com = ''); com = this.com || '';
if (this.com.slice(0, oldURL.length) === oldURL) { if (com.slice(0, oldURL.length) === oldURL) {
this.com = this.com.slice(oldURL.length); this.setComment(url + com.slice(oldURL.length));
}
this.com = (url + this.com) || null;
if (this === QR.selected) {
QR.nodes.com.value = this.com;
QR.characterCount();
} }
return this.flashURL = url; return this.flashURL = url;
} }
@ -9918,17 +10020,9 @@
reader = new FileReader(); reader = new FileReader();
reader.onload = (function(_this) { reader.onload = (function(_this) {
return function(e) { return function(e) {
var text; var result;
text = e.target.result; result = e.target.result;
if (_this.com) { _this.setComment((_this.com ? _this.com + "\n" + result : result));
_this.com += "\n" + text;
} else {
_this.com = text;
}
if (QR.selected === _this) {
QR.nodes.com.value = _this.com;
}
_this.nodes.span.textContent = _this.com;
return delete _this.pasting; return delete _this.pasting;
}; };
})(this); })(this);
@ -12859,7 +12953,12 @@
if (!(post.isDead || (post.thread.isDead && !post.thread.isArchived))) { if (!(post.isDead || (post.thread.isDead && !post.thread.isArchived))) {
a.textContent = 'Report'; a.textContent = 'Report';
ReportLink.url = "//sys.4chan.org/" + post.board + "/imgboard.php?mode=report&no=" + post; ReportLink.url = "//sys.4chan.org/" + post.board + "/imgboard.php?mode=report&no=" + post;
ReportLink.dims = Conf['Use Recaptcha v1 in Reports'] || d.cookie.indexOf('pass_enabled=1') >= 0 ? 'width=350,height=275' : 'width=400,height=550'; if ((Conf['Use Recaptcha v1 in Reports'] && Main.jsEnabled) || d.cookie.indexOf('pass_enabled=1') >= 0) {
ReportLink.url += '&altc=1';
ReportLink.dims = 'width=350,height=275';
} else {
ReportLink.dims = 'width=400,height=550';
}
} else if (Conf['Archive Report']) { } else if (Conf['Archive Report']) {
a.textContent = 'Report to archive'; a.textContent = 'Report to archive';
ReportLink.url = Redirect.to('report', { ReportLink.url = Redirect.to('report', {
@ -13598,7 +13697,7 @@
$.addClass(doc, 'toggleable-watcher'); $.addClass(doc, 'toggleable-watcher');
} }
ThreadWatcher.fetchAuto(); ThreadWatcher.fetchAuto();
if (g.VIEW === 'index' && Conf['JSON Navigation'] && Conf['Menu'] && g.BOARD.ID !== 'f') { if (g.VIEW === 'index' && Conf['JSON Index'] && Conf['Menu'] && g.BOARD.ID !== 'f') {
Menu.menu.addEntry({ Menu.menu.addEntry({
el: $.el('a', { el: $.el('a', {
href: 'javascript:;', href: 'javascript:;',
@ -13849,7 +13948,7 @@
var k, len1, ref, thread, threads; var k, len1, ref, thread, threads;
ThreadWatcher.db.forceSync(); ThreadWatcher.db.forceSync();
ThreadWatcher.unreaddb.forceSync(); ThreadWatcher.unreaddb.forceSync();
if ((ref = QR.db) != null) { if ((ref = QuoteYou.db) != null) {
ref.forceSync(); ref.forceSync();
} }
if (!(threads = ThreadWatcher.getAll()).length) { if (!(threads = ThreadWatcher.getAll()).length) {
@ -13911,7 +14010,7 @@
if (!(postObj.no > lastReadPost)) { if (!(postObj.no > lastReadPost)) {
continue; continue;
} }
if ((ref1 = QR.db) != null ? ref1.get({ if ((ref1 = QuoteYou.db) != null ? ref1.get({
boardID: boardID, boardID: boardID,
threadID: threadID, threadID: threadID,
postID: postObj.no postID: postObj.no
@ -13919,13 +14018,13 @@
continue; continue;
} }
unread++; unread++;
if (!(QR.db && postObj.com)) { if (!(QuoteYou.db && postObj.com)) {
continue; continue;
} }
quotesYou = false; quotesYou = false;
regexp = /<a [^>]*\bhref="(?:\/([^\/]+)\/thread\/)?(\d+)?(?:#p(\d+))?"/g; regexp = /<a [^>]*\bhref="(?:\/([^\/]+)\/thread\/)?(\d+)?(?:#p(\d+))?"/g;
while (match = regexp.exec(postObj.com)) { while (match = regexp.exec(postObj.com)) {
if (QR.db.get({ if (QuoteYou.db.get({
boardID: match[1] || boardID, boardID: match[1] || boardID,
threadID: match[2] || threadID, threadID: match[2] || threadID,
postID: match[3] || match[2] || threadID postID: match[3] || match[2] || threadID
@ -14439,7 +14538,7 @@
return; return;
} }
Unread.order.push(this); Unread.order.push(this);
if (this.ID <= Unread.lastReadPost || this.isHidden || ((ref = QR.db) != null ? ref.get({ if (this.ID <= Unread.lastReadPost || this.isHidden || ((ref = QuoteYou.db) != null ? ref.get({
boardID: this.board.ID, boardID: this.board.ID,
threadID: this.thread.ID, threadID: this.thread.ID,
postID: this.ID postID: this.ID
@ -14455,7 +14554,7 @@
ref = post.nodes.quotelinks; ref = post.nodes.quotelinks;
for (k = 0, len1 = ref.length; k < len1; k++) { for (k = 0, len1 = ref.length; k < len1; k++) {
quotelink = ref[k]; quotelink = ref[k];
if (!((ref1 = QR.db) != null ? ref1.get(Get.postDataFromLink(quotelink)) : void 0)) { if (!((ref1 = QuoteYou.db) != null ? ref1.get(Get.postDataFromLink(quotelink)) : void 0)) {
continue; continue;
} }
Unread.postsQuotingYou.add(post.ID); Unread.postsQuotingYou.add(post.ID);
@ -14524,7 +14623,7 @@
count++; count++;
Unread.posts["delete"](ID); Unread.posts["delete"](ID);
Unread.postsQuotingYou["delete"](ID); Unread.postsQuotingYou["delete"](ID);
if ((ref1 = QR.db) != null ? ref1.get({ if ((ref1 = QuoteYou.db) != null ? ref1.get({
boardID: data.board.ID, boardID: data.board.ID,
threadID: data.thread.ID, threadID: data.thread.ID,
postID: ID postID: ID
@ -15053,7 +15152,7 @@
CatalogLinks = { CatalogLinks = {
init: function() { init: function() {
var el, input, selector; var el, input, selector;
if ((Conf['External Catalog'] || Conf['JSON Navigation']) && !(Conf['JSON Navigation'] && g.VIEW === 'index')) { if ((Conf['External Catalog'] || Conf['JSON Index']) && !(Conf['JSON Index'] && g.VIEW === 'index')) {
selector = (function() { selector = (function() {
switch (g.VIEW) { switch (g.VIEW) {
case 'thread': case 'thread':
@ -15072,7 +15171,7 @@
link = ref[k]; link = ref[k];
switch (link.pathname.replace(/\/+/g, '/')) { switch (link.pathname.replace(/\/+/g, '/')) {
case "/" + g.BOARD + "/": case "/" + g.BOARD + "/":
if (Conf['JSON Navigation']) { if (Conf['JSON Index']) {
link.textContent = 'Index'; link.textContent = 'Index';
} }
link.href = CatalogLinks.index(); link.href = CatalogLinks.index();
@ -15080,7 +15179,7 @@
case "/" + g.BOARD + "/catalog": case "/" + g.BOARD + "/catalog":
link.href = CatalogLinks.catalog(); link.href = CatalogLinks.catalog();
} }
if (g.VIEW === 'catalog' && Conf['JSON Navigation'] && Conf['Use 4chan X Catalog']) { if (g.VIEW === 'catalog' && Conf['JSON Index'] && Conf['Use 4chan X Catalog']) {
catalogLink = link.parentNode.cloneNode(true); catalogLink = link.parentNode.cloneNode(true);
catalogLink.firstElementChild.textContent = '4chan X Catalog'; catalogLink.firstElementChild.textContent = '4chan X Catalog';
catalogLink.firstElementChild.href = CatalogLinks.catalog(); catalogLink.firstElementChild.href = CatalogLinks.catalog();
@ -15089,7 +15188,7 @@
} }
}); });
} }
if (Conf['JSON Navigation'] && Conf['Use 4chan X Catalog']) { if (Conf['JSON Index'] && Conf['Use 4chan X Catalog']) {
Post.callbacks.push({ Post.callbacks.push({
name: 'Catalog Link Rewrite', name: 'Catalog Link Rewrite',
cb: this.node cb: this.node
@ -15151,7 +15250,7 @@
} }
if (Conf['External Catalog'] && (board === 'a' || board === 'c' || board === 'g' || board === 'biz' || board === 'k' || board === 'm' || board === 'o' || board === 'p' || board === 'v' || board === 'vg' || board === 'vr' || board === 'w' || board === 'wg' || board === 'cm' || board === '3' || board === 'adv' || board === 'an' || board === 'asp' || board === 'cgl' || board === 'ck' || board === 'co' || board === 'diy' || board === 'fa' || board === 'fit' || board === 'gd' || board === 'int' || board === 'jp' || board === 'lit' || board === 'mlp' || board === 'mu' || board === 'n' || board === 'out' || board === 'po' || board === 'sci' || board === 'sp' || board === 'tg' || board === 'toy' || board === 'trv' || board === 'tv' || board === 'vp' || board === 'wsg' || board === 'x' || board === 'f' || board === 'pol' || board === 's4s' || board === 'lgbt')) { if (Conf['External Catalog'] && (board === 'a' || board === 'c' || board === 'g' || board === 'biz' || board === 'k' || board === 'm' || board === 'o' || board === 'p' || board === 'v' || board === 'vg' || board === 'vr' || board === 'w' || board === 'wg' || board === 'cm' || board === '3' || board === 'adv' || board === 'an' || board === 'asp' || board === 'cgl' || board === 'ck' || board === 'co' || board === 'diy' || board === 'fa' || board === 'fit' || board === 'gd' || board === 'int' || board === 'jp' || board === 'lit' || board === 'mlp' || board === 'mu' || board === 'n' || board === 'out' || board === 'po' || board === 'sci' || board === 'sp' || board === 'tg' || board === 'toy' || board === 'trv' || board === 'tv' || board === 'vp' || board === 'wsg' || board === 'x' || board === 'f' || board === 'pol' || board === 's4s' || board === 'lgbt')) {
return "http://catalog.neet.tv/" + board + "/"; return "http://catalog.neet.tv/" + board + "/";
} else if (Conf['JSON Navigation'] && Conf['Use 4chan X Catalog']) { } else if (Conf['JSON Index'] && Conf['Use 4chan X Catalog']) {
if (g.BOARD.ID === board && g.VIEW === 'index') { if (g.BOARD.ID === board && g.VIEW === 'index') {
return '#catalog'; return '#catalog';
} else { } else {
@ -15165,7 +15264,7 @@
if (board == null) { if (board == null) {
board = g.BOARD.ID; board = g.BOARD.ID;
} }
if (Conf['JSON Navigation'] && board !== 'f') { if (Conf['JSON Index'] && board !== 'f') {
if (g.BOARD.ID === board && g.VIEW === 'index') { if (g.BOARD.ID === board && g.VIEW === 'index') {
return '#index'; return '#index';
} else { } else {
@ -15203,7 +15302,7 @@
ExpandComment = { ExpandComment = {
init: function() { init: function() {
if (g.VIEW !== 'index' || !Conf['Comment Expansion'] || Conf['JSON Navigation']) { if (g.VIEW !== 'index' || !Conf['Comment Expansion'] || Conf['JSON Index']) {
return; return;
} }
if (g.BOARD.ID === 'g') { if (g.BOARD.ID === 'g') {
@ -15309,7 +15408,7 @@
if (g.VIEW === 'thread' || !Conf['Thread Expansion']) { if (g.VIEW === 'thread' || !Conf['Thread Expansion']) {
return; return;
} }
if (Conf['JSON Navigation']) { if (Conf['JSON Index']) {
return $.on(d, 'IndexRefresh', this.onIndexRefresh); return $.on(d, 'IndexRefresh', this.onIndexRefresh);
} else { } else {
return Thread.callbacks.push({ return Thread.callbacks.push({
@ -15395,7 +15494,7 @@
return; return;
} }
replies = $$('.thread > .replyContainer', threadRoot); replies = $$('.thread > .replyContainer', threadRoot);
if (!Conf['JSON Navigation'] || Conf['Show Replies']) { if (!Conf['JSON Index'] || Conf['Show Replies']) {
num = (function() { num = (function() {
if (thread.isSticky) { if (thread.isSticky) {
return 1; return 1;
@ -15823,7 +15922,7 @@
return; return;
} }
} }
if (!(((ref1 = g.VIEW) !== 'index' && ref1 !== 'thread') || g.VIEW === 'index' && Conf['JSON Navigation'] && Conf['Index Mode'] === 'catalog' || g.VIEW === 'index' && g.BOARD.ID === 'f')) { if (!(((ref1 = g.VIEW) !== 'index' && ref1 !== 'thread') || g.VIEW === 'index' && Conf['JSON Index'] && Conf['Index Mode'] === 'catalog' || g.VIEW === 'index' && g.BOARD.ID === 'f')) {
threadRoot = Nav.getThread(); threadRoot = Nav.getThread();
if (op = $('.op', threadRoot)) { if (op = $('.op', threadRoot)) {
thread = Get.postFromNode(op).thread; thread = Get.postFromNode(op).thread;
@ -15927,7 +16026,7 @@
ThreadUpdater.update(); ThreadUpdater.update();
break; break;
case 'index': case 'index':
if (!(Conf['JSON Navigation'] && g.BOARD.ID !== 'f')) { if (!(Conf['JSON Index'] && g.BOARD.ID !== 'f')) {
return; return;
} }
Index.update(); Index.update();
@ -15973,7 +16072,7 @@
FappeTyme.toggle('werk'); FappeTyme.toggle('werk');
break; break;
case Conf['Front page']: case Conf['Front page']:
if (Conf['JSON Navigation'] && g.VIEW === 'index' && g.BOARD.ID !== 'f') { if (Conf['JSON Index'] && g.VIEW === 'index' && g.BOARD.ID !== 'f') {
Index.userPageNav(1); Index.userPageNav(1);
} else { } else {
window.location = "/" + g.BOARD + "/"; window.location = "/" + g.BOARD + "/";
@ -15986,7 +16085,7 @@
if (!(g.VIEW === 'index' && g.BOARD.ID !== 'f')) { if (!(g.VIEW === 'index' && g.BOARD.ID !== 'f')) {
return; return;
} }
if (Conf['JSON Navigation']) { if (Conf['JSON Index']) {
if ((ref4 = Conf['Index Mode']) !== 'paged' && ref4 !== 'infinite') { if ((ref4 = Conf['Index Mode']) !== 'paged' && ref4 !== 'infinite') {
return; return;
} }
@ -16001,7 +16100,7 @@
if (!(g.VIEW === 'index' && g.BOARD.ID !== 'f')) { if (!(g.VIEW === 'index' && g.BOARD.ID !== 'f')) {
return; return;
} }
if (Conf['JSON Navigation']) { if (Conf['JSON Index']) {
if ((ref5 = Conf['Index Mode']) !== 'paged' && ref5 !== 'infinite') { if ((ref5 = Conf['Index Mode']) !== 'paged' && ref5 !== 'infinite') {
return; return;
} }
@ -16016,24 +16115,24 @@
if (!(g.VIEW === 'index' && g.BOARD.ID !== 'f')) { if (!(g.VIEW === 'index' && g.BOARD.ID !== 'f')) {
return; return;
} }
searchInput = Conf['JSON Navigation'] ? Index.searchInput : $.id('search-box'); searchInput = Conf['JSON Index'] ? Index.searchInput : $.id('search-box');
Header.scrollToIfNeeded(searchInput); Header.scrollToIfNeeded(searchInput);
searchInput.focus(); searchInput.focus();
break; break;
case Conf['Paged mode']: case Conf['Paged mode']:
if (!(Conf['JSON Navigation'] && g.BOARD.ID !== 'f')) { if (!(Conf['JSON Index'] && g.BOARD.ID !== 'f')) {
return; return;
} }
window.location = g.VIEW === 'index' ? '#paged' : "/" + g.BOARD + "/#paged"; window.location = g.VIEW === 'index' ? '#paged' : "/" + g.BOARD + "/#paged";
break; break;
case Conf['Infinite scrolling mode']: case Conf['Infinite scrolling mode']:
if (!(Conf['JSON Navigation'] && g.BOARD.ID !== 'f')) { if (!(Conf['JSON Index'] && g.BOARD.ID !== 'f')) {
return; return;
} }
window.location = g.VIEW === 'index' ? '#infinite' : "/" + g.BOARD + "/#infinite"; window.location = g.VIEW === 'index' ? '#infinite' : "/" + g.BOARD + "/#infinite";
break; break;
case Conf['All pages mode']: case Conf['All pages mode']:
if (!(Conf['JSON Navigation'] && g.BOARD.ID !== 'f')) { if (!(Conf['JSON Index'] && g.BOARD.ID !== 'f')) {
return; return;
} }
window.location = g.VIEW === 'index' ? '#all-pages' : "/" + g.BOARD + "/#all-pages"; window.location = g.VIEW === 'index' ? '#all-pages' : "/" + g.BOARD + "/#all-pages";
@ -16045,7 +16144,7 @@
window.location = CatalogLinks.catalog(); window.location = CatalogLinks.catalog();
break; break;
case Conf['Cycle sort type']: case Conf['Cycle sort type']:
if (!(Conf['JSON Navigation'] && g.VIEW === 'index' && g.BOARD.ID !== 'f')) { if (!(Conf['JSON Index'] && g.VIEW === 'index' && g.BOARD.ID !== 'f')) {
return; return;
} }
Index.cycleSortType(); Index.cycleSortType();
@ -16107,13 +16206,13 @@
} }
break; break;
case Conf['Previous Post Quoting You']: case Conf['Previous Post Quoting You']:
if (!(threadRoot && QR.db)) { if (!(threadRoot && QuoteYou.db)) {
return; return;
} }
QuoteYou.cb.seek('preceding'); QuoteYou.cb.seek('preceding');
break; break;
case Conf['Next Post Quoting You']: case Conf['Next Post Quoting You']:
if (!(threadRoot && QR.db)) { if (!(threadRoot && QuoteYou.db)) {
return; return;
} }
QuoteYou.cb.seek('following'); QuoteYou.cb.seek('following');
@ -16407,7 +16506,7 @@
INTERVAL: $.MINUTE / 2, INTERVAL: $.MINUTE / 2,
init: function() { init: function() {
var ref; var ref;
if (((ref = g.VIEW) === 'index' || ref === 'thread') && Conf['Relative Post Dates'] && !Conf['Relative Date Title'] || g.VIEW === 'index' && Conf['JSON Navigation'] && g.BOARD.ID !== 'f') { if (((ref = g.VIEW) === 'index' || ref === 'thread') && Conf['Relative Post Dates'] && !Conf['Relative Date Title'] || g.VIEW === 'index' && Conf['JSON Index'] && g.BOARD.ID !== 'f') {
this.flush(); this.flush();
$.on(d, 'visibilitychange ThreadUpdate', this.flush); $.on(d, 'visibilitychange ThreadUpdate', this.flush);
} }
@ -16541,7 +16640,8 @@
}; };
Report = { Report = {
css: ":root:not(.js-enabled) #captchaContainerAlt {\n" + css: ":root:not(.js-enabled) #g-recaptcha,\n" +
":root:not(.js-enabled) #captchaContainerAlt {\n" +
" height: auto;\n" + " height: auto;\n" +
"}\n" + "}\n" +
"#captchaContainerAlt td:nth-child(2) {\n" + "#captchaContainerAlt td:nth-child(2) {\n" +
@ -16580,7 +16680,7 @@
]); ]);
} }
if (!Conf['Use Recaptcha v1 in Reports'] && !Conf['Force Noscript Captcha'] && Main.jsEnabled) { if (!Conf['Use Recaptcha v1 in Reports'] && !Conf['Force Noscript Captcha'] && Main.jsEnabled) {
new MutationObserver(function() { return new MutationObserver(function() {
Report.fit('iframe[src^="https://www.google.com/recaptcha/api2/frame"]'); Report.fit('iframe[src^="https://www.google.com/recaptcha/api2/frame"]');
return Report.fit('body'); return Report.fit('body');
}).observe(d.body, { }).observe(d.body, {
@ -16589,27 +16689,7 @@
subtree: true subtree: true
}); });
} else { } else {
Report.fit('body'); return Report.fit('body');
}
if (Conf['Use Recaptcha v1 in Reports'] && Main.jsEnabled && d.cookie.indexOf('pass_enabled=1') < 0) {
$.onExists(d.body, '#recaptcha_image', function(image) {
return $.on(image, 'click', function() {
if ($.id('recaptcha_challenge_image')) {
return $.global(function() {
return window.Recaptcha.reload();
});
}
});
});
return $.onExists(d.body, '#recaptcha_response_field', function(field) {
return $.on(field, 'keydown', function(e) {
if (e.keyCode === 8 && !field.value) {
return $.global(function() {
return window.Recaptcha.reload();
});
}
});
});
} }
}, },
fit: function(selector) { fit: function(selector) {
@ -17035,7 +17115,6 @@
}, },
"export": function() { "export": function() {
return $.get(Conf, function(Conf) { return $.get(Conf, function(Conf) {
delete Conf['archives'];
return Settings.downloadExport({ return Settings.downloadExport({
version: g.VERSION, version: g.VERSION,
date: Date.now(), date: Date.now(),
@ -17302,6 +17381,11 @@
set('Use Recaptcha v1 in Reports', true); set('Use Recaptcha v1 in Reports', true);
} }
} }
if (compareString < '00001.00011.00024.00000') {
if ((data['JSON Navigation'] != null) && (data['JSON Index'] == null)) {
set('JSON Index', data['JSON Navigation']);
}
}
return changes; return changes;
}, },
loadSettings: function(data, cb) { loadSettings: function(data, cb) {
@ -17702,6 +17786,7 @@
Conf['selectedArchives'] = {}; Conf['selectedArchives'] = {};
Conf['cooldowns'] = {}; Conf['cooldowns'] = {};
Conf['Except Archives from Encryption'] = false; Conf['Except Archives from Encryption'] = false;
Conf['JSON Navigation'] = true;
items = {}; items = {};
for (key in Conf) { for (key in Conf) {
items[key] = void 0; items[key] = void 0;
@ -17885,6 +17970,7 @@
setStyle = function() { setStyle = function() {
var k, len1, styleSheet; var k, len1, styleSheet;
$.rmClass(doc, style); $.rmClass(doc, style);
style = null;
for (k = 0, len1 = styleSheets.length; k < len1; k++) { for (k = 0, len1 = styleSheets.length; k < len1; k++) {
styleSheet = styleSheets[k]; styleSheet = styleSheets[k];
if (styleSheet.href === (mainStyleSheet != null ? mainStyleSheet.href : void 0)) { if (styleSheet.href === (mainStyleSheet != null ? mainStyleSheet.href : void 0)) {
@ -17892,7 +17978,9 @@
break; break;
} }
} }
if (style) {
return $.addClass(doc, style); return $.addClass(doc, style);
}
}; };
setStyle(); setStyle();
if (!mainStyleSheet) { if (!mainStyleSheet) {
@ -17929,7 +18017,7 @@
}); });
new Notice('warning', msg); new Notice('warning', msg);
} }
if (!(Conf['JSON Navigation'] && g.VIEW === 'index')) { if (!(Conf['JSON Index'] && g.VIEW === 'index')) {
return Main.initThread(); return Main.initThread();
} else { } else {
Main.expectInitFinished = true; Main.expectInitFinished = true;
@ -18744,6 +18832,7 @@
".dialog {\n" + ".dialog {\n" +
" border: 1px solid;\n" + " border: 1px solid;\n" +
" display: block;\n" + " display: block;\n" +
" background-color: inherit;\n" +
"}\n" + "}\n" +
".dialog:not(#qr):not(#thread-watcher):not(#header-bar) {\n" + ".dialog:not(#qr):not(#thread-watcher):not(#header-bar) {\n" +
" box-shadow: 0 1px 2px rgba(0, 0, 0, .15);\n" + " box-shadow: 0 1px 2px rgba(0, 0, 0, .15);\n" +

Binary file not shown.

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name 4chan X // @name 4chan X
// @version 1.11.23.2 // @version 1.11.24.0
// @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.11.23.2 // @version 1.11.24.0
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X
@ -125,7 +125,7 @@
Config = { Config = {
main: { main: {
'Miscellaneous': { 'Miscellaneous': {
'JSON Navigation': [true, 'Replace the original board index with one supporting searching, sorting, infinite scrolling, and a catalog mode.'], 'JSON Index': [true, 'Replace the original board index with one supporting searching, sorting, infinite scrolling, and a catalog mode.'],
'Use 4chan X Catalog': [true, 'Link to 4chan X\'s catalog instead of the native 4chan one.', 1], 'Use 4chan X Catalog': [true, 'Link to 4chan X\'s catalog instead of the native 4chan one.', 1],
'Index Refresh Notifications': [false, 'Show a notice at the top of the page when the index is refreshed.', 1], 'Index Refresh Notifications': [false, 'Show a notice at the top of the page when the index is refreshed.', 1],
'Open Threads in New Tab': [false, 'Make links to threads in the index / 4chan X catalog open in a new tab.'], 'Open Threads in New Tab': [false, 'Make links to threads in the index / 4chan X catalog open in a new tab.'],
@ -140,7 +140,7 @@
'Time Formatting': [true, 'Localize and format timestamps.'], 'Time Formatting': [true, 'Localize and format timestamps.'],
'Relative Post Dates': [true, 'Display dates like "3 minutes ago". Tooltip shows the timestamp.'], 'Relative Post Dates': [true, 'Display dates like "3 minutes ago". Tooltip shows the timestamp.'],
'Relative Date Title': [true, 'Show Relative Post Date only when hovering over dates.', 1], 'Relative Date Title': [true, 'Show Relative Post Date only when hovering over dates.', 1],
'Comment Expansion': [true, 'Expand comments that are too long to display on the index. Not applicable with JSON Navigation.'], 'Comment Expansion': [true, 'Expand comments that are too long to display on the index. Not applicable with JSON Index.'],
'File Info Formatting': [true, 'Reformat the file information.'], 'File Info Formatting': [true, 'Reformat the file information.'],
'Thread Expansion': [true, 'Add buttons to expand threads.'], 'Thread Expansion': [true, 'Add buttons to expand threads.'],
'Index Navigation': [false, 'Add buttons to navigate between threads.'], 'Index Navigation': [false, 'Add buttons to navigate between threads.'],
@ -434,7 +434,7 @@
doc = d.documentElement; doc = d.documentElement;
g = { g = {
VERSION: '1.11.23.2', VERSION: '1.11.24.0',
NAMESPACE: '4chan X.', NAMESPACE: '4chan X.',
boards: {} boards: {}
}; };
@ -539,12 +539,12 @@
innerHTML: "4chan X was blocked from loading the following URL:<br><span></span><br>[<a href=\"https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions#why-was-4chan-x-blocked-from-loading-a-url\" target=\"_blank\">More info</a>]" innerHTML: "4chan X was blocked from loading the following URL:<br><span></span><br>[<a href=\"https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions#why-was-4chan-x-blocked-from-loading-a-url\" target=\"_blank\">More info</a>]"
}); });
$('span', message).textContent = (/^\/\//.test(url) ? location.protocol : '') + url; $('span', message).textContent = (/^\/\//.test(url) ? location.protocol : '') + url;
return new Notice('error', message, 30, function() { return new Notice('warning', message, 30, function() {
return delete blockedURLs[url]; return delete blockedURLs[url];
}); });
}; };
return function(url, options, extra) { return function(url, options, extra) {
var err, form, r, ref, type, upCallbacks, whenModified; var err, event, form, k, len1, r, ref, ref1, type, upCallbacks, whenModified;
if (options == null) { if (options == null) {
options = {}; options = {};
} }
@ -560,13 +560,16 @@
} catch (_error) { } catch (_error) {
err = _error; err = _error;
blockedError(url); blockedError(url);
if (typeof options.onerror === "function") { ref = ['error', 'loadend'];
options.onerror(); for (k = 0, len1 = ref.length; k < len1; k++) {
event = ref[k];
r["on" + event] = options["on" + event];
$.queueTask($.event, event, null, r);
} }
return; return;
} }
if (whenModified) { if (whenModified) {
if (((ref = lastModified[whenModified]) != null ? ref[url] : void 0) != null) { if (((ref1 = lastModified[whenModified]) != null ? ref1[url] : void 0) != null) {
r.setRequestHeader('If-Modified-Since', lastModified[whenModified][url]); r.setRequestHeader('If-Modified-Since', lastModified[whenModified][url]);
} }
$.on(r, 'load', function() { $.on(r, 'load', function() {
@ -1990,7 +1993,9 @@
DataBoard.prototype.ajaxCleanParse = function(boardID, response1, response2) { DataBoard.prototype.ajaxCleanParse = function(boardID, response1, response2) {
var ID, board, k, len1, len2, len3, page, q, ref, thread, threads, u; var ID, board, k, len1, len2, len3, page, q, ref, thread, threads, u;
board = this.data.boards[boardID]; if (!(board = this.data.boards[boardID])) {
return;
}
threads = {}; threads = {};
if (response1) { if (response1) {
for (k = 0, len1 = response1.length; k < len1; k++) { for (k = 0, len1 = response1.length; k < len1; k++) {
@ -3267,7 +3272,7 @@
changed: {}, changed: {},
init: function() { init: function() {
var anchorEntry, input, k, label, len1, len2, name, pinEntry, q, ref, ref1, ref2, ref3, ref4, ref5, refNavEntry, repliesEntry, select; var anchorEntry, input, k, label, len1, len2, name, pinEntry, q, ref, ref1, ref2, ref3, ref4, ref5, refNavEntry, repliesEntry, select;
if (g.BOARD.ID === 'f' || !Conf['JSON Navigation'] || g.VIEW !== 'index') { if (g.BOARD.ID === 'f' || !Conf['JSON Index'] || g.VIEW !== 'index') {
return; return;
} }
CatalogThread.callbacks.push({ CatalogThread.callbacks.push({
@ -3448,7 +3453,7 @@
})(), })(),
menu: { menu: {
init: function() { init: function() {
if (g.VIEW !== 'index' || !Conf['JSON Navigation'] || !Conf['Menu'] || !Conf['Thread Hiding Link'] || g.BOARD.ID === 'f') { if (g.VIEW !== 'index' || !Conf['JSON Index'] || !Conf['Menu'] || !Conf['Thread Hiding Link'] || g.BOARD.ID === 'f') {
return; return;
} }
return Menu.menu.addEntry({ return Menu.menu.addEntry({
@ -3613,7 +3618,7 @@
} }
}, },
scrollToIndex: function() { scrollToIndex: function() {
return Header.scrollToIfNeeded(Index.navLinks); return Header.scrollToIfNeeded((Index.navLinks.getBoundingClientRect().height ? Index.navLinks : Index.root));
}, },
getCurrentPage: function() { getCurrentPage: function() {
return +window.location.pathname.split(/\/+/)[2] || 1; return +window.location.pathname.split(/\/+/)[2] || 1;
@ -3829,6 +3834,7 @@
return; return;
} }
Index.req = $.ajax("//a.4cdn.org/" + g.BOARD + "/catalog.json", { Index.req = $.ajax("//a.4cdn.org/" + g.BOARD + "/catalog.json", {
onabort: Index.load,
onloadend: Index.load onloadend: Index.load
}, { }, {
whenModified: 'Index' whenModified: 'Index'
@ -3847,7 +3853,9 @@
delete Index.notice; delete Index.notice;
if (e.type === 'abort') { if (e.type === 'abort') {
req.onloadend = null; req.onloadend = null;
if (notice != null) {
notice.close(); notice.close();
}
return; return;
} }
if ((ref = req.status) !== 200 && ref !== 304) { if ((ref = req.status) !== 200 && ref !== 304) {
@ -3902,8 +3910,9 @@
return Index.pageLoad(); return Index.pageLoad();
}, },
parseThreadList: function(pages) { parseThreadList: function(pages) {
var ref;
Index.pagesNum = pages.length; Index.pagesNum = pages.length;
Index.threadsNumPerPage = pages[0].threads.length; Index.threadsNumPerPage = ((ref = pages[0]) != null ? ref.threads.length : void 0) || 1;
Index.liveThreadData = pages.reduce((function(arr, next) { Index.liveThreadData = pages.reduce((function(arr, next) {
return arr.concat(next.threads); return arr.concat(next.threads);
}), []); }), []);
@ -3911,8 +3920,8 @@
return data.no; return data.no;
}); });
g.BOARD.threads.forEach(function(thread) { g.BOARD.threads.forEach(function(thread) {
var ref; var ref1;
if (ref = thread.ID, indexOf.call(Index.liveThreadIDs, ref) < 0) { if (ref1 = thread.ID, indexOf.call(Index.liveThreadIDs, ref1) < 0) {
return thread.collect(); return thread.collect();
} }
}); });
@ -4039,8 +4048,10 @@
sort: function() { sort: function() {
var k, len1, liveThreadData, liveThreadIDs, nodes, sortedNodes, sortedThreadIDs, threadID; var k, len1, liveThreadData, liveThreadIDs, nodes, sortedNodes, sortedThreadIDs, threadID;
liveThreadIDs = Index.liveThreadIDs, liveThreadData = Index.liveThreadData; liveThreadIDs = Index.liveThreadIDs, liveThreadData = Index.liveThreadData;
sortedThreadIDs = { sortedThreadIDs = (function() {
lastreply: slice.call(liveThreadData).sort(function(a, b) { switch (Conf['Index Sort']) {
case 'lastreply':
return slice.call(liveThreadData).sort(function(a, b) {
var num; var num;
if ((num = a.last_replies)) { if ((num = a.last_replies)) {
a = num[num.length - 1]; a = num[num.length - 1];
@ -4051,22 +4062,27 @@
return b.no - a.no; return b.no - a.no;
}).map(function(post) { }).map(function(post) {
return post.no; return post.no;
}), });
bump: liveThreadIDs, case 'bump':
birth: slice.call(liveThreadIDs).sort(function(a, b) { return liveThreadIDs;
case 'birth':
return slice.call(liveThreadIDs).sort(function(a, b) {
return b - a; return b - a;
}), });
replycount: slice.call(liveThreadData).sort(function(a, b) { case 'replycount':
return slice.call(liveThreadData).sort(function(a, b) {
return b.replies - a.replies; return b.replies - a.replies;
}).map(function(post) { }).map(function(post) {
return post.no; return post.no;
}), });
filecount: slice.call(liveThreadData).sort(function(a, b) { case 'filecount':
return slice.call(liveThreadData).sort(function(a, b) {
return b.images - a.images; return b.images - a.images;
}).map(function(post) { }).map(function(post) {
return post.no; return post.no;
}) });
}[Conf['Index Sort']]; }
})();
Index.sortedNodes = sortedNodes = []; Index.sortedNodes = sortedNodes = [];
nodes = Index.nodes; nodes = Index.nodes;
for (k = 0, len1 = sortedThreadIDs.length; k < len1; k++) { for (k = 0, len1 = sortedThreadIDs.length; k < len1; k++) {
@ -4321,10 +4337,9 @@
} }
return o; return o;
}, },
parseComment: function(o) { parseComment: function(html) {
var html; html = html.replace(/<br\b[^<]*>/gi, '\n').replace(/\n\n<span\b[^<]* class="abbr"[^]*$/i, '').replace(/^<b\b[^<]*>Rolled [^<]*<\/b>/i, '').replace(/<span\b[^<]* class="fortune"[^]*$/i, '').replace(/<[^>]*>/g, '');
html = o.info.commentHTML.innerHTML.replace(/<br\b[^<]*>/gi, '\n').replace(/\n\n<span\b[^<]* class="abbr"[^]*$/i, '').replace(/^<b\b[^<]*>Rolled [^<]*<\/b>/i, '').replace(/<span\b[^<]* class="fortune"[^]*$/i, '').replace(/<[^>]*>/g, ''); return Build.unescape(html);
return o.info.comment = Build.unescape(html);
}, },
postFromObject: function(data, boardID, suppressThumb) { postFromObject: function(data, boardID, suppressThumb) {
var o; var o;
@ -5413,8 +5428,8 @@
return post.info.subject; return post.info.subject;
}, },
comment: function(post) { comment: function(post) {
var ref; var base1;
return (ref = post.info.comment) != null ? ref : Build.parseComment(post); return (base1 = post.info).comment != null ? base1.comment : base1.comment = Build.parseComment(post.info.commentHTML.innerHTML);
}, },
flag: function(post) { flag: function(post) {
return post.info.flag; return post.info.flag;
@ -5877,7 +5892,7 @@
ThreadHiding = { ThreadHiding = {
init: function() { init: function() {
var ref; var ref;
if (((ref = g.VIEW) !== 'index' && ref !== 'catalog') || !Conf['Thread Hiding Buttons'] && !(Conf['Menu'] && Conf['Thread Hiding Link']) && !Conf['JSON Navigation']) { if (((ref = g.VIEW) !== 'index' && ref !== 'catalog') || !Conf['Thread Hiding Buttons'] && !(Conf['Menu'] && Conf['Thread Hiding Link']) && !Conf['JSON Index']) {
return; return;
} }
this.db = new DataBoard('hiddenThreads'); this.db = new DataBoard('hiddenThreads');
@ -5989,7 +6004,7 @@
open: function(arg) { open: function(arg) {
var isReply, thread; var isReply, thread;
thread = arg.thread, isReply = arg.isReply; thread = arg.thread, isReply = arg.isReply;
if (isReply || thread.isHidden || Conf['JSON Navigation'] && Conf['Index Mode'] === 'catalog') { if (isReply || thread.isHidden || Conf['JSON Index'] && Conf['Index Mode'] === 'catalog') {
return false; return false;
} }
ThreadHiding.menu.thread = thread; ThreadHiding.menu.thread = thread;
@ -6015,7 +6030,7 @@
open: function(arg) { open: function(arg) {
var isReply, thread; var isReply, thread;
thread = arg.thread, isReply = arg.isReply; thread = arg.thread, isReply = arg.isReply;
if (isReply || !thread.isHidden || Conf['JSON Navigation'] && Conf['Index Mode'] === 'catalog') { if (isReply || !thread.isHidden || Conf['JSON Index'] && Conf['Index Mode'] === 'catalog') {
return false; return false;
} }
ThreadHiding.menu.thread = thread; ThreadHiding.menu.thread = thread;
@ -6033,7 +6048,7 @@
open: function(arg) { open: function(arg) {
var isReply, thread; var isReply, thread;
thread = arg.thread, isReply = arg.isReply; thread = arg.thread, isReply = arg.isReply;
if (isReply || !thread.isHidden || Conf['JSON Navigation'] && Conf['Index Mode'] === 'catalog') { if (isReply || !thread.isHidden || Conf['JSON Index'] && Conf['Index Mode'] === 'catalog') {
return false; return false;
} }
return ThreadHiding.menu.thread = thread; return ThreadHiding.menu.thread = thread;
@ -6133,7 +6148,7 @@
} }
threadRoot = thread.OP.nodes.root.parentNode; threadRoot = thread.OP.nodes.root.parentNode;
thread.isHidden = true; thread.isHidden = true;
if (Conf['JSON Navigation']) { if (Conf['JSON Index']) {
Index.updateHideLabel(); Index.updateHideLabel();
} }
if (!makeStub) { if (!makeStub) {
@ -6149,7 +6164,7 @@
} }
threadRoot = thread.OP.nodes.root.parentNode; threadRoot = thread.OP.nodes.root.parentNode;
threadRoot.hidden = thread.isHidden = false; threadRoot.hidden = thread.isHidden = false;
if (Conf['JSON Navigation']) { if (Conf['JSON Index']) {
return Index.updateHideLabel(); return Index.updateHideLabel();
} }
} }
@ -6176,7 +6191,7 @@
if (this.isClone || !this.quotes.length || this.isRebuilt) { if (this.isClone || !this.quotes.length || this.isRebuilt) {
return; return;
} }
markYours = Conf['Mark Quotes of You'] && ((ref = QR.db) != null ? ref.get({ markYours = Conf['Mark Quotes of You'] && ((ref = QuoteYou.db) != null ? ref.get({
boardID: this.board.ID, boardID: this.board.ID,
threadID: this.thread.ID, threadID: this.thread.ID,
postID: this.ID postID: this.ID
@ -6745,9 +6760,26 @@
QuoteYou = { QuoteYou = {
init: function() { init: function() {
var ref; var ref;
if (!(((ref = g.VIEW) === 'index' || ref === 'thread') && Conf['Remember Your Posts'] && Conf['Quick Reply'])) { if (!(((ref = g.VIEW) === 'index' || ref === 'thread') && Conf['Remember Your Posts'])) {
return; return;
} }
this.db = new DataBoard('yourPosts');
$.sync('Remember Your Posts', function(enabled) {
return Conf['Remember Your Posts'] = enabled;
});
$.on(d, 'QRPostSuccessful', function(e) {
var boardID, postID, ref1, threadID;
$.forceSync('Remember Your Posts');
if (Conf['Remember Your Posts']) {
ref1 = e.detail, boardID = ref1.boardID, threadID = ref1.threadID, postID = ref1.postID;
return QuoteYou.db.set({
boardID: boardID,
threadID: threadID,
postID: postID,
val: true
});
}
});
if (Conf['Highlight Own Posts']) { if (Conf['Highlight Own Posts']) {
$.addClass(doc, 'highlight-own'); $.addClass(doc, 'highlight-own');
} }
@ -6768,7 +6800,7 @@
if (this.isClone) { if (this.isClone) {
return; return;
} }
if (QR.db.get({ if (QuoteYou.db.get({
boardID: this.board.ID, boardID: this.board.ID,
threadID: this.thread.ID, threadID: this.thread.ID,
postID: this.ID postID: this.ID
@ -6781,7 +6813,7 @@
ref = this.nodes.quotelinks; ref = this.nodes.quotelinks;
for (k = 0, len1 = ref.length; k < len1; k++) { for (k = 0, len1 = ref.length; k < len1; k++) {
quotelink = ref[k]; quotelink = ref[k];
if (!(QR.db.get(Get.postDataFromLink(quotelink)))) { if (!(QuoteYou.db.get(Get.postDataFromLink(quotelink)))) {
continue; continue;
} }
if (Conf['Mark Quotes of You']) { if (Conf['Mark Quotes of You']) {
@ -6969,12 +7001,6 @@
if (!Conf['Quick Reply']) { if (!Conf['Quick Reply']) {
return; return;
} }
if (Conf['Remember Your Posts']) {
$.sync('Remember Your Posts', function(enabled) {
return Conf['Remember Your Posts'] = enabled;
});
this.db = new DataBoard('yourPosts');
}
this.posts = []; this.posts = [];
if (g.VIEW === 'archive') { if (g.VIEW === 'archive') {
return; return;
@ -7436,7 +7462,7 @@
} }
QR.nodes.fileButton.focus(); QR.nodes.fileButton.focus();
return CrossOrigin.file(url, function(blob) { return CrossOrigin.file(url, function(blob) {
if (blob) { if (blob && !/^text\//.test(blob.type)) {
return QR.handleFiles([blob]); return QR.handleFiles([blob]);
} else { } else {
return QR.error("Can't load file."); return QR.error("Can't load file.");
@ -7803,7 +7829,7 @@
return QR.status(); return QR.status();
}, },
response: function() { response: function() {
var URL, _, ban, err, h1, isReply, lastPostToThread, m, open, post, postID, postsCount, ref, ref1, ref2, ref3, req, resDoc, seconds, threadID; var URL, _, ban, err, h1, isReply, lastPostToThread, m, open, post, postID, postsCount, ref, ref1, ref2, req, resDoc, seconds, threadID;
req = QR.req; req = QR.req;
delete QR.req; delete QR.req;
post = QR.posts[0]; post = QR.posts[0];
@ -7863,17 +7889,6 @@
postID = +postID; postID = +postID;
threadID = +threadID || postID; threadID = +threadID || postID;
isReply = threadID !== postID; isReply = threadID !== postID;
$.forceSync('Remember Your Posts');
if (Conf['Remember Your Posts']) {
if ((ref3 = QR.db) != null) {
ref3.set({
boardID: g.BOARD.ID,
threadID: threadID,
postID: postID,
val: true
});
}
}
$.event('QRPostSuccessful', { $.event('QRPostSuccessful', {
boardID: g.BOARD.ID, boardID: g.BOARD.ID,
threadID: threadID, threadID: threadID,
@ -7887,10 +7902,10 @@
postsCount = QR.posts.length - 1; postsCount = QR.posts.length - 1;
QR.cooldown.auto = postsCount && isReply; QR.cooldown.auto = postsCount && isReply;
lastPostToThread = !((function() { lastPostToThread = !((function() {
var k, len1, p, ref4; var k, len1, p, ref3;
ref4 = QR.posts.slice(1); ref3 = QR.posts.slice(1);
for (k = 0, len1 = ref4.length; k < len1; k++) { for (k = 0, len1 = ref3.length; k < len1; k++) {
p = ref4[k]; p = ref3[k];
if (p.thread === post.thread) { if (p.thread === post.thread) {
return true; return true;
} }
@ -8143,6 +8158,15 @@
if (!(d.cookie.indexOf('pass_enabled=1') < 0)) { if (!(d.cookie.indexOf('pass_enabled=1') < 0)) {
return; return;
} }
if (location.hostname === 'sys.4chan.org' && /[?&]altc\b/.test(location.search) && Main.jsEnabled) {
$.onExists(doc, 'script[src="//www.google.com/recaptcha/api/js/recaptcha_ajax.js"]', function() {
$.global(function() {
return window.el.onload = null;
});
return Captcha.v1.create();
});
return;
}
if (((Conf['Use Recaptcha v1'] && location.hostname === 'boards.4chan.org') || (Conf['Use Recaptcha v1 in Reports'] && location.hostname === 'sys.4chan.org')) && Main.jsEnabled) { if (((Conf['Use Recaptcha v1'] && location.hostname === 'boards.4chan.org') || (Conf['Use Recaptcha v1 in Reports'] && location.hostname === 'sys.4chan.org')) && Main.jsEnabled) {
$.ready(Captcha.replace.v1); $.ready(Captcha.replace.v1);
return; return;
@ -8306,7 +8330,55 @@
} }
}, },
create: function() { create: function() {
return $.globalEval('(function() {\n var container = document.getElementById("captchaContainerAlt");\n if (container.firstChild) return;\n var options = {\n theme: "clean",\n tabindex: {"boards.4chan.org": 5, "sys.4chan.org": 3}[location.hostname]\n };\n if (window.Recaptcha) {\n window.Recaptcha.create("6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc", container, options);\n } else {\n var script = document.head.querySelector(\'script[src="//www.google.com/recaptcha/api/js/recaptcha_ajax.js"]\');\n script.addEventListener(\'load\', function() {\n window.Recaptcha.create("6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc", container, options);\n }, false);\n }\n})();'); var cont, lang;
cont = $.id('captchaContainerAlt');
if (this.occupied) {
return;
}
this.occupied = true;
if ((lang = Conf['captchaLanguage'].trim())) {
cont.dataset.lang = lang;
}
$.onExists(cont, '#recaptcha_image', function(image) {
return $.on(image, 'click', function() {
if ($.id('recaptcha_challenge_image')) {
return $.global(function() {
return window.Recaptcha.reload();
});
}
});
});
$.onExists(cont, '#recaptcha_response_field', function(field) {
$.on(field, 'keydown', function(e) {
if (e.keyCode === 8 && !field.value) {
return $.global(function() {
return window.Recaptcha.reload();
});
}
});
if (location.hostname === 'sys.4chan.org') {
return field.focus();
}
});
return $.global(function() {
var container, options, script;
container = document.getElementById('captchaContainerAlt');
options = {
theme: 'clean',
tabindex: {
"boards.4chan.org": 5
}[location.hostname],
lang: container.dataset.lang
};
if (window.Recaptcha) {
return window.Recaptcha.create('6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc', container, options);
} else {
script = document.head.querySelector('script[src="//www.google.com/recaptcha/api/js/recaptcha_ajax.js"]');
return script.addEventListener('load', function() {
return window.Recaptcha.create('6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc', container, options);
}, false);
}
});
}, },
cb: { cb: {
focus: function() { focus: function() {
@ -8359,7 +8431,11 @@
return QR.captcha.lifetime = e.detail; return QR.captcha.lifetime = e.detail;
}; };
$.on(window, 'captcha:timeout', setLifetime); $.on(window, 'captcha:timeout', setLifetime);
$.globalEval('window.dispatchEvent(new CustomEvent("captcha:timeout", {detail: RecaptchaState.timeout}))'); $.global(function() {
return window.dispatchEvent(new CustomEvent('captcha:timeout', {
detail: window.RecaptchaState.timeout
}));
});
$.off(window, 'captcha:timeout', setLifetime); $.off(window, 'captcha:timeout', setLifetime);
ref = QR.captcha.nodes, img = ref.img, input = ref.input; ref = QR.captcha.nodes, img = ref.img, input = ref.input;
img.parentNode.hidden = false; img.parentNode.hidden = false;
@ -8382,7 +8458,10 @@
if (!this.script) { if (!this.script) {
return; return;
} }
$.globalEval('window.Recaptcha.destroy();'); $.global(function() {
return window.Recaptcha.destroy();
});
delete this.occupied;
if (this.nodes) { if (this.nodes) {
return this.beforeSetup(); return this.beforeSetup();
} }
@ -8502,7 +8581,14 @@
} }
}, },
reload: function(focus) { reload: function(focus) {
$.globalEval('if (window.Recaptcha.type === "image") {\n window.Recaptcha.reload();\n} else {\n window.Recaptcha.switch_type("image");\n}\nwindow.Recaptcha.should_focus = false;'); $.global(function() {
if (window.Recaptcha.type === 'image') {
window.Recaptcha.reload();
} else {
window.Recaptcha.switch_type('image');
}
return window.Recaptcha.should_focus = false;
});
if (focus) { if (focus) {
return this.nodes.input.focus(); return this.nodes.input.focus();
} }
@ -8707,6 +8793,9 @@
} }
}, },
setupIFrame: function(iframe) { setupIFrame: function(iframe) {
if (!doc.contains(iframe)) {
return;
}
Captcha.replace.iframe(iframe); Captcha.replace.iframe(iframe);
$.addClass(QR.nodes.el, 'captcha-open'); $.addClass(QR.nodes.el, 'captcha-open');
this.fixQRPosition(); this.fixQRPosition();
@ -9583,9 +9672,7 @@
QR.status(); QR.status();
return this.updateFlashURL(); return this.updateFlashURL();
case 'com': case 'com':
this.nodes.span.textContent = this.com; this.updateComment();
QR.captcha.onPostChange();
QR.characterCount();
if (QR.cooldown.auto && this === QR.posts[0] && (0 < (ref = QR.cooldown.seconds) && ref <= 5)) { if (QR.cooldown.auto && this === QR.posts[0] && (0 < (ref = QR.cooldown.seconds) && ref <= 5)) {
return QR.cooldown.auto = false; return QR.cooldown.auto = false;
} }
@ -9617,6 +9704,24 @@
} }
}; };
_Class.prototype.setComment = function(com) {
this.com = com || null;
if (this === QR.selected) {
QR.nodes.com.value = this.com;
}
return this.updateComment();
};
_Class.prototype.updateComment = function() {
if (this === QR.selected) {
QR.characterCount();
}
this.nodes.span.textContent = this.com;
return $.queueTask(function() {
return QR.captcha.onPostChange();
});
};
_Class.rmErrored = function(e) { _Class.rmErrored = function(e) {
var error, errors, k, len1, post, q, ref; var error, errors, k, len1, post, q, ref;
e.stopPropagation(); e.stopPropagation();
@ -9701,7 +9806,9 @@
this.filesize = $.bytesToString(this.file.size); this.filesize = $.bytesToString(this.file.size);
this.checkSize(); this.checkSize();
$.addClass(this.nodes.el, 'has-file'); $.addClass(this.nodes.el, 'has-file');
QR.captcha.onPostChange(); $.queueTask(function() {
return QR.captcha.onPostChange();
});
URL.revokeObjectURL(this.URL); URL.revokeObjectURL(this.URL);
this.saveFilename(); this.saveFilename();
if (this === QR.selected) { if (this === QR.selected) {
@ -9883,7 +9990,7 @@
}; };
_Class.prototype.updateFlashURL = function() { _Class.prototype.updateFlashURL = function() {
var oldURL, ref, url; var com, oldURL, ref, url;
if (g.BOARD.ID !== 'f') { if (g.BOARD.ID !== 'f') {
return; return;
} }
@ -9899,14 +10006,9 @@
} }
oldURL = this.flashURL || ''; oldURL = this.flashURL || '';
if (url !== oldURL) { if (url !== oldURL) {
this.com || (this.com = ''); com = this.com || '';
if (this.com.slice(0, oldURL.length) === oldURL) { if (com.slice(0, oldURL.length) === oldURL) {
this.com = this.com.slice(oldURL.length); this.setComment(url + com.slice(oldURL.length));
}
this.com = (url + this.com) || null;
if (this === QR.selected) {
QR.nodes.com.value = this.com;
QR.characterCount();
} }
return this.flashURL = url; return this.flashURL = url;
} }
@ -9918,17 +10020,9 @@
reader = new FileReader(); reader = new FileReader();
reader.onload = (function(_this) { reader.onload = (function(_this) {
return function(e) { return function(e) {
var text; var result;
text = e.target.result; result = e.target.result;
if (_this.com) { _this.setComment((_this.com ? _this.com + "\n" + result : result));
_this.com += "\n" + text;
} else {
_this.com = text;
}
if (QR.selected === _this) {
QR.nodes.com.value = _this.com;
}
_this.nodes.span.textContent = _this.com;
return delete _this.pasting; return delete _this.pasting;
}; };
})(this); })(this);
@ -12859,7 +12953,12 @@
if (!(post.isDead || (post.thread.isDead && !post.thread.isArchived))) { if (!(post.isDead || (post.thread.isDead && !post.thread.isArchived))) {
a.textContent = 'Report'; a.textContent = 'Report';
ReportLink.url = "//sys.4chan.org/" + post.board + "/imgboard.php?mode=report&no=" + post; ReportLink.url = "//sys.4chan.org/" + post.board + "/imgboard.php?mode=report&no=" + post;
ReportLink.dims = Conf['Use Recaptcha v1 in Reports'] || d.cookie.indexOf('pass_enabled=1') >= 0 ? 'width=350,height=275' : 'width=400,height=550'; if ((Conf['Use Recaptcha v1 in Reports'] && Main.jsEnabled) || d.cookie.indexOf('pass_enabled=1') >= 0) {
ReportLink.url += '&altc=1';
ReportLink.dims = 'width=350,height=275';
} else {
ReportLink.dims = 'width=400,height=550';
}
} else if (Conf['Archive Report']) { } else if (Conf['Archive Report']) {
a.textContent = 'Report to archive'; a.textContent = 'Report to archive';
ReportLink.url = Redirect.to('report', { ReportLink.url = Redirect.to('report', {
@ -13598,7 +13697,7 @@
$.addClass(doc, 'toggleable-watcher'); $.addClass(doc, 'toggleable-watcher');
} }
ThreadWatcher.fetchAuto(); ThreadWatcher.fetchAuto();
if (g.VIEW === 'index' && Conf['JSON Navigation'] && Conf['Menu'] && g.BOARD.ID !== 'f') { if (g.VIEW === 'index' && Conf['JSON Index'] && Conf['Menu'] && g.BOARD.ID !== 'f') {
Menu.menu.addEntry({ Menu.menu.addEntry({
el: $.el('a', { el: $.el('a', {
href: 'javascript:;', href: 'javascript:;',
@ -13849,7 +13948,7 @@
var k, len1, ref, thread, threads; var k, len1, ref, thread, threads;
ThreadWatcher.db.forceSync(); ThreadWatcher.db.forceSync();
ThreadWatcher.unreaddb.forceSync(); ThreadWatcher.unreaddb.forceSync();
if ((ref = QR.db) != null) { if ((ref = QuoteYou.db) != null) {
ref.forceSync(); ref.forceSync();
} }
if (!(threads = ThreadWatcher.getAll()).length) { if (!(threads = ThreadWatcher.getAll()).length) {
@ -13911,7 +14010,7 @@
if (!(postObj.no > lastReadPost)) { if (!(postObj.no > lastReadPost)) {
continue; continue;
} }
if ((ref1 = QR.db) != null ? ref1.get({ if ((ref1 = QuoteYou.db) != null ? ref1.get({
boardID: boardID, boardID: boardID,
threadID: threadID, threadID: threadID,
postID: postObj.no postID: postObj.no
@ -13919,13 +14018,13 @@
continue; continue;
} }
unread++; unread++;
if (!(QR.db && postObj.com)) { if (!(QuoteYou.db && postObj.com)) {
continue; continue;
} }
quotesYou = false; quotesYou = false;
regexp = /<a [^>]*\bhref="(?:\/([^\/]+)\/thread\/)?(\d+)?(?:#p(\d+))?"/g; regexp = /<a [^>]*\bhref="(?:\/([^\/]+)\/thread\/)?(\d+)?(?:#p(\d+))?"/g;
while (match = regexp.exec(postObj.com)) { while (match = regexp.exec(postObj.com)) {
if (QR.db.get({ if (QuoteYou.db.get({
boardID: match[1] || boardID, boardID: match[1] || boardID,
threadID: match[2] || threadID, threadID: match[2] || threadID,
postID: match[3] || match[2] || threadID postID: match[3] || match[2] || threadID
@ -14439,7 +14538,7 @@
return; return;
} }
Unread.order.push(this); Unread.order.push(this);
if (this.ID <= Unread.lastReadPost || this.isHidden || ((ref = QR.db) != null ? ref.get({ if (this.ID <= Unread.lastReadPost || this.isHidden || ((ref = QuoteYou.db) != null ? ref.get({
boardID: this.board.ID, boardID: this.board.ID,
threadID: this.thread.ID, threadID: this.thread.ID,
postID: this.ID postID: this.ID
@ -14455,7 +14554,7 @@
ref = post.nodes.quotelinks; ref = post.nodes.quotelinks;
for (k = 0, len1 = ref.length; k < len1; k++) { for (k = 0, len1 = ref.length; k < len1; k++) {
quotelink = ref[k]; quotelink = ref[k];
if (!((ref1 = QR.db) != null ? ref1.get(Get.postDataFromLink(quotelink)) : void 0)) { if (!((ref1 = QuoteYou.db) != null ? ref1.get(Get.postDataFromLink(quotelink)) : void 0)) {
continue; continue;
} }
Unread.postsQuotingYou.add(post.ID); Unread.postsQuotingYou.add(post.ID);
@ -14524,7 +14623,7 @@
count++; count++;
Unread.posts["delete"](ID); Unread.posts["delete"](ID);
Unread.postsQuotingYou["delete"](ID); Unread.postsQuotingYou["delete"](ID);
if ((ref1 = QR.db) != null ? ref1.get({ if ((ref1 = QuoteYou.db) != null ? ref1.get({
boardID: data.board.ID, boardID: data.board.ID,
threadID: data.thread.ID, threadID: data.thread.ID,
postID: ID postID: ID
@ -15053,7 +15152,7 @@
CatalogLinks = { CatalogLinks = {
init: function() { init: function() {
var el, input, selector; var el, input, selector;
if ((Conf['External Catalog'] || Conf['JSON Navigation']) && !(Conf['JSON Navigation'] && g.VIEW === 'index')) { if ((Conf['External Catalog'] || Conf['JSON Index']) && !(Conf['JSON Index'] && g.VIEW === 'index')) {
selector = (function() { selector = (function() {
switch (g.VIEW) { switch (g.VIEW) {
case 'thread': case 'thread':
@ -15072,7 +15171,7 @@
link = ref[k]; link = ref[k];
switch (link.pathname.replace(/\/+/g, '/')) { switch (link.pathname.replace(/\/+/g, '/')) {
case "/" + g.BOARD + "/": case "/" + g.BOARD + "/":
if (Conf['JSON Navigation']) { if (Conf['JSON Index']) {
link.textContent = 'Index'; link.textContent = 'Index';
} }
link.href = CatalogLinks.index(); link.href = CatalogLinks.index();
@ -15080,7 +15179,7 @@
case "/" + g.BOARD + "/catalog": case "/" + g.BOARD + "/catalog":
link.href = CatalogLinks.catalog(); link.href = CatalogLinks.catalog();
} }
if (g.VIEW === 'catalog' && Conf['JSON Navigation'] && Conf['Use 4chan X Catalog']) { if (g.VIEW === 'catalog' && Conf['JSON Index'] && Conf['Use 4chan X Catalog']) {
catalogLink = link.parentNode.cloneNode(true); catalogLink = link.parentNode.cloneNode(true);
catalogLink.firstElementChild.textContent = '4chan X Catalog'; catalogLink.firstElementChild.textContent = '4chan X Catalog';
catalogLink.firstElementChild.href = CatalogLinks.catalog(); catalogLink.firstElementChild.href = CatalogLinks.catalog();
@ -15089,7 +15188,7 @@
} }
}); });
} }
if (Conf['JSON Navigation'] && Conf['Use 4chan X Catalog']) { if (Conf['JSON Index'] && Conf['Use 4chan X Catalog']) {
Post.callbacks.push({ Post.callbacks.push({
name: 'Catalog Link Rewrite', name: 'Catalog Link Rewrite',
cb: this.node cb: this.node
@ -15151,7 +15250,7 @@
} }
if (Conf['External Catalog'] && (board === 'a' || board === 'c' || board === 'g' || board === 'biz' || board === 'k' || board === 'm' || board === 'o' || board === 'p' || board === 'v' || board === 'vg' || board === 'vr' || board === 'w' || board === 'wg' || board === 'cm' || board === '3' || board === 'adv' || board === 'an' || board === 'asp' || board === 'cgl' || board === 'ck' || board === 'co' || board === 'diy' || board === 'fa' || board === 'fit' || board === 'gd' || board === 'int' || board === 'jp' || board === 'lit' || board === 'mlp' || board === 'mu' || board === 'n' || board === 'out' || board === 'po' || board === 'sci' || board === 'sp' || board === 'tg' || board === 'toy' || board === 'trv' || board === 'tv' || board === 'vp' || board === 'wsg' || board === 'x' || board === 'f' || board === 'pol' || board === 's4s' || board === 'lgbt')) { if (Conf['External Catalog'] && (board === 'a' || board === 'c' || board === 'g' || board === 'biz' || board === 'k' || board === 'm' || board === 'o' || board === 'p' || board === 'v' || board === 'vg' || board === 'vr' || board === 'w' || board === 'wg' || board === 'cm' || board === '3' || board === 'adv' || board === 'an' || board === 'asp' || board === 'cgl' || board === 'ck' || board === 'co' || board === 'diy' || board === 'fa' || board === 'fit' || board === 'gd' || board === 'int' || board === 'jp' || board === 'lit' || board === 'mlp' || board === 'mu' || board === 'n' || board === 'out' || board === 'po' || board === 'sci' || board === 'sp' || board === 'tg' || board === 'toy' || board === 'trv' || board === 'tv' || board === 'vp' || board === 'wsg' || board === 'x' || board === 'f' || board === 'pol' || board === 's4s' || board === 'lgbt')) {
return "http://catalog.neet.tv/" + board + "/"; return "http://catalog.neet.tv/" + board + "/";
} else if (Conf['JSON Navigation'] && Conf['Use 4chan X Catalog']) { } else if (Conf['JSON Index'] && Conf['Use 4chan X Catalog']) {
if (g.BOARD.ID === board && g.VIEW === 'index') { if (g.BOARD.ID === board && g.VIEW === 'index') {
return '#catalog'; return '#catalog';
} else { } else {
@ -15165,7 +15264,7 @@
if (board == null) { if (board == null) {
board = g.BOARD.ID; board = g.BOARD.ID;
} }
if (Conf['JSON Navigation'] && board !== 'f') { if (Conf['JSON Index'] && board !== 'f') {
if (g.BOARD.ID === board && g.VIEW === 'index') { if (g.BOARD.ID === board && g.VIEW === 'index') {
return '#index'; return '#index';
} else { } else {
@ -15203,7 +15302,7 @@
ExpandComment = { ExpandComment = {
init: function() { init: function() {
if (g.VIEW !== 'index' || !Conf['Comment Expansion'] || Conf['JSON Navigation']) { if (g.VIEW !== 'index' || !Conf['Comment Expansion'] || Conf['JSON Index']) {
return; return;
} }
if (g.BOARD.ID === 'g') { if (g.BOARD.ID === 'g') {
@ -15309,7 +15408,7 @@
if (g.VIEW === 'thread' || !Conf['Thread Expansion']) { if (g.VIEW === 'thread' || !Conf['Thread Expansion']) {
return; return;
} }
if (Conf['JSON Navigation']) { if (Conf['JSON Index']) {
return $.on(d, 'IndexRefresh', this.onIndexRefresh); return $.on(d, 'IndexRefresh', this.onIndexRefresh);
} else { } else {
return Thread.callbacks.push({ return Thread.callbacks.push({
@ -15395,7 +15494,7 @@
return; return;
} }
replies = $$('.thread > .replyContainer', threadRoot); replies = $$('.thread > .replyContainer', threadRoot);
if (!Conf['JSON Navigation'] || Conf['Show Replies']) { if (!Conf['JSON Index'] || Conf['Show Replies']) {
num = (function() { num = (function() {
if (thread.isSticky) { if (thread.isSticky) {
return 1; return 1;
@ -15823,7 +15922,7 @@
return; return;
} }
} }
if (!(((ref1 = g.VIEW) !== 'index' && ref1 !== 'thread') || g.VIEW === 'index' && Conf['JSON Navigation'] && Conf['Index Mode'] === 'catalog' || g.VIEW === 'index' && g.BOARD.ID === 'f')) { if (!(((ref1 = g.VIEW) !== 'index' && ref1 !== 'thread') || g.VIEW === 'index' && Conf['JSON Index'] && Conf['Index Mode'] === 'catalog' || g.VIEW === 'index' && g.BOARD.ID === 'f')) {
threadRoot = Nav.getThread(); threadRoot = Nav.getThread();
if (op = $('.op', threadRoot)) { if (op = $('.op', threadRoot)) {
thread = Get.postFromNode(op).thread; thread = Get.postFromNode(op).thread;
@ -15927,7 +16026,7 @@
ThreadUpdater.update(); ThreadUpdater.update();
break; break;
case 'index': case 'index':
if (!(Conf['JSON Navigation'] && g.BOARD.ID !== 'f')) { if (!(Conf['JSON Index'] && g.BOARD.ID !== 'f')) {
return; return;
} }
Index.update(); Index.update();
@ -15973,7 +16072,7 @@
FappeTyme.toggle('werk'); FappeTyme.toggle('werk');
break; break;
case Conf['Front page']: case Conf['Front page']:
if (Conf['JSON Navigation'] && g.VIEW === 'index' && g.BOARD.ID !== 'f') { if (Conf['JSON Index'] && g.VIEW === 'index' && g.BOARD.ID !== 'f') {
Index.userPageNav(1); Index.userPageNav(1);
} else { } else {
window.location = "/" + g.BOARD + "/"; window.location = "/" + g.BOARD + "/";
@ -15986,7 +16085,7 @@
if (!(g.VIEW === 'index' && g.BOARD.ID !== 'f')) { if (!(g.VIEW === 'index' && g.BOARD.ID !== 'f')) {
return; return;
} }
if (Conf['JSON Navigation']) { if (Conf['JSON Index']) {
if ((ref4 = Conf['Index Mode']) !== 'paged' && ref4 !== 'infinite') { if ((ref4 = Conf['Index Mode']) !== 'paged' && ref4 !== 'infinite') {
return; return;
} }
@ -16001,7 +16100,7 @@
if (!(g.VIEW === 'index' && g.BOARD.ID !== 'f')) { if (!(g.VIEW === 'index' && g.BOARD.ID !== 'f')) {
return; return;
} }
if (Conf['JSON Navigation']) { if (Conf['JSON Index']) {
if ((ref5 = Conf['Index Mode']) !== 'paged' && ref5 !== 'infinite') { if ((ref5 = Conf['Index Mode']) !== 'paged' && ref5 !== 'infinite') {
return; return;
} }
@ -16016,24 +16115,24 @@
if (!(g.VIEW === 'index' && g.BOARD.ID !== 'f')) { if (!(g.VIEW === 'index' && g.BOARD.ID !== 'f')) {
return; return;
} }
searchInput = Conf['JSON Navigation'] ? Index.searchInput : $.id('search-box'); searchInput = Conf['JSON Index'] ? Index.searchInput : $.id('search-box');
Header.scrollToIfNeeded(searchInput); Header.scrollToIfNeeded(searchInput);
searchInput.focus(); searchInput.focus();
break; break;
case Conf['Paged mode']: case Conf['Paged mode']:
if (!(Conf['JSON Navigation'] && g.BOARD.ID !== 'f')) { if (!(Conf['JSON Index'] && g.BOARD.ID !== 'f')) {
return; return;
} }
window.location = g.VIEW === 'index' ? '#paged' : "/" + g.BOARD + "/#paged"; window.location = g.VIEW === 'index' ? '#paged' : "/" + g.BOARD + "/#paged";
break; break;
case Conf['Infinite scrolling mode']: case Conf['Infinite scrolling mode']:
if (!(Conf['JSON Navigation'] && g.BOARD.ID !== 'f')) { if (!(Conf['JSON Index'] && g.BOARD.ID !== 'f')) {
return; return;
} }
window.location = g.VIEW === 'index' ? '#infinite' : "/" + g.BOARD + "/#infinite"; window.location = g.VIEW === 'index' ? '#infinite' : "/" + g.BOARD + "/#infinite";
break; break;
case Conf['All pages mode']: case Conf['All pages mode']:
if (!(Conf['JSON Navigation'] && g.BOARD.ID !== 'f')) { if (!(Conf['JSON Index'] && g.BOARD.ID !== 'f')) {
return; return;
} }
window.location = g.VIEW === 'index' ? '#all-pages' : "/" + g.BOARD + "/#all-pages"; window.location = g.VIEW === 'index' ? '#all-pages' : "/" + g.BOARD + "/#all-pages";
@ -16045,7 +16144,7 @@
window.location = CatalogLinks.catalog(); window.location = CatalogLinks.catalog();
break; break;
case Conf['Cycle sort type']: case Conf['Cycle sort type']:
if (!(Conf['JSON Navigation'] && g.VIEW === 'index' && g.BOARD.ID !== 'f')) { if (!(Conf['JSON Index'] && g.VIEW === 'index' && g.BOARD.ID !== 'f')) {
return; return;
} }
Index.cycleSortType(); Index.cycleSortType();
@ -16107,13 +16206,13 @@
} }
break; break;
case Conf['Previous Post Quoting You']: case Conf['Previous Post Quoting You']:
if (!(threadRoot && QR.db)) { if (!(threadRoot && QuoteYou.db)) {
return; return;
} }
QuoteYou.cb.seek('preceding'); QuoteYou.cb.seek('preceding');
break; break;
case Conf['Next Post Quoting You']: case Conf['Next Post Quoting You']:
if (!(threadRoot && QR.db)) { if (!(threadRoot && QuoteYou.db)) {
return; return;
} }
QuoteYou.cb.seek('following'); QuoteYou.cb.seek('following');
@ -16407,7 +16506,7 @@
INTERVAL: $.MINUTE / 2, INTERVAL: $.MINUTE / 2,
init: function() { init: function() {
var ref; var ref;
if (((ref = g.VIEW) === 'index' || ref === 'thread') && Conf['Relative Post Dates'] && !Conf['Relative Date Title'] || g.VIEW === 'index' && Conf['JSON Navigation'] && g.BOARD.ID !== 'f') { if (((ref = g.VIEW) === 'index' || ref === 'thread') && Conf['Relative Post Dates'] && !Conf['Relative Date Title'] || g.VIEW === 'index' && Conf['JSON Index'] && g.BOARD.ID !== 'f') {
this.flush(); this.flush();
$.on(d, 'visibilitychange ThreadUpdate', this.flush); $.on(d, 'visibilitychange ThreadUpdate', this.flush);
} }
@ -16541,7 +16640,8 @@
}; };
Report = { Report = {
css: ":root:not(.js-enabled) #captchaContainerAlt {\n" + css: ":root:not(.js-enabled) #g-recaptcha,\n" +
":root:not(.js-enabled) #captchaContainerAlt {\n" +
" height: auto;\n" + " height: auto;\n" +
"}\n" + "}\n" +
"#captchaContainerAlt td:nth-child(2) {\n" + "#captchaContainerAlt td:nth-child(2) {\n" +
@ -16580,7 +16680,7 @@
]); ]);
} }
if (!Conf['Use Recaptcha v1 in Reports'] && !Conf['Force Noscript Captcha'] && Main.jsEnabled) { if (!Conf['Use Recaptcha v1 in Reports'] && !Conf['Force Noscript Captcha'] && Main.jsEnabled) {
new MutationObserver(function() { return new MutationObserver(function() {
Report.fit('iframe[src^="https://www.google.com/recaptcha/api2/frame"]'); Report.fit('iframe[src^="https://www.google.com/recaptcha/api2/frame"]');
return Report.fit('body'); return Report.fit('body');
}).observe(d.body, { }).observe(d.body, {
@ -16589,27 +16689,7 @@
subtree: true subtree: true
}); });
} else { } else {
Report.fit('body'); return Report.fit('body');
}
if (Conf['Use Recaptcha v1 in Reports'] && Main.jsEnabled && d.cookie.indexOf('pass_enabled=1') < 0) {
$.onExists(d.body, '#recaptcha_image', function(image) {
return $.on(image, 'click', function() {
if ($.id('recaptcha_challenge_image')) {
return $.global(function() {
return window.Recaptcha.reload();
});
}
});
});
return $.onExists(d.body, '#recaptcha_response_field', function(field) {
return $.on(field, 'keydown', function(e) {
if (e.keyCode === 8 && !field.value) {
return $.global(function() {
return window.Recaptcha.reload();
});
}
});
});
} }
}, },
fit: function(selector) { fit: function(selector) {
@ -17035,7 +17115,6 @@
}, },
"export": function() { "export": function() {
return $.get(Conf, function(Conf) { return $.get(Conf, function(Conf) {
delete Conf['archives'];
return Settings.downloadExport({ return Settings.downloadExport({
version: g.VERSION, version: g.VERSION,
date: Date.now(), date: Date.now(),
@ -17302,6 +17381,11 @@
set('Use Recaptcha v1 in Reports', true); set('Use Recaptcha v1 in Reports', true);
} }
} }
if (compareString < '00001.00011.00024.00000') {
if ((data['JSON Navigation'] != null) && (data['JSON Index'] == null)) {
set('JSON Index', data['JSON Navigation']);
}
}
return changes; return changes;
}, },
loadSettings: function(data, cb) { loadSettings: function(data, cb) {
@ -17702,6 +17786,7 @@
Conf['selectedArchives'] = {}; Conf['selectedArchives'] = {};
Conf['cooldowns'] = {}; Conf['cooldowns'] = {};
Conf['Except Archives from Encryption'] = false; Conf['Except Archives from Encryption'] = false;
Conf['JSON Navigation'] = true;
items = {}; items = {};
for (key in Conf) { for (key in Conf) {
items[key] = void 0; items[key] = void 0;
@ -17885,6 +17970,7 @@
setStyle = function() { setStyle = function() {
var k, len1, styleSheet; var k, len1, styleSheet;
$.rmClass(doc, style); $.rmClass(doc, style);
style = null;
for (k = 0, len1 = styleSheets.length; k < len1; k++) { for (k = 0, len1 = styleSheets.length; k < len1; k++) {
styleSheet = styleSheets[k]; styleSheet = styleSheets[k];
if (styleSheet.href === (mainStyleSheet != null ? mainStyleSheet.href : void 0)) { if (styleSheet.href === (mainStyleSheet != null ? mainStyleSheet.href : void 0)) {
@ -17892,7 +17978,9 @@
break; break;
} }
} }
if (style) {
return $.addClass(doc, style); return $.addClass(doc, style);
}
}; };
setStyle(); setStyle();
if (!mainStyleSheet) { if (!mainStyleSheet) {
@ -17929,7 +18017,7 @@
}); });
new Notice('warning', msg); new Notice('warning', msg);
} }
if (!(Conf['JSON Navigation'] && g.VIEW === 'index')) { if (!(Conf['JSON Index'] && g.VIEW === 'index')) {
return Main.initThread(); return Main.initThread();
} else { } else {
Main.expectInitFinished = true; Main.expectInitFinished = true;
@ -18744,6 +18832,7 @@
".dialog {\n" + ".dialog {\n" +
" border: 1px solid;\n" + " border: 1px solid;\n" +
" display: block;\n" + " display: block;\n" +
" background-color: inherit;\n" +
"}\n" + "}\n" +
".dialog:not(#qr):not(#thread-watcher):not(#header-bar) {\n" + ".dialog:not(#qr):not(#thread-watcher):not(#header-bar) {\n" +
" box-shadow: 0 1px 2px rgba(0, 0, 0, .15);\n" + " box-shadow: 0 1px 2px rgba(0, 0, 0, .15);\n" +

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://www.4chan-x.net/builds/4chan-X-beta.crx' version='1.11.23.2' /> <updatecheck codebase='https://www.4chan-x.net/builds/4chan-X-beta.crx' version='1.11.24.0' />
</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://www.4chan-x.net/builds/4chan-X.crx' version='1.11.23.2' /> <updatecheck codebase='https://www.4chan-x.net/builds/4chan-X.crx' version='1.11.24.0' />
</app> </app>
</gupdate> </gupdate>

View File

@ -1,4 +1,4 @@
{ {
"version": "1.11.23.2", "version": "1.11.24.0",
"date": "2016-01-28T16:54:58.905Z" "date": "2016-02-01T05:44:50.088Z"
} }