diff --git a/CHANGELOG.md b/CHANGELOG.md
index 812713f51..6a07d30cb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,11 @@
### v1.14.7
+**v1.14.7.1** *(2019-04-09)* - [[Userscript](https://raw.githubusercontent.com/ccd0/4chan-x/1.14.7.1/builds/4chan-X-noupdate.user.js)] [[Chrome extension](https://raw.githubusercontent.com/ccd0/4chan-x/1.14.7.1/builds/4chan-X-noupdate.crx)]
+- Tolerate broken HTML better.
+- Fix 4chan/4channel not being correct in certain links.
+- Use boards.json to determine whether to activate [code] and [math] tag related functions. #525
+
**v1.14.7.0** *(2019-04-07)* - [[Userscript](https://raw.githubusercontent.com/ccd0/4chan-x/1.14.7.0/builds/4chan-X-noupdate.user.js)] [[Chrome extension](https://raw.githubusercontent.com/ccd0/4chan-x/1.14.7.0/builds/4chan-X-noupdate.crx)]
- Based on v1.14.6.8.
- (Teasday) Hotkey to toggle quote threading, `Shift+t` by default.
diff --git a/builds/4chan-X-beta.crx b/builds/4chan-X-beta.crx
index 771128398..179f6a91e 100644
Binary files a/builds/4chan-X-beta.crx and b/builds/4chan-X-beta.crx differ
diff --git a/builds/4chan-X-beta.meta.js b/builds/4chan-X-beta.meta.js
index bea018110..96aec7591 100644
--- a/builds/4chan-X-beta.meta.js
+++ b/builds/4chan-X-beta.meta.js
@@ -1,6 +1,6 @@
// ==UserScript==
// @name 4chan X beta
-// @version 1.14.7.0
+// @version 1.14.7.1
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
diff --git a/builds/4chan-X-beta.user.js b/builds/4chan-X-beta.user.js
index d98f79a17..0607a8371 100644
--- a/builds/4chan-X-beta.user.js
+++ b/builds/4chan-X-beta.user.js
@@ -1,6 +1,6 @@
// ==UserScript==
// @name 4chan X beta
-// @version 1.14.7.0
+// @version 1.14.7.1
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
@@ -198,7 +198,7 @@ docSet = function() {
};
g = {
- VERSION: '1.14.7.0',
+ VERSION: '1.14.7.1',
NAMESPACE: '4chan X.',
boards: {}
};
@@ -5671,12 +5671,12 @@ Callbacks = (function() {
return this[name] = cb;
};
- Callbacks.prototype.execute = function(node, keys) {
+ Callbacks.prototype.execute = function(node, keys, force) {
var err, errors, i, len, name, ref, ref1, ref2;
if (keys == null) {
keys = this.keys;
}
- if (node.callbacksExecuted) {
+ if (node.callbacksExecuted && !force) {
return;
}
node.callbacksExecuted = true;
@@ -7382,7 +7382,7 @@ SW = {};
SW.tinyboard = {
isOPContainerThread: true,
mayLackJSON: true,
- disabledFeatures: ['Board Configuration', 'Normalize URL', 'Captcha Configuration', 'Image Host Rewriting', 'Index Generator', 'Announcement Hiding', 'Fourchan thingies', 'Resurrect Quotes', 'Quick Reply Personas', 'Quick Reply', 'Cooldown', 'Pass Link', 'Index Generator (Menu)', 'Report Link', 'Delete Link', 'Edit Link', 'Archive Link', 'Quote Inlining', 'Quote Previewing', 'Quote Backlinks', 'File Info Formatting', 'Fappe Tyme', 'Image Expansion', 'Image Expansion (Menu)', 'Comment Expansion', 'Thread Expansion', 'Favicon', 'Quote Threading', 'Thread Stats', 'Thread Updater', 'Mark New IPs', 'Banner', 'Flash Features', 'Reply Pruning'],
+ disabledFeatures: ['Board Configuration', 'Normalize URL', 'Captcha Configuration', 'Image Host Rewriting', 'Index Generator', 'Announcement Hiding', 'Resurrect Quotes', 'Quick Reply Personas', 'Quick Reply', 'Cooldown', 'Pass Link', 'Index Generator (Menu)', 'Report Link', 'Delete Link', 'Edit Link', 'Archive Link', 'Quote Inlining', 'Quote Previewing', 'Quote Backlinks', 'File Info Formatting', 'Fappe Tyme', 'Image Expansion', 'Image Expansion (Menu)', 'Comment Expansion', 'Thread Expansion', 'Favicon', 'Quote Threading', 'Thread Stats', 'Thread Updater', 'Mark New IPs', 'Banner', 'Flash Features', 'Reply Pruning'],
detect: function() {
var i, len, m, properties, ref, root, script;
ref = $$('script:not([src])', d.head);
@@ -9367,13 +9367,18 @@ Build = (function() {
sameThread: function(boardID, threadID) {
return g.VIEW === 'thread' && g.BOARD.ID === boardID && g.THREADID === +threadID;
},
- postURL: function(boardID, threadID, postID) {
- if (Build.sameThread(boardID, threadID)) {
- return "#p" + postID;
+ threadURL: function(boardID, threadID) {
+ if (boardID !== g.BOARD.ID) {
+ return "//" + (BoardConfig.domain(boardID)) + "/" + boardID + "/thread/" + threadID;
+ } else if (g.VIEW !== 'thread' || +threadID !== g.THREADID) {
+ return "/" + boardID + "/thread/" + threadID;
} else {
- return "/" + boardID + "/thread/" + threadID + "#p" + postID;
+ return '';
}
},
+ postURL: function(boardID, threadID, postID) {
+ return (Build.threadURL(boardID, threadID)) + "#p" + postID;
+ },
parseJSON: function(data, boardID, siteID) {
var key, o;
o = {
@@ -9456,7 +9461,7 @@ Build = (function() {
return Build.post(o);
},
post: function(o) {
- var ID, boardID, capcode, capcodeDescription, capcodeLC, capcodeLong, capcodePlural, commentHTML, container, dateText, dateUTC, email, file, fileBlock, fileThumb, fileURL, flag, flagCode, flagCodeTroll, gifIcon, href, i, len, match, name, pass, postClass, postInfo, postLink, protocol, quote, quoteLink, ref, ref1, shortFilename, staticPath, subject, threadID, tripcode, uniqueID, wholePost;
+ var ID, boardID, capcode, capcodeDescription, capcodeLC, capcodeLong, capcodePlural, commentHTML, container, dateText, dateUTC, email, file, fileBlock, fileThumb, fileURL, flag, flagCode, flagCodeTroll, gifIcon, href, i, len, match, name, pass, postClass, postInfo, postLink, protocol, quote, quoteLink, ref, ref1, shortFilename, staticPath, subject, threadID, tripcode, uniqueID, url, wholePost;
ID = o.ID, threadID = o.threadID, boardID = o.boardID, file = o.file;
ref = o.info, subject = ref.subject, email = ref.email, name = ref.name, tripcode = ref.tripcode, capcode = ref.capcode, pass = ref.pass, uniqueID = ref.uniqueID, flagCode = ref.flagCode, flagCodeTroll = ref.flagCodeTroll, flag = ref.flag, dateUTC = ref.dateUTC, dateText = ref.dateText, commentHTML = ref.commentHTML;
staticPath = Build.staticPath, gifIcon = Build.gifIcon;
@@ -9479,8 +9484,9 @@ Build = (function() {
capcodeDescription = "a 4chan " + capcodeLong;
}
}
- postLink = Build.postURL(boardID, threadID, ID);
- quoteLink = Build.sameThread(boardID, threadID) ? "javascript:quote('" + (+ID) + "');" : "/" + boardID + "/thread/" + threadID + "#q" + ID;
+ url = Build.threadURL(boardID, threadID);
+ postLink = url + "#p" + ID;
+ quoteLink = Build.sameThread(boardID, threadID) ? "javascript:quote('" + (+ID) + "');" : url + "#q" + ID;
postInfo = {
innerHTML: "
"
};
@@ -9510,12 +9516,14 @@ Build = (function() {
for (i = 0, len = ref1.length; i < len; i++) {
quote = ref1[i];
href = quote.getAttribute('href');
- if ((href[0] === '#') && !(Build.sameThread(boardID, threadID))) {
- quote.href = ("/" + boardID + "/thread/" + threadID) + href;
- } else if ((match = href.match(/^\/([^\/]+)\/thread\/(\d+)/)) && (Build.sameThread(match[1], match[2]))) {
- quote.href = href.match(/(#[^#]*)?$/)[0] || '#';
- } else if (/^\d+(#|$)/.test(href) && !(g.VIEW === 'thread' && g.BOARD.ID === boardID)) {
- quote.href = "/" + boardID + "/thread/" + href;
+ if (href[0] === '#') {
+ if (!Build.sameThread(boardID, threadID)) {
+ quote.href = Build.threadURL(boardID, threadID) + href;
+ }
+ } else {
+ if ((match = quote.href.match(SW.yotsuba.regexp.quotelink)) && (Build.sameThread(match[1], match[2]))) {
+ quote.href = href.match(/(#[^#]*)?$/)[0] || '#';
+ }
}
}
return container;
@@ -17138,12 +17146,6 @@ ExpandComment = (function() {
if (g.VIEW !== 'index' || !Conf['Comment Expansion'] || Conf['JSON Index']) {
return;
}
- if (g.BOARD.ID === 'g') {
- this.callbacks.push(Fourchan.code);
- }
- if (g.BOARD.ID === 'sci') {
- this.callbacks.push(Fourchan.math);
- }
return Callbacks.Post.push({
name: 'Comment Expansion',
cb: this.node
@@ -17646,10 +17648,14 @@ Fourchan = (function() {
Fourchan = {
init: function() {
var ref;
- if ((ref = g.VIEW) !== 'index' && ref !== 'thread' && ref !== 'archive') {
+ if (!(Site.software === 'yotsuba' && ((ref = g.VIEW) === 'index' || ref === 'thread' || ref === 'archive'))) {
return;
}
- if (g.BOARD.ID === 'g') {
+ BoardConfig.ready(this.initBoard);
+ return Main.ready(this.initReady);
+ },
+ initBoard: function() {
+ if (g.BOARD.config.code_tags) {
$.on(window, 'prettyprint:cb', function(e) {
var post, pre;
if (!(post = g.posts[e.detail.ID])) {
@@ -17665,11 +17671,15 @@ Fourchan = (function() {
});
$.globalEval('window.addEventListener(\'prettyprint\', function(e) {\n window.dispatchEvent(new CustomEvent(\'prettyprint:cb\', {\n detail: {\n ID: e.detail.ID,\n i: e.detail.i,\n html: prettyPrintOne(e.detail.html)\n }\n }));\n}, false);');
Callbacks.Post.push({
- name: 'Parse /g/ code',
- cb: this.code
+ name: 'Parse [code] tags',
+ cb: Fourchan.code
});
+ g.posts.forEach(function(post) {
+ return Callbacks.Post.execute(post, ['Parse [code] tags'], true);
+ });
+ ExpandComment.callbacks.push(Fourchan.code);
}
- if (g.BOARD.ID === 'sci') {
+ if (g.BOARD.config.math_tags) {
$.global(function() {
return window.addEventListener('mathjax', function(e) {
if (window.MathJax) {
@@ -17688,20 +17698,24 @@ Fourchan = (function() {
}, false);
});
Callbacks.Post.push({
- name: 'Parse /sci/ math',
- cb: this.math
+ name: 'Parse [math] tags',
+ cb: Fourchan.math
});
+ g.posts.forEach(function(post) {
+ return Callbacks.Post.execute(post, ['Parse [math] tags'], true);
+ });
+ return ExpandComment.callbacks.push(Fourchan.math);
}
- return Main.ready(function() {
- return $.global(function() {
- var j, len, node, ref1;
- window.clickable_ids = false;
- ref1 = document.querySelectorAll('.posteruid, .capcode');
- for (j = 0, len = ref1.length; j < len; j++) {
- node = ref1[j];
- node.removeEventListener('click', window.idClick, false);
- }
- });
+ },
+ initReady: function() {
+ return $.global(function() {
+ var j, len, node, ref;
+ window.clickable_ids = false;
+ ref = document.querySelectorAll('.posteruid, .capcode');
+ for (j = 0, len = ref.length; j < len; j++) {
+ node = ref[j];
+ node.removeEventListener('click', window.idClick, false);
+ }
});
},
code: function() {
@@ -25519,9 +25533,6 @@ Main = (function() {
Main = {
init: function() {
var db, flatten, i, items, j, k, key, len, ref, ref1, ref2, w;
- if (d.body && !$('title', d.head)) {
- return;
- }
try {
w = window;
if ($.platform === 'crx') {
diff --git a/builds/4chan-X-noupdate.crx b/builds/4chan-X-noupdate.crx
index 92c7f18e9..ef906fca9 100644
Binary files a/builds/4chan-X-noupdate.crx and b/builds/4chan-X-noupdate.crx differ
diff --git a/builds/4chan-X-noupdate.user.js b/builds/4chan-X-noupdate.user.js
index 45e20df0d..866614c9c 100644
--- a/builds/4chan-X-noupdate.user.js
+++ b/builds/4chan-X-noupdate.user.js
@@ -1,6 +1,6 @@
// ==UserScript==
// @name 4chan X
-// @version 1.14.7.0
+// @version 1.14.7.1
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
@@ -198,7 +198,7 @@ docSet = function() {
};
g = {
- VERSION: '1.14.7.0',
+ VERSION: '1.14.7.1',
NAMESPACE: '4chan X.',
boards: {}
};
@@ -5671,12 +5671,12 @@ Callbacks = (function() {
return this[name] = cb;
};
- Callbacks.prototype.execute = function(node, keys) {
+ Callbacks.prototype.execute = function(node, keys, force) {
var err, errors, i, len, name, ref, ref1, ref2;
if (keys == null) {
keys = this.keys;
}
- if (node.callbacksExecuted) {
+ if (node.callbacksExecuted && !force) {
return;
}
node.callbacksExecuted = true;
@@ -7382,7 +7382,7 @@ SW = {};
SW.tinyboard = {
isOPContainerThread: true,
mayLackJSON: true,
- disabledFeatures: ['Board Configuration', 'Normalize URL', 'Captcha Configuration', 'Image Host Rewriting', 'Index Generator', 'Announcement Hiding', 'Fourchan thingies', 'Resurrect Quotes', 'Quick Reply Personas', 'Quick Reply', 'Cooldown', 'Pass Link', 'Index Generator (Menu)', 'Report Link', 'Delete Link', 'Edit Link', 'Archive Link', 'Quote Inlining', 'Quote Previewing', 'Quote Backlinks', 'File Info Formatting', 'Fappe Tyme', 'Image Expansion', 'Image Expansion (Menu)', 'Comment Expansion', 'Thread Expansion', 'Favicon', 'Quote Threading', 'Thread Stats', 'Thread Updater', 'Mark New IPs', 'Banner', 'Flash Features', 'Reply Pruning'],
+ disabledFeatures: ['Board Configuration', 'Normalize URL', 'Captcha Configuration', 'Image Host Rewriting', 'Index Generator', 'Announcement Hiding', 'Resurrect Quotes', 'Quick Reply Personas', 'Quick Reply', 'Cooldown', 'Pass Link', 'Index Generator (Menu)', 'Report Link', 'Delete Link', 'Edit Link', 'Archive Link', 'Quote Inlining', 'Quote Previewing', 'Quote Backlinks', 'File Info Formatting', 'Fappe Tyme', 'Image Expansion', 'Image Expansion (Menu)', 'Comment Expansion', 'Thread Expansion', 'Favicon', 'Quote Threading', 'Thread Stats', 'Thread Updater', 'Mark New IPs', 'Banner', 'Flash Features', 'Reply Pruning'],
detect: function() {
var i, len, m, properties, ref, root, script;
ref = $$('script:not([src])', d.head);
@@ -9367,13 +9367,18 @@ Build = (function() {
sameThread: function(boardID, threadID) {
return g.VIEW === 'thread' && g.BOARD.ID === boardID && g.THREADID === +threadID;
},
- postURL: function(boardID, threadID, postID) {
- if (Build.sameThread(boardID, threadID)) {
- return "#p" + postID;
+ threadURL: function(boardID, threadID) {
+ if (boardID !== g.BOARD.ID) {
+ return "//" + (BoardConfig.domain(boardID)) + "/" + boardID + "/thread/" + threadID;
+ } else if (g.VIEW !== 'thread' || +threadID !== g.THREADID) {
+ return "/" + boardID + "/thread/" + threadID;
} else {
- return "/" + boardID + "/thread/" + threadID + "#p" + postID;
+ return '';
}
},
+ postURL: function(boardID, threadID, postID) {
+ return (Build.threadURL(boardID, threadID)) + "#p" + postID;
+ },
parseJSON: function(data, boardID, siteID) {
var key, o;
o = {
@@ -9456,7 +9461,7 @@ Build = (function() {
return Build.post(o);
},
post: function(o) {
- var ID, boardID, capcode, capcodeDescription, capcodeLC, capcodeLong, capcodePlural, commentHTML, container, dateText, dateUTC, email, file, fileBlock, fileThumb, fileURL, flag, flagCode, flagCodeTroll, gifIcon, href, i, len, match, name, pass, postClass, postInfo, postLink, protocol, quote, quoteLink, ref, ref1, shortFilename, staticPath, subject, threadID, tripcode, uniqueID, wholePost;
+ var ID, boardID, capcode, capcodeDescription, capcodeLC, capcodeLong, capcodePlural, commentHTML, container, dateText, dateUTC, email, file, fileBlock, fileThumb, fileURL, flag, flagCode, flagCodeTroll, gifIcon, href, i, len, match, name, pass, postClass, postInfo, postLink, protocol, quote, quoteLink, ref, ref1, shortFilename, staticPath, subject, threadID, tripcode, uniqueID, url, wholePost;
ID = o.ID, threadID = o.threadID, boardID = o.boardID, file = o.file;
ref = o.info, subject = ref.subject, email = ref.email, name = ref.name, tripcode = ref.tripcode, capcode = ref.capcode, pass = ref.pass, uniqueID = ref.uniqueID, flagCode = ref.flagCode, flagCodeTroll = ref.flagCodeTroll, flag = ref.flag, dateUTC = ref.dateUTC, dateText = ref.dateText, commentHTML = ref.commentHTML;
staticPath = Build.staticPath, gifIcon = Build.gifIcon;
@@ -9479,8 +9484,9 @@ Build = (function() {
capcodeDescription = "a 4chan " + capcodeLong;
}
}
- postLink = Build.postURL(boardID, threadID, ID);
- quoteLink = Build.sameThread(boardID, threadID) ? "javascript:quote('" + (+ID) + "');" : "/" + boardID + "/thread/" + threadID + "#q" + ID;
+ url = Build.threadURL(boardID, threadID);
+ postLink = url + "#p" + ID;
+ quoteLink = Build.sameThread(boardID, threadID) ? "javascript:quote('" + (+ID) + "');" : url + "#q" + ID;
postInfo = {
innerHTML: ""
};
@@ -9510,12 +9516,14 @@ Build = (function() {
for (i = 0, len = ref1.length; i < len; i++) {
quote = ref1[i];
href = quote.getAttribute('href');
- if ((href[0] === '#') && !(Build.sameThread(boardID, threadID))) {
- quote.href = ("/" + boardID + "/thread/" + threadID) + href;
- } else if ((match = href.match(/^\/([^\/]+)\/thread\/(\d+)/)) && (Build.sameThread(match[1], match[2]))) {
- quote.href = href.match(/(#[^#]*)?$/)[0] || '#';
- } else if (/^\d+(#|$)/.test(href) && !(g.VIEW === 'thread' && g.BOARD.ID === boardID)) {
- quote.href = "/" + boardID + "/thread/" + href;
+ if (href[0] === '#') {
+ if (!Build.sameThread(boardID, threadID)) {
+ quote.href = Build.threadURL(boardID, threadID) + href;
+ }
+ } else {
+ if ((match = quote.href.match(SW.yotsuba.regexp.quotelink)) && (Build.sameThread(match[1], match[2]))) {
+ quote.href = href.match(/(#[^#]*)?$/)[0] || '#';
+ }
}
}
return container;
@@ -17138,12 +17146,6 @@ ExpandComment = (function() {
if (g.VIEW !== 'index' || !Conf['Comment Expansion'] || Conf['JSON Index']) {
return;
}
- if (g.BOARD.ID === 'g') {
- this.callbacks.push(Fourchan.code);
- }
- if (g.BOARD.ID === 'sci') {
- this.callbacks.push(Fourchan.math);
- }
return Callbacks.Post.push({
name: 'Comment Expansion',
cb: this.node
@@ -17646,10 +17648,14 @@ Fourchan = (function() {
Fourchan = {
init: function() {
var ref;
- if ((ref = g.VIEW) !== 'index' && ref !== 'thread' && ref !== 'archive') {
+ if (!(Site.software === 'yotsuba' && ((ref = g.VIEW) === 'index' || ref === 'thread' || ref === 'archive'))) {
return;
}
- if (g.BOARD.ID === 'g') {
+ BoardConfig.ready(this.initBoard);
+ return Main.ready(this.initReady);
+ },
+ initBoard: function() {
+ if (g.BOARD.config.code_tags) {
$.on(window, 'prettyprint:cb', function(e) {
var post, pre;
if (!(post = g.posts[e.detail.ID])) {
@@ -17665,11 +17671,15 @@ Fourchan = (function() {
});
$.globalEval('window.addEventListener(\'prettyprint\', function(e) {\n window.dispatchEvent(new CustomEvent(\'prettyprint:cb\', {\n detail: {\n ID: e.detail.ID,\n i: e.detail.i,\n html: prettyPrintOne(e.detail.html)\n }\n }));\n}, false);');
Callbacks.Post.push({
- name: 'Parse /g/ code',
- cb: this.code
+ name: 'Parse [code] tags',
+ cb: Fourchan.code
});
+ g.posts.forEach(function(post) {
+ return Callbacks.Post.execute(post, ['Parse [code] tags'], true);
+ });
+ ExpandComment.callbacks.push(Fourchan.code);
}
- if (g.BOARD.ID === 'sci') {
+ if (g.BOARD.config.math_tags) {
$.global(function() {
return window.addEventListener('mathjax', function(e) {
if (window.MathJax) {
@@ -17688,20 +17698,24 @@ Fourchan = (function() {
}, false);
});
Callbacks.Post.push({
- name: 'Parse /sci/ math',
- cb: this.math
+ name: 'Parse [math] tags',
+ cb: Fourchan.math
});
+ g.posts.forEach(function(post) {
+ return Callbacks.Post.execute(post, ['Parse [math] tags'], true);
+ });
+ return ExpandComment.callbacks.push(Fourchan.math);
}
- return Main.ready(function() {
- return $.global(function() {
- var j, len, node, ref1;
- window.clickable_ids = false;
- ref1 = document.querySelectorAll('.posteruid, .capcode');
- for (j = 0, len = ref1.length; j < len; j++) {
- node = ref1[j];
- node.removeEventListener('click', window.idClick, false);
- }
- });
+ },
+ initReady: function() {
+ return $.global(function() {
+ var j, len, node, ref;
+ window.clickable_ids = false;
+ ref = document.querySelectorAll('.posteruid, .capcode');
+ for (j = 0, len = ref.length; j < len; j++) {
+ node = ref[j];
+ node.removeEventListener('click', window.idClick, false);
+ }
});
},
code: function() {
@@ -25519,9 +25533,6 @@ Main = (function() {
Main = {
init: function() {
var db, flatten, i, items, j, k, key, len, ref, ref1, ref2, w;
- if (d.body && !$('title', d.head)) {
- return;
- }
try {
w = window;
if ($.platform === 'crx') {
diff --git a/builds/4chan-X.crx b/builds/4chan-X.crx
index 177ddab07..d82b77381 100644
Binary files a/builds/4chan-X.crx and b/builds/4chan-X.crx differ
diff --git a/builds/4chan-X.meta.js b/builds/4chan-X.meta.js
index 2dfba9cdc..8c49c20b1 100644
--- a/builds/4chan-X.meta.js
+++ b/builds/4chan-X.meta.js
@@ -1,6 +1,6 @@
// ==UserScript==
// @name 4chan X
-// @version 1.14.7.0
+// @version 1.14.7.1
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js
index 786b83194..d2c701d29 100644
--- a/builds/4chan-X.user.js
+++ b/builds/4chan-X.user.js
@@ -1,6 +1,6 @@
// ==UserScript==
// @name 4chan X
-// @version 1.14.7.0
+// @version 1.14.7.1
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
@@ -198,7 +198,7 @@ docSet = function() {
};
g = {
- VERSION: '1.14.7.0',
+ VERSION: '1.14.7.1',
NAMESPACE: '4chan X.',
boards: {}
};
@@ -5671,12 +5671,12 @@ Callbacks = (function() {
return this[name] = cb;
};
- Callbacks.prototype.execute = function(node, keys) {
+ Callbacks.prototype.execute = function(node, keys, force) {
var err, errors, i, len, name, ref, ref1, ref2;
if (keys == null) {
keys = this.keys;
}
- if (node.callbacksExecuted) {
+ if (node.callbacksExecuted && !force) {
return;
}
node.callbacksExecuted = true;
@@ -7382,7 +7382,7 @@ SW = {};
SW.tinyboard = {
isOPContainerThread: true,
mayLackJSON: true,
- disabledFeatures: ['Board Configuration', 'Normalize URL', 'Captcha Configuration', 'Image Host Rewriting', 'Index Generator', 'Announcement Hiding', 'Fourchan thingies', 'Resurrect Quotes', 'Quick Reply Personas', 'Quick Reply', 'Cooldown', 'Pass Link', 'Index Generator (Menu)', 'Report Link', 'Delete Link', 'Edit Link', 'Archive Link', 'Quote Inlining', 'Quote Previewing', 'Quote Backlinks', 'File Info Formatting', 'Fappe Tyme', 'Image Expansion', 'Image Expansion (Menu)', 'Comment Expansion', 'Thread Expansion', 'Favicon', 'Quote Threading', 'Thread Stats', 'Thread Updater', 'Mark New IPs', 'Banner', 'Flash Features', 'Reply Pruning'],
+ disabledFeatures: ['Board Configuration', 'Normalize URL', 'Captcha Configuration', 'Image Host Rewriting', 'Index Generator', 'Announcement Hiding', 'Resurrect Quotes', 'Quick Reply Personas', 'Quick Reply', 'Cooldown', 'Pass Link', 'Index Generator (Menu)', 'Report Link', 'Delete Link', 'Edit Link', 'Archive Link', 'Quote Inlining', 'Quote Previewing', 'Quote Backlinks', 'File Info Formatting', 'Fappe Tyme', 'Image Expansion', 'Image Expansion (Menu)', 'Comment Expansion', 'Thread Expansion', 'Favicon', 'Quote Threading', 'Thread Stats', 'Thread Updater', 'Mark New IPs', 'Banner', 'Flash Features', 'Reply Pruning'],
detect: function() {
var i, len, m, properties, ref, root, script;
ref = $$('script:not([src])', d.head);
@@ -9367,13 +9367,18 @@ Build = (function() {
sameThread: function(boardID, threadID) {
return g.VIEW === 'thread' && g.BOARD.ID === boardID && g.THREADID === +threadID;
},
- postURL: function(boardID, threadID, postID) {
- if (Build.sameThread(boardID, threadID)) {
- return "#p" + postID;
+ threadURL: function(boardID, threadID) {
+ if (boardID !== g.BOARD.ID) {
+ return "//" + (BoardConfig.domain(boardID)) + "/" + boardID + "/thread/" + threadID;
+ } else if (g.VIEW !== 'thread' || +threadID !== g.THREADID) {
+ return "/" + boardID + "/thread/" + threadID;
} else {
- return "/" + boardID + "/thread/" + threadID + "#p" + postID;
+ return '';
}
},
+ postURL: function(boardID, threadID, postID) {
+ return (Build.threadURL(boardID, threadID)) + "#p" + postID;
+ },
parseJSON: function(data, boardID, siteID) {
var key, o;
o = {
@@ -9456,7 +9461,7 @@ Build = (function() {
return Build.post(o);
},
post: function(o) {
- var ID, boardID, capcode, capcodeDescription, capcodeLC, capcodeLong, capcodePlural, commentHTML, container, dateText, dateUTC, email, file, fileBlock, fileThumb, fileURL, flag, flagCode, flagCodeTroll, gifIcon, href, i, len, match, name, pass, postClass, postInfo, postLink, protocol, quote, quoteLink, ref, ref1, shortFilename, staticPath, subject, threadID, tripcode, uniqueID, wholePost;
+ var ID, boardID, capcode, capcodeDescription, capcodeLC, capcodeLong, capcodePlural, commentHTML, container, dateText, dateUTC, email, file, fileBlock, fileThumb, fileURL, flag, flagCode, flagCodeTroll, gifIcon, href, i, len, match, name, pass, postClass, postInfo, postLink, protocol, quote, quoteLink, ref, ref1, shortFilename, staticPath, subject, threadID, tripcode, uniqueID, url, wholePost;
ID = o.ID, threadID = o.threadID, boardID = o.boardID, file = o.file;
ref = o.info, subject = ref.subject, email = ref.email, name = ref.name, tripcode = ref.tripcode, capcode = ref.capcode, pass = ref.pass, uniqueID = ref.uniqueID, flagCode = ref.flagCode, flagCodeTroll = ref.flagCodeTroll, flag = ref.flag, dateUTC = ref.dateUTC, dateText = ref.dateText, commentHTML = ref.commentHTML;
staticPath = Build.staticPath, gifIcon = Build.gifIcon;
@@ -9479,8 +9484,9 @@ Build = (function() {
capcodeDescription = "a 4chan " + capcodeLong;
}
}
- postLink = Build.postURL(boardID, threadID, ID);
- quoteLink = Build.sameThread(boardID, threadID) ? "javascript:quote('" + (+ID) + "');" : "/" + boardID + "/thread/" + threadID + "#q" + ID;
+ url = Build.threadURL(boardID, threadID);
+ postLink = url + "#p" + ID;
+ quoteLink = Build.sameThread(boardID, threadID) ? "javascript:quote('" + (+ID) + "');" : url + "#q" + ID;
postInfo = {
innerHTML: ""
};
@@ -9510,12 +9516,14 @@ Build = (function() {
for (i = 0, len = ref1.length; i < len; i++) {
quote = ref1[i];
href = quote.getAttribute('href');
- if ((href[0] === '#') && !(Build.sameThread(boardID, threadID))) {
- quote.href = ("/" + boardID + "/thread/" + threadID) + href;
- } else if ((match = href.match(/^\/([^\/]+)\/thread\/(\d+)/)) && (Build.sameThread(match[1], match[2]))) {
- quote.href = href.match(/(#[^#]*)?$/)[0] || '#';
- } else if (/^\d+(#|$)/.test(href) && !(g.VIEW === 'thread' && g.BOARD.ID === boardID)) {
- quote.href = "/" + boardID + "/thread/" + href;
+ if (href[0] === '#') {
+ if (!Build.sameThread(boardID, threadID)) {
+ quote.href = Build.threadURL(boardID, threadID) + href;
+ }
+ } else {
+ if ((match = quote.href.match(SW.yotsuba.regexp.quotelink)) && (Build.sameThread(match[1], match[2]))) {
+ quote.href = href.match(/(#[^#]*)?$/)[0] || '#';
+ }
}
}
return container;
@@ -17138,12 +17146,6 @@ ExpandComment = (function() {
if (g.VIEW !== 'index' || !Conf['Comment Expansion'] || Conf['JSON Index']) {
return;
}
- if (g.BOARD.ID === 'g') {
- this.callbacks.push(Fourchan.code);
- }
- if (g.BOARD.ID === 'sci') {
- this.callbacks.push(Fourchan.math);
- }
return Callbacks.Post.push({
name: 'Comment Expansion',
cb: this.node
@@ -17646,10 +17648,14 @@ Fourchan = (function() {
Fourchan = {
init: function() {
var ref;
- if ((ref = g.VIEW) !== 'index' && ref !== 'thread' && ref !== 'archive') {
+ if (!(Site.software === 'yotsuba' && ((ref = g.VIEW) === 'index' || ref === 'thread' || ref === 'archive'))) {
return;
}
- if (g.BOARD.ID === 'g') {
+ BoardConfig.ready(this.initBoard);
+ return Main.ready(this.initReady);
+ },
+ initBoard: function() {
+ if (g.BOARD.config.code_tags) {
$.on(window, 'prettyprint:cb', function(e) {
var post, pre;
if (!(post = g.posts[e.detail.ID])) {
@@ -17665,11 +17671,15 @@ Fourchan = (function() {
});
$.globalEval('window.addEventListener(\'prettyprint\', function(e) {\n window.dispatchEvent(new CustomEvent(\'prettyprint:cb\', {\n detail: {\n ID: e.detail.ID,\n i: e.detail.i,\n html: prettyPrintOne(e.detail.html)\n }\n }));\n}, false);');
Callbacks.Post.push({
- name: 'Parse /g/ code',
- cb: this.code
+ name: 'Parse [code] tags',
+ cb: Fourchan.code
});
+ g.posts.forEach(function(post) {
+ return Callbacks.Post.execute(post, ['Parse [code] tags'], true);
+ });
+ ExpandComment.callbacks.push(Fourchan.code);
}
- if (g.BOARD.ID === 'sci') {
+ if (g.BOARD.config.math_tags) {
$.global(function() {
return window.addEventListener('mathjax', function(e) {
if (window.MathJax) {
@@ -17688,20 +17698,24 @@ Fourchan = (function() {
}, false);
});
Callbacks.Post.push({
- name: 'Parse /sci/ math',
- cb: this.math
+ name: 'Parse [math] tags',
+ cb: Fourchan.math
});
+ g.posts.forEach(function(post) {
+ return Callbacks.Post.execute(post, ['Parse [math] tags'], true);
+ });
+ return ExpandComment.callbacks.push(Fourchan.math);
}
- return Main.ready(function() {
- return $.global(function() {
- var j, len, node, ref1;
- window.clickable_ids = false;
- ref1 = document.querySelectorAll('.posteruid, .capcode');
- for (j = 0, len = ref1.length; j < len; j++) {
- node = ref1[j];
- node.removeEventListener('click', window.idClick, false);
- }
- });
+ },
+ initReady: function() {
+ return $.global(function() {
+ var j, len, node, ref;
+ window.clickable_ids = false;
+ ref = document.querySelectorAll('.posteruid, .capcode');
+ for (j = 0, len = ref.length; j < len; j++) {
+ node = ref[j];
+ node.removeEventListener('click', window.idClick, false);
+ }
});
},
code: function() {
@@ -25519,9 +25533,6 @@ Main = (function() {
Main = {
init: function() {
var db, flatten, i, items, j, k, key, len, ref, ref1, ref2, w;
- if (d.body && !$('title', d.head)) {
- return;
- }
try {
w = window;
if ($.platform === 'crx') {
diff --git a/builds/4chan-X.zip b/builds/4chan-X.zip
index 485691fcd..3d5c37033 100644
Binary files a/builds/4chan-X.zip and b/builds/4chan-X.zip differ
diff --git a/builds/updates-beta.json b/builds/updates-beta.json
index af6cabe83..2f07d0b8b 100644
--- a/builds/updates-beta.json
+++ b/builds/updates-beta.json
@@ -3,7 +3,7 @@
"4chan-x@4chan-x.net": {
"updates": [
{
- "version": "1.14.7.0",
+ "version": "1.14.7.1",
"update_link": "https://www.4chan-x.net/builds/4chan-X-beta.crx"
}
]
diff --git a/builds/updates-beta.xml b/builds/updates-beta.xml
index 301e136b7..bf7f5221f 100644
--- a/builds/updates-beta.xml
+++ b/builds/updates-beta.xml
@@ -1,7 +1,7 @@
-
+
diff --git a/builds/updates.json b/builds/updates.json
index c0f721df6..976291b1e 100644
--- a/builds/updates.json
+++ b/builds/updates.json
@@ -3,7 +3,7 @@
"4chan-x@4chan-x.net": {
"updates": [
{
- "version": "1.14.7.0",
+ "version": "1.14.7.1",
"update_link": "https://www.4chan-x.net/builds/4chan-X.crx"
}
]
diff --git a/builds/updates.xml b/builds/updates.xml
index b8fcab730..0f7db5861 100644
--- a/builds/updates.xml
+++ b/builds/updates.xml
@@ -1,7 +1,7 @@
-
+
diff --git a/version.json b/version.json
index 7f63da196..b621dc1db 100644
--- a/version.json
+++ b/version.json
@@ -1,4 +1,4 @@
{
- "version": "1.14.7.0",
- "date": "2019-04-07T09:30:05.377Z"
+ "version": "1.14.7.1",
+ "date": "2019-04-09T17:45:20.859Z"
}
\ No newline at end of file