diff --git a/CHANGELOG.md b/CHANGELOG.md
index cef5b9514..228736a03 100755
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,6 @@
+### v1.7.36
+*2014-05-13*
+
**ccd0**
- Fix an issue that allowed Javascript running on the page access to the Greasemonkey / Chrome extension APIs.
- Minor fixes.
diff --git a/LICENSE b/LICENSE
index df7642710..677d0a23a 100755
--- a/LICENSE
+++ b/LICENSE
@@ -1,5 +1,5 @@
/*
-* 4chan X - Version 1.7.35 - 2014-05-12
+* 4chan X - Version 1.7.36 - 2014-05-13
*
* Licensed under the MIT license.
* https://github.com/ccd0/4chan-x/blob/master/LICENSE
diff --git a/builds/4chan-X.meta.js b/builds/4chan-X.meta.js
index 86d7367db..91ed62ed5 100755
--- a/builds/4chan-X.meta.js
+++ b/builds/4chan-X.meta.js
@@ -1,6 +1,6 @@
// ==UserScript==
// @name 4chan X
-// @version 1.7.35
+// @version 1.7.36
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js
index 43aa1cc63..246e6b39d 100644
--- a/builds/4chan-X.user.js
+++ b/builds/4chan-X.user.js
@@ -1,7 +1,7 @@
// Generated by CoffeeScript
// ==UserScript==
// @name 4chan X
-// @version 1.7.35
+// @version 1.7.36
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
@@ -24,7 +24,7 @@
// ==/UserScript==
/*
-* 4chan X - Version 1.7.35 - 2014-05-12
+* 4chan X - Version 1.7.36 - 2014-05-13
*
* Licensed under the MIT license.
* https://github.com/ccd0/4chan-x/blob/master/LICENSE
@@ -372,7 +372,7 @@
doc = d.documentElement;
g = {
- VERSION: '1.7.35',
+ VERSION: '1.7.36',
NAMESPACE: '4chan X.',
boards: {}
};
@@ -3056,7 +3056,7 @@
threshold = isReply ? 30 : 40;
ext = filename.match(/\.?[^\.]*$/)[0];
if (filename.length - ext.length > threshold) {
- return "" + filename.slice(0, threshold - 5) + "(...)." + ext;
+ return "" + filename.slice(0, threshold - 5) + "(...)" + ext;
} else {
return filename;
}
@@ -3397,6 +3397,7 @@
$.cache(url, function() {
return Get.archivedPost(this, boardID, postID, root, context);
}, {
+ responseType: 'json',
withCredentials: url.archive.withCredentials
});
} else {
@@ -4896,12 +4897,9 @@
QuoteBacklink = {
containers: {},
init: function() {
- var format;
if (g.VIEW === 'catalog' || !Conf['Quote Backlinks']) {
return;
}
- format = Conf['backlink'].replace(/%id/g, "' + id + '");
- this.funk = Function('id', "return '" + format + "'");
Post.callbacks.push({
name: 'Quote Backlinking Part 1',
cb: this.firstNode
@@ -4924,7 +4922,7 @@
a = $.el('a', {
href: "/" + this.board + "/thread/" + this.thread + "#p" + this,
className: this.isHidden ? 'filtered backlink' : 'backlink',
- textContent: (QuoteBacklink.funk(this.ID)) + (markYours ? '\u00A0(You)' : '')
+ textContent: (Conf['backlink'].replace(/%id/, this.ID)) + (markYours ? '\u00A0(You)' : '')
});
_ref = this.quotes;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
@@ -8381,7 +8379,7 @@
link = _ref[_i];
try {
if (link[0] !== '#') {
- links.push(this.createSauceLink(link.trim()));
+ links.push(link.trim());
}
} catch (_error) {
err = _error;
@@ -8399,21 +8397,34 @@
cb: this.node
});
},
- createSauceLink: function(link) {
- var m, text;
- link = link.replace(/%(T?URL|MD5|board|name)/g, function(parameter) {
- var type;
- return ((type = {
- '%TURL': 'post.file.thumbURL',
- '%URL': 'post.file.URL',
- '%MD5': 'post.file.MD5',
- '%board': 'post.board',
- '%name': 'post.file.name'
- }[parameter]) ? "' + encodeURIComponent(" + type + ") + '" : parameter);
- });
- text = (m = link.match(/;text:(.+)$/)) ? m[1] : link.match(/(\w+)\.\w+\//)[1];
+ createSauceLink: function(link, post, a) {
+ var i, m, parts, text, _i, _ref;
+ text = (m = link.match(/;text:(.+)$/)) ? m[1] : ((_ref = link.match(/(\w+)\.\w+\//)) != null ? _ref[1] : void 0) || '?';
link = link.replace(/;text:.+$/, '');
- return Function('post', 'a', "a.href = '" + link + "';\na.textContent = '" + text + "';\nreturn a;");
+ parts = [link, text];
+ for (i = _i = 0; _i <= 1; i = ++_i) {
+ parts[i] = parts[i].replace(/%(T?URL|MD5|board|name)/g, function(parameter) {
+ var type;
+ if (type = {
+ '%TURL': post.file.thumbURL,
+ '%URL': post.file.URL,
+ '%MD5': post.file.MD5,
+ '%board': post.board,
+ '%name': post.file.name
+ }[parameter]) {
+ if (i === 0) {
+ return encodeURIComponent(type);
+ } else {
+ return type;
+ }
+ } else {
+ return parameter;
+ }
+ });
+ }
+ a.href = parts[0];
+ a.textContent = parts[1];
+ return a;
},
node: function() {
var link, nodes, _i, _len, _ref;
@@ -8424,7 +8435,7 @@
_ref = Sauce.links;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
link = _ref[_i];
- nodes.push($.tn('\u00A0'), link(this, Sauce.link.cloneNode(true)));
+ nodes.push($.tn('\u00A0'), Sauce.createSauceLink(link, this, Sauce.link.cloneNode(true)));
}
return $.add(this.file.text, nodes);
}
@@ -10756,7 +10767,7 @@
}
return Redirect.data = o;
},
- archives: [{"uid":0,"name":"Foolz","domain":"archive.foolz.us","http":true,"https":true,"software":"foolfuuka","boards":["a","biz","co","diy","gd","jp","m","sci","sp","tg","tv","vg","vp","vr","wsg"],"files":["a","biz","diy","gd","jp","m","sci","tg","vg","vp","vr","wsg"]},{"uid":1,"name":"NSFW Foolz","domain":"nsfw.foolz.us","http":true,"https":true,"software":"foolfuuka","boards":["u"],"files":["u"]},{"uid":2,"name":"The Dark Cave","domain":"archive.thedarkcave.org","http":true,"https":true,"software":"foolfuuka","boards":["c","int","out","po"],"files":["c","po"]},{"uid":3,"name":"4plebs Archive","domain":"archive.4plebs.org","http":true,"https":true,"software":"foolfuuka","boards":["adv","hr","o","pol","s4s","tg","trv","tv","x"],"files":["adv","hr","o","pol","s4s","tg","trv","tv","x"]},{"uid":18,"name":"4plebs Flash Archive","domain":"flash.4plebs.org","http":true,"https":true,"software":"foolfuuka","boards":["f"],"files":["f"]},{"uid":4,"name":"Nyafuu","domain":"archive.nyafuu.org","http":true,"https":true,"software":"foolfuuka","boards":["c","e","w","wg"],"files":["c","e","w","wg"]},{"uid":5,"name":"Love is Over","domain":"archive.loveisover.me","http":true,"https":true,"software":"foolfuuka","boards":["d","i","lgbt"],"files":["d","i","lgbt"]},{"uid":8,"name":"Rebecca Black Tech","domain":"rbt.asia","http":false,"https":true,"software":"fuuka","boards":["cgl","g","mu","w"],"files":["cgl","g","mu","w"]},{"uid":9,"name":"Heinessen","domain":"archive.heinessen.com","http":true,"https":false,"software":"fuuka","boards":["an","fit","k","mlp","r9k","toy"],"files":["an","fit","k","mlp","r9k","toy"]},{"uid":10,"name":"warosu","domain":"fuuka.warosu.org","http":false,"https":true,"software":"fuuka","boards":["3","biz","cgl","ck","diy","fa","g","ic","jp","lit","sci","tg","vr"],"files":["3","biz","cgl","ck","diy","fa","ic","jp","lit","sci","tg","vr"]},{"uid":15,"name":"fgts","domain":"fgts.eu","http":true,"https":true,"software":"foolfuuka","boards":["asp","cm","h","hc","hm","n","p","r","s","soc","y"],"files":["asp","cm","h","hc","hm","n","p","r","s","soc","y"]},{"uid":16,"name":"maware","domain":"archive.mawa.re","http":true,"https":false,"software":"foolfuuka","boards":["t"],"files":["t"]},{"uid":17,"name":"installgentoo.com","domain":"chan.installgentoo.com","http":true,"https":false,"software":"foolfuuka","boards":["g","t"],"files":["g","t"]},{"uid":19,"name":"Innovandalism Archive","domain":"boards.innovandalism.eu","http":true,"https":false,"software":"foolfuuka","boards":["v"],"files":[]},{"uid":13,"name":"Foolz Beta","domain":"beta.foolz.us","http":true,"https":true,"withCredentials":true,"software":"foolfuuka","boards":["a","biz","co","d","diy","gd","h","i","jp","m","mlp","s4s","sci","sp","tg","tv","u","v","vg","vp","vr","wsg"],"files":[]}],
+ archives: [{"uid":0,"name":"Foolz","domain":"archive.foolz.us","http":true,"https":true,"software":"foolfuuka","boards":["a","biz","co","diy","gd","jp","m","sci","sp","tg","tv","vg","vp","vr","wsg"],"files":["a","biz","diy","gd","jp","m","sci","tg","vg","vp","vr","wsg"]},{"uid":1,"name":"NSFW Foolz","domain":"nsfw.foolz.us","http":true,"https":true,"software":"foolfuuka","boards":["u"],"files":["u"]},{"uid":2,"name":"The Dark Cave","domain":"archive.thedarkcave.org","http":true,"https":true,"software":"foolfuuka","boards":["c","int","out","po"],"files":["c","po"]},{"uid":3,"name":"4plebs Archive","domain":"archive.4plebs.org","http":true,"https":true,"software":"foolfuuka","boards":["adv","hr","o","pol","s4s","tg","trv","tv","x"],"files":["adv","hr","o","pol","s4s","tg","trv","tv","x"]},{"uid":18,"name":"4plebs Flash Archive","domain":"flash.4plebs.org","http":true,"https":true,"software":"foolfuuka","boards":["f"],"files":["f"]},{"uid":4,"name":"Nyafuu","domain":"archive.nyafuu.org","http":true,"https":true,"software":"foolfuuka","boards":["c","e","w","wg"],"files":["c","e","w","wg"]},{"uid":5,"name":"Love is Over","domain":"archive.loveisover.me","http":true,"https":true,"software":"foolfuuka","boards":["d","i","lgbt"],"files":["d","i","lgbt"]},{"uid":8,"name":"Rebecca Black Tech","domain":"rbt.asia","http":false,"https":true,"software":"fuuka","boards":["cgl","g","mu","w"],"files":["cgl","g","mu","w"]},{"uid":9,"name":"Heinessen","domain":"archive.heinessen.com","http":true,"https":false,"software":"fuuka","boards":["an","fit","k","mlp","r9k","toy"],"files":["an","fit","k","mlp","r9k","toy"]},{"uid":10,"name":"warosu","domain":"fuuka.warosu.org","http":false,"https":true,"software":"fuuka","boards":["3","biz","cgl","ck","diy","fa","g","ic","jp","lit","sci","tg","vr"],"files":["3","biz","cgl","ck","diy","fa","ic","jp","lit","sci","tg","vr"]},{"uid":15,"name":"fgts","domain":"fgts.eu","http":true,"https":true,"software":"foolfuuka","boards":["asp","b","cm","h","hc","hm","n","p","r","s","soc","y"],"files":["asp","cm","h","hc","hm","n","p","r","s","soc","y"]},{"uid":16,"name":"maware","domain":"archive.mawa.re","http":true,"https":false,"software":"foolfuuka","boards":["t"],"files":["t"]},{"uid":17,"name":"installgentoo.com","domain":"chan.installgentoo.com","http":true,"https":false,"software":"foolfuuka","boards":["g","t"],"files":["g","t"]},{"uid":19,"name":"Innovandalism Archive","domain":"boards.innovandalism.eu","http":true,"https":false,"software":"foolfuuka","boards":["v"],"files":[]},{"uid":13,"name":"Foolz Beta","domain":"beta.foolz.us","http":true,"https":true,"withCredentials":true,"software":"foolfuuka","boards":["a","biz","co","d","diy","gd","h","i","jp","m","mlp","s4s","sci","sp","tg","tv","u","v","vg","vp","vr","wsg"],"files":[]}],
to: function(dest, data) {
var archive;
archive = (dest === 'search' ? Redirect.data.thread : Redirect.data[dest])[data.boardID];
@@ -11023,65 +11034,10 @@
return CatalogLinks.el.title = "Turn catalog links " + (useCatalog ? 'off' : 'on') + ".";
},
external: function(board) {
- switch (board) {
- case 'a':
- case 'c':
- case 'g':
- case 'co':
- case 'k':
- case 'm':
- case 'o':
- case 'p':
- case 'v':
- case 'vg':
- case 'w':
- case 'cm':
- case '3':
- case 'adv':
- case 'an':
- case 'cgl':
- case 'ck':
- case 'diy':
- case 'fa':
- case 'fit':
- case 'int':
- case 'jp':
- case 'mlp':
- case 'lit':
- case 'mu':
- case 'n':
- case 'po':
- case 'sci':
- case 'toy':
- case 'trv':
- case 'tv':
- case 'vp':
- case 'x':
- case 'q':
- return "http://catalog.neet.tv/" + board;
- case 'd':
- case 'e':
- case 'gif':
- case 'h':
- case 'hr':
- case 'hc':
- case 'r9k':
- case 's':
- case 'pol':
- case 'soc':
- case 'u':
- case 'i':
- case 'ic':
- case 'hm':
- case 'r':
- case 'w':
- case 'wg':
- case 'wsg':
- case 't':
- case 'y':
- return "http://4index.gropes.us/" + board;
- default:
- return "/" + board + "/catalog";
+ if (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;
+ } else {
+ return "/" + board + "/catalog";
}
}
};
@@ -11459,7 +11415,6 @@
if (g.VIEW === 'catalog' || !Conf['File Info Formatting']) {
return;
}
- this.funk = this.createFunc(Conf['fileInfo']);
return Post.callbacks.push({
name: 'File Info Formatting',
cb: this.node
@@ -11469,18 +11424,16 @@
if (!this.file || this.isClone) {
return;
}
- return this.file.text.innerHTML = "" + (FileInfo.funk(FileInfo, this)) + "";
+ return this.file.text.innerHTML = "" + (FileInfo.format(Conf['fileInfo'], this)) + "";
},
- createFunc: function(format) {
- var code;
- code = format.replace(/%(.)/g, function(s, c) {
+ format: function(formatString, post) {
+ return formatString.replace(/%([A-Za-z])/g, function(s, c) {
if (c in FileInfo.formatters) {
- return "' + FileInfo.formatters." + c + ".call(post) + '";
+ return FileInfo.formatters[c].call(post);
} else {
return s;
}
});
- return Function('FileInfo', 'post', "return '" + code + "'");
},
convertUnit: function(size, unit) {
var i;
@@ -11495,22 +11448,28 @@
return "" + size + " " + unit;
},
escape: function(name) {
- return name.replace(/<|>/g, function(c) {
- return c === '<' && '<' || '>';
+ return name.replace(/[&"'<>]/g, function(c) {
+ return {
+ '&': '&',
+ "'": ''',
+ '"': '"',
+ '<': '<',
+ '>': '>'
+ }[c];
});
},
formatters: {
t: function() {
- return this.file.URL.match(/\d+\..+$/)[0];
+ return FileInfo.escape(this.file.URL.match(/\d+\..+$/)[0]);
},
T: function() {
- return "" + (FileInfo.formatters.t.call(this)) + "";
+ return "" + (FileInfo.formatters.t.call(this)) + "";
},
l: function() {
- return "" + (FileInfo.formatters.n.call(this)) + "";
+ return "" + (FileInfo.formatters.n.call(this)) + "";
},
L: function() {
- return "" + (FileInfo.formatters.N.call(this)) + "";
+ return "" + (FileInfo.formatters.N.call(this)) + "";
},
n: function() {
var fullname, shortname;
@@ -11533,7 +11492,7 @@
}
},
s: function() {
- return this.file.size;
+ return FileInfo.escape(this.file.size);
},
B: function() {
return FileInfo.convertUnit(this.file.sizeInBytes, 'B');
@@ -11545,11 +11504,7 @@
return FileInfo.convertUnit(this.file.sizeInBytes, 'MB');
},
r: function() {
- if (this.file.isImage || this.file.isVideo) {
- return this.file.dimensions;
- } else {
- return 'PDF';
- }
+ return FileInfo.escape(this.file.dimensions || 'PDF');
}
}
};
@@ -12320,7 +12275,6 @@
if (g.VIEW === 'catalog' || !Conf['Time Formatting']) {
return;
}
- this.funk = this.createFunc(Conf['time']);
return Post.callbacks.push({
name: 'Time Formatting',
cb: this.node
@@ -12330,18 +12284,16 @@
if (this.isClone) {
return;
}
- return this.nodes.date.textContent = Time.funk(Time, this.info.date);
+ return this.nodes.date.textContent = Time.format(Conf['time'], this.info.date);
},
- createFunc: function(format) {
- var code;
- code = format.replace(/%([A-Za-z])/g, function(s, c) {
+ format: function(formatString, date) {
+ return formatString.replace(/%([A-Za-z])/g, function(s, c) {
if (c in Time.formatters) {
- return "' + Time.formatters." + c + ".call(date) + '";
+ return Time.formatters[c].call(date);
} else {
return s;
}
});
- return Function('Time', 'date', "return '" + code + "'");
},
day: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
month: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
@@ -13330,15 +13282,13 @@
return Header.generateBoardList(this.value);
},
time: function() {
- var funk;
- funk = Time.createFunc(this.value);
- return this.nextElementSibling.textContent = funk(Time, new Date());
+ return this.nextElementSibling.textContent = Time.format(this.value, new Date());
},
backlink: function() {
return this.nextElementSibling.textContent = this.value.replace(/%id/, '123456789');
},
fileInfo: function() {
- var data, funk;
+ var data;
data = {
isReply: true,
file: {
@@ -13351,8 +13301,7 @@
isSpoiler: true
}
};
- funk = FileInfo.createFunc(this.value);
- return this.nextElementSibling.innerHTML = funk(FileInfo, data);
+ return this.nextElementSibling.innerHTML = FileInfo.format(this.value, data);
},
favicon: function() {
Favicon["switch"]();
diff --git a/builds/crx.crx b/builds/crx.crx
index 07a13fc0d..f348a1ecf 100644
Binary files a/builds/crx.crx and b/builds/crx.crx differ
diff --git a/builds/crx/manifest.json b/builds/crx/manifest.json
index 27686cfda..a8fa40d46 100755
--- a/builds/crx/manifest.json
+++ b/builds/crx/manifest.json
@@ -1,6 +1,6 @@
{
"name": "4chan X",
- "version": "1.7.35",
+ "version": "1.7.36",
"manifest_version": 2,
"description": "Cross-browser userscript for maximum lurking on 4chan.",
"icons": {
diff --git a/builds/crx/script.js b/builds/crx/script.js
index 15b34859f..8a7df64a3 100644
--- a/builds/crx/script.js
+++ b/builds/crx/script.js
@@ -1,6 +1,6 @@
// Generated by CoffeeScript
/*
-* 4chan X - Version 1.7.35 - 2014-05-12
+* 4chan X - Version 1.7.36 - 2014-05-13
*
* Licensed under the MIT license.
* https://github.com/ccd0/4chan-x/blob/master/LICENSE
@@ -348,7 +348,7 @@
doc = d.documentElement;
g = {
- VERSION: '1.7.35',
+ VERSION: '1.7.36',
NAMESPACE: '4chan X.',
boards: {}
};
@@ -3097,7 +3097,7 @@
threshold = isReply ? 30 : 40;
ext = filename.match(/\.?[^\.]*$/)[0];
if (filename.length - ext.length > threshold) {
- return "" + filename.slice(0, threshold - 5) + "(...)." + ext;
+ return "" + filename.slice(0, threshold - 5) + "(...)" + ext;
} else {
return filename;
}
@@ -3438,6 +3438,7 @@
$.cache(url, function() {
return Get.archivedPost(this, boardID, postID, root, context);
}, {
+ responseType: 'json',
withCredentials: url.archive.withCredentials
});
} else {
@@ -4930,12 +4931,9 @@
QuoteBacklink = {
containers: {},
init: function() {
- var format;
if (g.VIEW === 'catalog' || !Conf['Quote Backlinks']) {
return;
}
- format = Conf['backlink'].replace(/%id/g, "' + id + '");
- this.funk = Function('id', "return '" + format + "'");
Post.callbacks.push({
name: 'Quote Backlinking Part 1',
cb: this.firstNode
@@ -4958,7 +4956,7 @@
a = $.el('a', {
href: "/" + this.board + "/thread/" + this.thread + "#p" + this,
className: this.isHidden ? 'filtered backlink' : 'backlink',
- textContent: (QuoteBacklink.funk(this.ID)) + (markYours ? '\u00A0(You)' : '')
+ textContent: (Conf['backlink'].replace(/%id/, this.ID)) + (markYours ? '\u00A0(You)' : '')
});
_ref = this.quotes;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
@@ -8378,7 +8376,7 @@
link = _ref[_i];
try {
if (link[0] !== '#') {
- links.push(this.createSauceLink(link.trim()));
+ links.push(link.trim());
}
} catch (_error) {
err = _error;
@@ -8396,21 +8394,34 @@
cb: this.node
});
},
- createSauceLink: function(link) {
- var m, text;
- link = link.replace(/%(T?URL|MD5|board|name)/g, function(parameter) {
- var type;
- return ((type = {
- '%TURL': 'post.file.thumbURL',
- '%URL': 'post.file.URL',
- '%MD5': 'post.file.MD5',
- '%board': 'post.board',
- '%name': 'post.file.name'
- }[parameter]) ? "' + encodeURIComponent(" + type + ") + '" : parameter);
- });
- text = (m = link.match(/;text:(.+)$/)) ? m[1] : link.match(/(\w+)\.\w+\//)[1];
+ createSauceLink: function(link, post, a) {
+ var i, m, parts, text, _i, _ref;
+ text = (m = link.match(/;text:(.+)$/)) ? m[1] : ((_ref = link.match(/(\w+)\.\w+\//)) != null ? _ref[1] : void 0) || '?';
link = link.replace(/;text:.+$/, '');
- return Function('post', 'a', "a.href = '" + link + "';\na.textContent = '" + text + "';\nreturn a;");
+ parts = [link, text];
+ for (i = _i = 0; _i <= 1; i = ++_i) {
+ parts[i] = parts[i].replace(/%(T?URL|MD5|board|name)/g, function(parameter) {
+ var type;
+ if (type = {
+ '%TURL': post.file.thumbURL,
+ '%URL': post.file.URL,
+ '%MD5': post.file.MD5,
+ '%board': post.board,
+ '%name': post.file.name
+ }[parameter]) {
+ if (i === 0) {
+ return encodeURIComponent(type);
+ } else {
+ return type;
+ }
+ } else {
+ return parameter;
+ }
+ });
+ }
+ a.href = parts[0];
+ a.textContent = parts[1];
+ return a;
},
node: function() {
var link, nodes, _i, _len, _ref;
@@ -8421,7 +8432,7 @@
_ref = Sauce.links;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
link = _ref[_i];
- nodes.push($.tn('\u00A0'), link(this, Sauce.link.cloneNode(true)));
+ nodes.push($.tn('\u00A0'), Sauce.createSauceLink(link, this, Sauce.link.cloneNode(true)));
}
return $.add(this.file.text, nodes);
}
@@ -10759,7 +10770,7 @@
}
return Redirect.data = o;
},
- archives: [{"uid":0,"name":"Foolz","domain":"archive.foolz.us","http":true,"https":true,"software":"foolfuuka","boards":["a","biz","co","diy","gd","jp","m","sci","sp","tg","tv","vg","vp","vr","wsg"],"files":["a","biz","diy","gd","jp","m","sci","tg","vg","vp","vr","wsg"]},{"uid":1,"name":"NSFW Foolz","domain":"nsfw.foolz.us","http":true,"https":true,"software":"foolfuuka","boards":["u"],"files":["u"]},{"uid":2,"name":"The Dark Cave","domain":"archive.thedarkcave.org","http":true,"https":true,"software":"foolfuuka","boards":["c","int","out","po"],"files":["c","po"]},{"uid":3,"name":"4plebs Archive","domain":"archive.4plebs.org","http":true,"https":true,"software":"foolfuuka","boards":["adv","hr","o","pol","s4s","tg","trv","tv","x"],"files":["adv","hr","o","pol","s4s","tg","trv","tv","x"]},{"uid":18,"name":"4plebs Flash Archive","domain":"flash.4plebs.org","http":true,"https":true,"software":"foolfuuka","boards":["f"],"files":["f"]},{"uid":4,"name":"Nyafuu","domain":"archive.nyafuu.org","http":true,"https":true,"software":"foolfuuka","boards":["c","e","w","wg"],"files":["c","e","w","wg"]},{"uid":5,"name":"Love is Over","domain":"archive.loveisover.me","http":true,"https":true,"software":"foolfuuka","boards":["d","i","lgbt"],"files":["d","i","lgbt"]},{"uid":8,"name":"Rebecca Black Tech","domain":"rbt.asia","http":false,"https":true,"software":"fuuka","boards":["cgl","g","mu","w"],"files":["cgl","g","mu","w"]},{"uid":9,"name":"Heinessen","domain":"archive.heinessen.com","http":true,"https":false,"software":"fuuka","boards":["an","fit","k","mlp","r9k","toy"],"files":["an","fit","k","mlp","r9k","toy"]},{"uid":10,"name":"warosu","domain":"fuuka.warosu.org","http":false,"https":true,"software":"fuuka","boards":["3","biz","cgl","ck","diy","fa","g","ic","jp","lit","sci","tg","vr"],"files":["3","biz","cgl","ck","diy","fa","ic","jp","lit","sci","tg","vr"]},{"uid":15,"name":"fgts","domain":"fgts.eu","http":true,"https":true,"software":"foolfuuka","boards":["asp","cm","h","hc","hm","n","p","r","s","soc","y"],"files":["asp","cm","h","hc","hm","n","p","r","s","soc","y"]},{"uid":16,"name":"maware","domain":"archive.mawa.re","http":true,"https":false,"software":"foolfuuka","boards":["t"],"files":["t"]},{"uid":17,"name":"installgentoo.com","domain":"chan.installgentoo.com","http":true,"https":false,"software":"foolfuuka","boards":["g","t"],"files":["g","t"]},{"uid":19,"name":"Innovandalism Archive","domain":"boards.innovandalism.eu","http":true,"https":false,"software":"foolfuuka","boards":["v"],"files":[]},{"uid":13,"name":"Foolz Beta","domain":"beta.foolz.us","http":true,"https":true,"withCredentials":true,"software":"foolfuuka","boards":["a","biz","co","d","diy","gd","h","i","jp","m","mlp","s4s","sci","sp","tg","tv","u","v","vg","vp","vr","wsg"],"files":[]}],
+ archives: [{"uid":0,"name":"Foolz","domain":"archive.foolz.us","http":true,"https":true,"software":"foolfuuka","boards":["a","biz","co","diy","gd","jp","m","sci","sp","tg","tv","vg","vp","vr","wsg"],"files":["a","biz","diy","gd","jp","m","sci","tg","vg","vp","vr","wsg"]},{"uid":1,"name":"NSFW Foolz","domain":"nsfw.foolz.us","http":true,"https":true,"software":"foolfuuka","boards":["u"],"files":["u"]},{"uid":2,"name":"The Dark Cave","domain":"archive.thedarkcave.org","http":true,"https":true,"software":"foolfuuka","boards":["c","int","out","po"],"files":["c","po"]},{"uid":3,"name":"4plebs Archive","domain":"archive.4plebs.org","http":true,"https":true,"software":"foolfuuka","boards":["adv","hr","o","pol","s4s","tg","trv","tv","x"],"files":["adv","hr","o","pol","s4s","tg","trv","tv","x"]},{"uid":18,"name":"4plebs Flash Archive","domain":"flash.4plebs.org","http":true,"https":true,"software":"foolfuuka","boards":["f"],"files":["f"]},{"uid":4,"name":"Nyafuu","domain":"archive.nyafuu.org","http":true,"https":true,"software":"foolfuuka","boards":["c","e","w","wg"],"files":["c","e","w","wg"]},{"uid":5,"name":"Love is Over","domain":"archive.loveisover.me","http":true,"https":true,"software":"foolfuuka","boards":["d","i","lgbt"],"files":["d","i","lgbt"]},{"uid":8,"name":"Rebecca Black Tech","domain":"rbt.asia","http":false,"https":true,"software":"fuuka","boards":["cgl","g","mu","w"],"files":["cgl","g","mu","w"]},{"uid":9,"name":"Heinessen","domain":"archive.heinessen.com","http":true,"https":false,"software":"fuuka","boards":["an","fit","k","mlp","r9k","toy"],"files":["an","fit","k","mlp","r9k","toy"]},{"uid":10,"name":"warosu","domain":"fuuka.warosu.org","http":false,"https":true,"software":"fuuka","boards":["3","biz","cgl","ck","diy","fa","g","ic","jp","lit","sci","tg","vr"],"files":["3","biz","cgl","ck","diy","fa","ic","jp","lit","sci","tg","vr"]},{"uid":15,"name":"fgts","domain":"fgts.eu","http":true,"https":true,"software":"foolfuuka","boards":["asp","b","cm","h","hc","hm","n","p","r","s","soc","y"],"files":["asp","cm","h","hc","hm","n","p","r","s","soc","y"]},{"uid":16,"name":"maware","domain":"archive.mawa.re","http":true,"https":false,"software":"foolfuuka","boards":["t"],"files":["t"]},{"uid":17,"name":"installgentoo.com","domain":"chan.installgentoo.com","http":true,"https":false,"software":"foolfuuka","boards":["g","t"],"files":["g","t"]},{"uid":19,"name":"Innovandalism Archive","domain":"boards.innovandalism.eu","http":true,"https":false,"software":"foolfuuka","boards":["v"],"files":[]},{"uid":13,"name":"Foolz Beta","domain":"beta.foolz.us","http":true,"https":true,"withCredentials":true,"software":"foolfuuka","boards":["a","biz","co","d","diy","gd","h","i","jp","m","mlp","s4s","sci","sp","tg","tv","u","v","vg","vp","vr","wsg"],"files":[]}],
to: function(dest, data) {
var archive;
archive = (dest === 'search' ? Redirect.data.thread : Redirect.data[dest])[data.boardID];
@@ -11026,65 +11037,10 @@
return CatalogLinks.el.title = "Turn catalog links " + (useCatalog ? 'off' : 'on') + ".";
},
external: function(board) {
- switch (board) {
- case 'a':
- case 'c':
- case 'g':
- case 'co':
- case 'k':
- case 'm':
- case 'o':
- case 'p':
- case 'v':
- case 'vg':
- case 'w':
- case 'cm':
- case '3':
- case 'adv':
- case 'an':
- case 'cgl':
- case 'ck':
- case 'diy':
- case 'fa':
- case 'fit':
- case 'int':
- case 'jp':
- case 'mlp':
- case 'lit':
- case 'mu':
- case 'n':
- case 'po':
- case 'sci':
- case 'toy':
- case 'trv':
- case 'tv':
- case 'vp':
- case 'x':
- case 'q':
- return "http://catalog.neet.tv/" + board;
- case 'd':
- case 'e':
- case 'gif':
- case 'h':
- case 'hr':
- case 'hc':
- case 'r9k':
- case 's':
- case 'pol':
- case 'soc':
- case 'u':
- case 'i':
- case 'ic':
- case 'hm':
- case 'r':
- case 'w':
- case 'wg':
- case 'wsg':
- case 't':
- case 'y':
- return "http://4index.gropes.us/" + board;
- default:
- return "/" + board + "/catalog";
+ if (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;
+ } else {
+ return "/" + board + "/catalog";
}
}
};
@@ -11462,7 +11418,6 @@
if (g.VIEW === 'catalog' || !Conf['File Info Formatting']) {
return;
}
- this.funk = this.createFunc(Conf['fileInfo']);
return Post.callbacks.push({
name: 'File Info Formatting',
cb: this.node
@@ -11472,18 +11427,16 @@
if (!this.file || this.isClone) {
return;
}
- return this.file.text.innerHTML = "" + (FileInfo.funk(FileInfo, this)) + "";
+ return this.file.text.innerHTML = "" + (FileInfo.format(Conf['fileInfo'], this)) + "";
},
- createFunc: function(format) {
- var code;
- code = format.replace(/%(.)/g, function(s, c) {
+ format: function(formatString, post) {
+ return formatString.replace(/%([A-Za-z])/g, function(s, c) {
if (c in FileInfo.formatters) {
- return "' + FileInfo.formatters." + c + ".call(post) + '";
+ return FileInfo.formatters[c].call(post);
} else {
return s;
}
});
- return Function('FileInfo', 'post', "return '" + code + "'");
},
convertUnit: function(size, unit) {
var i;
@@ -11498,22 +11451,28 @@
return "" + size + " " + unit;
},
escape: function(name) {
- return name.replace(/<|>/g, function(c) {
- return c === '<' && '<' || '>';
+ return name.replace(/[&"'<>]/g, function(c) {
+ return {
+ '&': '&',
+ "'": ''',
+ '"': '"',
+ '<': '<',
+ '>': '>'
+ }[c];
});
},
formatters: {
t: function() {
- return this.file.URL.match(/\d+\..+$/)[0];
+ return FileInfo.escape(this.file.URL.match(/\d+\..+$/)[0]);
},
T: function() {
- return "" + (FileInfo.formatters.t.call(this)) + "";
+ return "" + (FileInfo.formatters.t.call(this)) + "";
},
l: function() {
- return "" + (FileInfo.formatters.n.call(this)) + "";
+ return "" + (FileInfo.formatters.n.call(this)) + "";
},
L: function() {
- return "" + (FileInfo.formatters.N.call(this)) + "";
+ return "" + (FileInfo.formatters.N.call(this)) + "";
},
n: function() {
var fullname, shortname;
@@ -11536,7 +11495,7 @@
}
},
s: function() {
- return this.file.size;
+ return FileInfo.escape(this.file.size);
},
B: function() {
return FileInfo.convertUnit(this.file.sizeInBytes, 'B');
@@ -11548,11 +11507,7 @@
return FileInfo.convertUnit(this.file.sizeInBytes, 'MB');
},
r: function() {
- if (this.file.isImage || this.file.isVideo) {
- return this.file.dimensions;
- } else {
- return 'PDF';
- }
+ return FileInfo.escape(this.file.dimensions || 'PDF');
}
}
};
@@ -12323,7 +12278,6 @@
if (g.VIEW === 'catalog' || !Conf['Time Formatting']) {
return;
}
- this.funk = this.createFunc(Conf['time']);
return Post.callbacks.push({
name: 'Time Formatting',
cb: this.node
@@ -12333,18 +12287,16 @@
if (this.isClone) {
return;
}
- return this.nodes.date.textContent = Time.funk(Time, this.info.date);
+ return this.nodes.date.textContent = Time.format(Conf['time'], this.info.date);
},
- createFunc: function(format) {
- var code;
- code = format.replace(/%([A-Za-z])/g, function(s, c) {
+ format: function(formatString, date) {
+ return formatString.replace(/%([A-Za-z])/g, function(s, c) {
if (c in Time.formatters) {
- return "' + Time.formatters." + c + ".call(date) + '";
+ return Time.formatters[c].call(date);
} else {
return s;
}
});
- return Function('Time', 'date', "return '" + code + "'");
},
day: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
month: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
@@ -13335,15 +13287,13 @@
return Header.generateBoardList(this.value);
},
time: function() {
- var funk;
- funk = Time.createFunc(this.value);
- return this.nextElementSibling.textContent = funk(Time, new Date());
+ return this.nextElementSibling.textContent = Time.format(this.value, new Date());
},
backlink: function() {
return this.nextElementSibling.textContent = this.value.replace(/%id/, '123456789');
},
fileInfo: function() {
- var data, funk;
+ var data;
data = {
isReply: true,
file: {
@@ -13356,8 +13306,7 @@
isSpoiler: true
}
};
- funk = FileInfo.createFunc(this.value);
- return this.nextElementSibling.innerHTML = funk(FileInfo, data);
+ return this.nextElementSibling.innerHTML = FileInfo.format(this.value, data);
},
favicon: function() {
Favicon["switch"]();
diff --git a/builds/updates.xml b/builds/updates.xml
index 46cb7dd97..ccd0456f1 100644
--- a/builds/updates.xml
+++ b/builds/updates.xml
@@ -1,7 +1,7 @@
-
+
diff --git a/package.json b/package.json
index 2dae4ebbc..a4ab37699 100755
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "4chan-X",
- "version": "1.7.35",
+ "version": "1.7.36",
"description": "Cross-browser userscript for maximum lurking on 4chan.",
"meta": {
"name": "4chan X",