if soda in can? Really? How about if can.contains soda
This commit is contained in:
parent
a24f2936b4
commit
06019028f6
110
4chan_x.user.js
110
4chan_x.user.js
@ -45,7 +45,6 @@
|
|||||||
(function() {
|
(function() {
|
||||||
var $, $$, Anonymize, ArchiveLink, AutoGIF, Board, Build, Clone, Conf, Config, CustomCSS, DeleteLink, DownloadLink, ExpandComment, ExpandThread, Favicon, FileInfo, Filter, Fourchan, Get, Header, ImageExpand, ImageHover, Keybinds, Main, Menu, Misc, Nav, Notification, Polyfill, Post, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteYou, Quotify, Recursive, Redirect, RelativeDates, ReplyHiding, Report, ReportLink, RevealSpoilers, Sauce, Settings, Thread, ThreadExcerpt, ThreadHiding, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, c, d, doc, g,
|
var $, $$, Anonymize, ArchiveLink, AutoGIF, Board, Build, Clone, Conf, Config, CustomCSS, DeleteLink, DownloadLink, ExpandComment, ExpandThread, Favicon, FileInfo, Filter, Fourchan, Get, Header, ImageExpand, ImageHover, Keybinds, Main, Menu, Misc, Nav, Notification, Polyfill, Post, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteYou, Quotify, Recursive, Redirect, RelativeDates, ReplyHiding, Report, ReportLink, RevealSpoilers, Sauce, Settings, Thread, ThreadExcerpt, ThreadHiding, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, c, d, doc, g,
|
||||||
__slice = [].slice,
|
__slice = [].slice,
|
||||||
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
|
|
||||||
__hasProp = {}.hasOwnProperty,
|
__hasProp = {}.hasOwnProperty,
|
||||||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
||||||
|
|
||||||
@ -1620,9 +1619,9 @@
|
|||||||
name = _ref[_i];
|
name = _ref[_i];
|
||||||
input = $("[name=" + name + "]", section);
|
input = $("[name=" + name + "]", section);
|
||||||
input.value = $.get(name, Conf[name]);
|
input.value = $.get(name, Conf[name]);
|
||||||
event = name === 'favicon' || name === 'usercss' ? 'change' : 'input';
|
event = ['favicon', 'usercss'].contains(name) ? 'change' : 'input';
|
||||||
$.on(input, event, $.cb.value);
|
$.on(input, event, $.cb.value);
|
||||||
if (name !== 'usercss') {
|
if (!['usercss'].contains(name)) {
|
||||||
$.on(input, event, Settings[name]);
|
$.on(input, event, Settings[name]);
|
||||||
Settings[name].call(input);
|
Settings[name].call(input);
|
||||||
}
|
}
|
||||||
@ -1785,7 +1784,7 @@
|
|||||||
Filter = {
|
Filter = {
|
||||||
filters: {},
|
filters: {},
|
||||||
init: function() {
|
init: function() {
|
||||||
var boards, filter, hl, key, op, regexp, stub, top, _i, _len, _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
|
var boards, filter, hl, key, op, regexp, stub, top, _i, _len, _ref, _ref1, _ref2, _ref3, _ref4;
|
||||||
if (g.VIEW === 'catalog' || !Conf['Filter']) {
|
if (g.VIEW === 'catalog' || !Conf['Filter']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1802,10 +1801,10 @@
|
|||||||
}
|
}
|
||||||
filter = filter.replace(regexp[0], '');
|
filter = filter.replace(regexp[0], '');
|
||||||
boards = ((_ref1 = filter.match(/boards:([^;]+)/)) != null ? _ref1[1].toLowerCase() : void 0) || 'global';
|
boards = ((_ref1 = filter.match(/boards:([^;]+)/)) != null ? _ref1[1].toLowerCase() : void 0) || 'global';
|
||||||
if (boards !== 'global' && !(_ref2 = g.BOARD.ID, __indexOf.call(boards.split(','), _ref2) >= 0)) {
|
if (boards !== 'global' && !(boards.split(',')).contains(g.BOARD.ID)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (key === 'uniqueID' || key === 'MD5') {
|
if (['uniqueID', 'MD5'].contains(key)) {
|
||||||
regexp = regexp[1];
|
regexp = regexp[1];
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
@ -1815,10 +1814,10 @@
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
op = ((_ref3 = filter.match(/[^t]op:(yes|no|only)/)) != null ? _ref3[1] : void 0) || 'yes';
|
op = ((_ref2 = filter.match(/[^t]op:(yes|no|only)/)) != null ? _ref2[1] : void 0) || 'yes';
|
||||||
stub = (function() {
|
stub = (function() {
|
||||||
var _ref4;
|
var _ref3;
|
||||||
switch ((_ref4 = filter.match(/stub:(yes|no)/)) != null ? _ref4[1] : void 0) {
|
switch ((_ref3 = filter.match(/stub:(yes|no)/)) != null ? _ref3[1] : void 0) {
|
||||||
case 'yes':
|
case 'yes':
|
||||||
return true;
|
return true;
|
||||||
case 'no':
|
case 'no':
|
||||||
@ -1828,8 +1827,8 @@
|
|||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
if (hl = /highlight/.test(filter)) {
|
if (hl = /highlight/.test(filter)) {
|
||||||
hl = ((_ref4 = filter.match(/highlight:(\w+)/)) != null ? _ref4[1] : void 0) || 'filter-highlight';
|
hl = ((_ref3 = filter.match(/highlight:(\w+)/)) != null ? _ref3[1] : void 0) || 'filter-highlight';
|
||||||
top = ((_ref5 = filter.match(/top:(yes|no)/)) != null ? _ref5[1] : void 0) || 'yes';
|
top = ((_ref4 = filter.match(/top:(yes|no)/)) != null ? _ref4[1] : void 0) || 'yes';
|
||||||
top = top === 'yes';
|
top = top === 'yes';
|
||||||
}
|
}
|
||||||
this.filters[key].push(this.createFilter(regexp, op, stub, hl, top));
|
this.filters[key].push(this.createFilter(regexp, op, stub, hl, top));
|
||||||
@ -2026,7 +2025,7 @@
|
|||||||
var re, save, section, select, ta, tl, type, value;
|
var re, save, section, select, ta, tl, type, value;
|
||||||
type = this.dataset.type;
|
type = this.dataset.type;
|
||||||
value = Filter[type](Filter.menu.post);
|
value = Filter[type](Filter.menu.post);
|
||||||
re = type === 'uniqueID' || type === 'MD5' ? value : value.replace(/\/|\\|\^|\$|\n|\.|\(|\)|\{|\}|\[|\]|\?|\*|\+|\|/g, function(c) {
|
re = ['uniqueID', 'MD5'].contains(type) ? value : value.replace(/\/|\\|\^|\$|\n|\.|\(|\)|\{|\}|\[|\]|\?|\*|\+|\|/g, function(c) {
|
||||||
if (c === '\n') {
|
if (c === '\n') {
|
||||||
return '\\n';
|
return '\\n';
|
||||||
} else if (c === '\\') {
|
} else if (c === '\\') {
|
||||||
@ -2035,7 +2034,7 @@
|
|||||||
return "\\" + c;
|
return "\\" + c;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
re = type === 'uniqueID' || type === 'MD5' ? "/" + re + "/" : "/^" + re + "$/";
|
re = ['uniqueID', 'MD5'].contains(type) ? "/" + re + "/" : "/^" + re + "$/";
|
||||||
if (!Filter.menu.post.isReply) {
|
if (!Filter.menu.post.isReply) {
|
||||||
re += ';op:yes';
|
re += ';op:yes';
|
||||||
}
|
}
|
||||||
@ -2565,7 +2564,7 @@
|
|||||||
_ref = g.posts;
|
_ref = g.posts;
|
||||||
for (ID in _ref) {
|
for (ID in _ref) {
|
||||||
post = _ref[ID];
|
post = _ref[ID];
|
||||||
if (__indexOf.call(post.quotes, fullID) >= 0) {
|
if (post.quotes.contains(fullID)) {
|
||||||
recursive.apply(null, [post].concat(__slice.call(args)));
|
recursive.apply(null, [post].concat(__slice.call(args)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2720,8 +2719,8 @@
|
|||||||
el: div,
|
el: div,
|
||||||
order: 40,
|
order: 40,
|
||||||
open: function(post) {
|
open: function(post) {
|
||||||
var node, seconds, thread, _ref;
|
var node, seconds, thread;
|
||||||
if (post.isDead || !((thread = QR.yourPosts.threads[post.thread]) && (_ref = post.ID, __indexOf.call(thread, _ref) >= 0))) {
|
if (post.isDead || !((thread = QR.yourPosts.threads[post.thread]) && thread.contains(post.ID))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
DeleteLink.post = post;
|
DeleteLink.post = post;
|
||||||
@ -2936,12 +2935,12 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
keydown: function(e) {
|
keydown: function(e) {
|
||||||
var form, key, notification, notifications, target, thread, threadRoot, _i, _len, _ref;
|
var form, key, notification, notifications, target, thread, threadRoot, _i, _len;
|
||||||
if (!(key = Keybinds.keyCode(e))) {
|
if (!(key = Keybinds.keyCode(e))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
target = e.target;
|
target = e.target;
|
||||||
if ((_ref = target.nodeName) === 'INPUT' || _ref === 'TEXTAREA') {
|
if (['INPUT', 'TEXTAREA'].contains(target.nodeName)) {
|
||||||
if (!/(Esc|Alt|Ctrl|Meta)/.test(key)) {
|
if (!/(Esc|Alt|Ctrl|Meta)/.test(key)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3596,36 +3595,36 @@
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
allQuotelinksLinkingTo: function(post) {
|
allQuotelinksLinkingTo: function(post) {
|
||||||
var ID, quote, quotedPost, quotelinks, quoterPost, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _ref3, _ref4;
|
var ID, quote, quotedPost, quotelinks, quoterPost, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _ref3;
|
||||||
quotelinks = [];
|
quotelinks = [];
|
||||||
_ref = g.posts;
|
_ref = g.posts;
|
||||||
for (ID in _ref) {
|
for (ID in _ref) {
|
||||||
quoterPost = _ref[ID];
|
quoterPost = _ref[ID];
|
||||||
if (_ref1 = post.fullID, __indexOf.call(quoterPost.quotes, _ref1) >= 0) {
|
if (quoterPost.quotes.contains(post.fullID)) {
|
||||||
_ref2 = [quoterPost].concat(quoterPost.clones);
|
_ref1 = [quoterPost].concat(quoterPost.clones);
|
||||||
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
|
||||||
quoterPost = _ref2[_i];
|
quoterPost = _ref1[_i];
|
||||||
quotelinks.push.apply(quotelinks, quoterPost.nodes.quotelinks);
|
quotelinks.push.apply(quotelinks, quoterPost.nodes.quotelinks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Conf['Quote Backlinks']) {
|
if (Conf['Quote Backlinks']) {
|
||||||
_ref3 = post.quotes;
|
_ref2 = post.quotes;
|
||||||
for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) {
|
for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
|
||||||
quote = _ref3[_j];
|
quote = _ref2[_j];
|
||||||
if (!(quotedPost = g.posts[quote])) {
|
if (!(quotedPost = g.posts[quote])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
_ref4 = [quotedPost].concat(quotedPost.clones);
|
_ref3 = [quotedPost].concat(quotedPost.clones);
|
||||||
for (_k = 0, _len2 = _ref4.length; _k < _len2; _k++) {
|
for (_k = 0, _len2 = _ref3.length; _k < _len2; _k++) {
|
||||||
quotedPost = _ref4[_k];
|
quotedPost = _ref3[_k];
|
||||||
quotelinks.push.apply(quotelinks, __slice.call(quotedPost.nodes.backlinks));
|
quotelinks.push.apply(quotelinks, __slice.call(quotedPost.nodes.backlinks));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return quotelinks.filter(function(quotelink) {
|
return quotelinks.filter(function(quotelink) {
|
||||||
var board, postID, _ref5;
|
var board, postID, _ref4;
|
||||||
_ref5 = Get.postDataFromLink(quotelink), board = _ref5.board, postID = _ref5.postID;
|
_ref4 = Get.postDataFromLink(quotelink), board = _ref4.board, postID = _ref4.postID;
|
||||||
return board === post.board.ID && postID === post.ID;
|
return board === post.board.ID && postID === post.ID;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -3666,7 +3665,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
status = req.status;
|
status = req.status;
|
||||||
if (status !== 200 && status !== 304) {
|
if (![200, 304].contains(status)) {
|
||||||
if (url = Redirect.post(board, postID)) {
|
if (url = Redirect.post(board, postID)) {
|
||||||
$.cache(url, function() {
|
$.cache(url, function() {
|
||||||
return Get.archivedPost(this, board, postID, root, context);
|
return Get.archivedPost(this, board, postID, root, context);
|
||||||
@ -3898,7 +3897,7 @@
|
|||||||
a.setAttribute('data-postid', ID);
|
a.setAttribute('data-postid', ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (__indexOf.call(this.quotes, quoteID) < 0) {
|
if (!this.quotes.contains(quoteID)) {
|
||||||
this.quotes.push(quoteID);
|
this.quotes.push(quoteID);
|
||||||
}
|
}
|
||||||
if (!a) {
|
if (!a) {
|
||||||
@ -4193,7 +4192,7 @@
|
|||||||
for (_i = 0, _len = quotelinks.length; _i < _len; _i++) {
|
for (_i = 0, _len = quotelinks.length; _i < _len; _i++) {
|
||||||
quotelink = quotelinks[_i];
|
quotelink = quotelinks[_i];
|
||||||
_ref = Get.postDataFromLink(quotelink), threadID = _ref.threadID, postID = _ref.postID;
|
_ref = Get.postDataFromLink(quotelink), threadID = _ref.threadID, postID = _ref.postID;
|
||||||
if ((thread = QR.yourPosts.threads[threadID]) && __indexOf.call(thread, postID) >= 0) {
|
if ((thread = QR.yourPosts.threads[threadID]) && thread.contains(postID)) {
|
||||||
$.add(quotelink, $.tn(QuoteYou.text));
|
$.add(quotelink, $.tn(QuoteYou.text));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4212,7 +4211,7 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
node: function() {
|
node: function() {
|
||||||
var board, op, postID, quotelink, quotelinks, quotes, _i, _j, _len, _len1, _ref, _ref1;
|
var board, op, postID, quotelink, quotelinks, quotes, _i, _j, _len, _len1, _ref;
|
||||||
if (this.isClone && this.thread === this.context.thread) {
|
if (this.isClone && this.thread === this.context.thread) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -4220,19 +4219,19 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
quotelinks = this.nodes.quotelinks;
|
quotelinks = this.nodes.quotelinks;
|
||||||
if (this.isClone && (_ref = this.thread.fullID, __indexOf.call(quotes, _ref) >= 0)) {
|
if (this.isClone && quotes.contains(this.thread.fullID)) {
|
||||||
for (_i = 0, _len = quotelinks.length; _i < _len; _i++) {
|
for (_i = 0, _len = quotelinks.length; _i < _len; _i++) {
|
||||||
quotelink = quotelinks[_i];
|
quotelink = quotelinks[_i];
|
||||||
quotelink.textContent = quotelink.textContent.replace(QuoteOP.text, '');
|
quotelink.textContent = quotelink.textContent.replace(QuoteOP.text, '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
op = (this.isClone ? this.context : this).thread.fullID;
|
op = (this.isClone ? this.context : this).thread.fullID;
|
||||||
if (__indexOf.call(quotes, op) < 0) {
|
if (!quotes.contains(op)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (_j = 0, _len1 = quotelinks.length; _j < _len1; _j++) {
|
for (_j = 0, _len1 = quotelinks.length; _j < _len1; _j++) {
|
||||||
quotelink = quotelinks[_j];
|
quotelink = quotelinks[_j];
|
||||||
_ref1 = Get.postDataFromLink(quotelink), board = _ref1.board, postID = _ref1.postID;
|
_ref = Get.postDataFromLink(quotelink), board = _ref.board, postID = _ref.postID;
|
||||||
if (("" + board + "." + postID) === op) {
|
if (("" + board + "." + postID) === op) {
|
||||||
$.add(quotelink, $.tn(QuoteOP.text));
|
$.add(quotelink, $.tn(QuoteOP.text));
|
||||||
}
|
}
|
||||||
@ -4867,7 +4866,7 @@
|
|||||||
innerHTML: "<input type=checkbox name='" + type + "'> " + type
|
innerHTML: "<input type=checkbox name='" + type + "'> " + type
|
||||||
});
|
});
|
||||||
input = label.firstElementChild;
|
input = label.firstElementChild;
|
||||||
if (type === 'Fit width' || type === 'Fit height') {
|
if (['Fit width', 'Fit height'].contains(type)) {
|
||||||
$.on(input, 'change', ImageExpand.cb.setFitness);
|
$.on(input, 'change', ImageExpand.cb.setFitness);
|
||||||
}
|
}
|
||||||
if (config) {
|
if (config) {
|
||||||
@ -4909,8 +4908,7 @@
|
|||||||
|
|
||||||
AutoGIF = {
|
AutoGIF = {
|
||||||
init: function() {
|
init: function() {
|
||||||
var _ref;
|
if (g.VIEW === 'catalog' || !Conf['Auto-GIF'] || ['gif', 'wsg'].contains(g.BOARD.ID)) {
|
||||||
if (g.VIEW === 'catalog' || !Conf['Auto-GIF'] || ((_ref = g.BOARD.ID) === 'gif' || _ref === 'wsg')) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return Post.prototype.callbacks.push({
|
return Post.prototype.callbacks.push({
|
||||||
@ -5071,7 +5069,7 @@
|
|||||||
parse: function(req, a, post) {
|
parse: function(req, a, post) {
|
||||||
var clone, comment, href, postObj, posts, quote, spoilerRange, status, _i, _j, _len, _len1, _ref;
|
var clone, comment, href, postObj, posts, quote, spoilerRange, status, _i, _j, _len, _len1, _ref;
|
||||||
status = req.status;
|
status = req.status;
|
||||||
if (status !== 200 && status !== 304) {
|
if (![200, 304].contains(status)) {
|
||||||
a.textContent = "Error " + req.statusText + " (" + status + ")";
|
a.textContent = "Error " + req.statusText + " (" + status + ")";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -5220,7 +5218,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
status = req.status;
|
status = req.status;
|
||||||
if (status !== 200 && status !== 304) {
|
if ([200, 304].contains(status)) {
|
||||||
a.textContent = "Error " + req.statusText + " (" + status + ")";
|
a.textContent = "Error " + req.statusText + " (" + status + ")";
|
||||||
$.off(a, 'click', ExpandThread.cb.toggle);
|
$.off(a, 'click', ExpandThread.cb.toggle);
|
||||||
return;
|
return;
|
||||||
@ -5316,7 +5314,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
addPosts: function(newPosts) {
|
addPosts: function(newPosts) {
|
||||||
var ID, post, youInThisThread, yourPosts, _i, _len, _ref;
|
var ID, post, youInThisThread, yourPosts, _i, _len;
|
||||||
if (Conf['Quick Reply']) {
|
if (Conf['Quick Reply']) {
|
||||||
yourPosts = QR.yourPosts;
|
yourPosts = QR.yourPosts;
|
||||||
youInThisThread = yourPosts.threads[Unread.thread];
|
youInThisThread = yourPosts.threads[Unread.thread];
|
||||||
@ -5324,7 +5322,7 @@
|
|||||||
for (_i = 0, _len = newPosts.length; _i < _len; _i++) {
|
for (_i = 0, _len = newPosts.length; _i < _len; _i++) {
|
||||||
post = newPosts[_i];
|
post = newPosts[_i];
|
||||||
ID = post.ID;
|
ID = post.ID;
|
||||||
if (ID <= Unread.lastReadPost || post.isHidden || youInThisThread && __indexOf.call(youInThisThread, ID) >= 0) {
|
if (ID <= Unread.lastReadPost || post.isHidden || youInThisThread && youInThisThread.contains(ID)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Unread.posts.push(post);
|
Unread.posts.push(post);
|
||||||
@ -5333,7 +5331,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Conf['Unread Line']) {
|
if (Conf['Unread Line']) {
|
||||||
Unread.setLine((_ref = Unread.posts[0], __indexOf.call(newPosts, _ref) >= 0));
|
Unread.setLine(newPosts.contains(Unread.posts[0]));
|
||||||
}
|
}
|
||||||
Unread.read();
|
Unread.read();
|
||||||
return Unread.update();
|
return Unread.update();
|
||||||
@ -5350,7 +5348,7 @@
|
|||||||
_ref2 = yourPosts.threads;
|
_ref2 = yourPosts.threads;
|
||||||
for (thread in _ref2) {
|
for (thread in _ref2) {
|
||||||
postIDs = _ref2[thread];
|
postIDs = _ref2[thread];
|
||||||
if (__indexOf.call(postIDs, +quoteID) >= 0) {
|
if (postIDs.contains(+quoteID)) {
|
||||||
Unread.postsQuotingYou.push(post);
|
Unread.postsQuotingYou.push(post);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -5801,12 +5799,12 @@
|
|||||||
for (ID in _ref) {
|
for (ID in _ref) {
|
||||||
post = _ref[ID];
|
post = _ref[ID];
|
||||||
ID = +ID;
|
ID = +ID;
|
||||||
if (post.isDead && __indexOf.call(index, ID) >= 0) {
|
if (post.isDead && index.contains(ID)) {
|
||||||
post.resurrect();
|
post.resurrect();
|
||||||
} else if (__indexOf.call(index, ID) < 0) {
|
} else if (!index.contains(ID)) {
|
||||||
post.kill();
|
post.kill();
|
||||||
deletedPosts.push(post);
|
deletedPosts.push(post);
|
||||||
} else if (post.file && !post.file.isDead && __indexOf.call(files, ID) < 0) {
|
} else if (post.file && !post.file.isDead && files.contains(ID)) {
|
||||||
post.kill(true);
|
post.kill(true);
|
||||||
deletedFiles.push(post);
|
deletedFiles.push(post);
|
||||||
}
|
}
|
||||||
@ -6349,7 +6347,7 @@
|
|||||||
return QR.nodes.fileInput.click();
|
return QR.nodes.fileInput.click();
|
||||||
},
|
},
|
||||||
fileInput: function(files) {
|
fileInput: function(files) {
|
||||||
var file, length, max, post, _i, _len, _ref, _ref1;
|
var file, length, max, post, _i, _len;
|
||||||
if (this instanceof Element) {
|
if (this instanceof Element) {
|
||||||
files = __slice.call(this.files);
|
files = __slice.call(this.files);
|
||||||
QR.nodes.fileInput.value = null;
|
QR.nodes.fileInput.value = null;
|
||||||
@ -6366,7 +6364,7 @@
|
|||||||
QR.selected.pasteText(file);
|
QR.selected.pasteText(file);
|
||||||
} else if (file.size > max) {
|
} else if (file.size > max) {
|
||||||
QR.error("File too large (file: " + ($.bytesToString(file.size)) + ", max: " + ($.bytesToString(max)) + ").");
|
QR.error("File too large (file: " + ($.bytesToString(file.size)) + ", max: " + ($.bytesToString(max)) + ").");
|
||||||
} else if (_ref = file.type, __indexOf.call(QR.mimeTypes, _ref) < 0) {
|
} else if (!QR.mimeTypes.contains(file.type)) {
|
||||||
QR.error('Unsupported file type.');
|
QR.error('Unsupported file type.');
|
||||||
} else {
|
} else {
|
||||||
QR.selected.setFile(file);
|
QR.selected.setFile(file);
|
||||||
@ -6382,7 +6380,7 @@
|
|||||||
post.pasteText(file);
|
post.pasteText(file);
|
||||||
} else if (file.size > max) {
|
} else if (file.size > max) {
|
||||||
QR.error("" + file.name + ": File too large (file: " + ($.bytesToString(file.size)) + ", max: " + ($.bytesToString(max)) + ").");
|
QR.error("" + file.name + ": File too large (file: " + ($.bytesToString(file.size)) + ", max: " + ($.bytesToString(max)) + ").");
|
||||||
} else if (_ref1 = file.type, __indexOf.call(QR.mimeTypes, _ref1) < 0) {
|
} else if (!QR.mimeTypes.contains(file.type)) {
|
||||||
QR.error("" + file.name + ": Unsupported file type.");
|
QR.error("" + file.name + ": Unsupported file type.");
|
||||||
} else {
|
} else {
|
||||||
if ((post = QR.posts[QR.posts.length - 1]).file) {
|
if ((post = QR.posts[QR.posts.length - 1]).file) {
|
||||||
@ -6957,7 +6955,7 @@
|
|||||||
return $.event('QRDialogCreation', null, dialog);
|
return $.event('QRDialogCreation', null, dialog);
|
||||||
},
|
},
|
||||||
submit: function(e) {
|
submit: function(e) {
|
||||||
var callbacks, challenge, err, filetag, m, opts, post, postData, response, textOnly, threadID, _ref, _ref1;
|
var callbacks, challenge, err, filetag, m, opts, post, postData, response, textOnly, threadID, _ref;
|
||||||
if (e != null) {
|
if (e != null) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
@ -6978,7 +6976,7 @@
|
|||||||
threadID = QR.nodes.thread.value;
|
threadID = QR.nodes.thread.value;
|
||||||
if (threadID === 'new') {
|
if (threadID === 'new') {
|
||||||
threadID = null;
|
threadID = null;
|
||||||
if (((_ref = g.BOARD.ID) === 'vg' || _ref === 'q') && !post.sub) {
|
if (['vg', 'q'].contains(g.BOARD.ID) && !post.sub) {
|
||||||
err = 'New threads require a subject.';
|
err = 'New threads require a subject.';
|
||||||
} else if (!(post.file || (textOnly = !!$('input[name=textonly]', $.id('postForm'))))) {
|
} else if (!(post.file || (textOnly = !!$('input[name=textonly]', $.id('postForm'))))) {
|
||||||
err = 'No file selected.';
|
err = 'No file selected.';
|
||||||
@ -6989,7 +6987,7 @@
|
|||||||
err = 'No file selected.';
|
err = 'No file selected.';
|
||||||
}
|
}
|
||||||
if (QR.captcha.isEnabled && !err) {
|
if (QR.captcha.isEnabled && !err) {
|
||||||
_ref1 = QR.captcha.getOne(), challenge = _ref1.challenge, response = _ref1.response;
|
_ref = QR.captcha.getOne(), challenge = _ref.challenge, response = _ref.response;
|
||||||
if (!response) {
|
if (!response) {
|
||||||
err = 'No valid captcha.';
|
err = 'No valid captcha.';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -570,12 +570,12 @@ Settings =
|
|||||||
for name in ['boardnav', 'time', 'backlink', 'fileInfo', 'favicon', 'usercss']
|
for name in ['boardnav', 'time', 'backlink', 'fileInfo', 'favicon', 'usercss']
|
||||||
input = $ "[name=#{name}]", section
|
input = $ "[name=#{name}]", section
|
||||||
input.value = $.get name, Conf[name]
|
input.value = $.get name, Conf[name]
|
||||||
event = if name in ['favicon', 'usercss']
|
event = if ['favicon', 'usercss'].contains name
|
||||||
'change'
|
'change'
|
||||||
else
|
else
|
||||||
'input'
|
'input'
|
||||||
$.on input, event, $.cb.value
|
$.on input, event, $.cb.value
|
||||||
unless name in ['usercss']
|
unless ['usercss'].contains name
|
||||||
$.on input, event, Settings[name]
|
$.on input, event, Settings[name]
|
||||||
Settings[name].call input
|
Settings[name].call input
|
||||||
$.on $.id('apply-css'), 'click', Settings.usercss
|
$.on $.id('apply-css'), 'click', Settings.usercss
|
||||||
@ -713,10 +713,10 @@ Filter =
|
|||||||
# and it's not specifically applicable to the current board.
|
# and it's not specifically applicable to the current board.
|
||||||
# Defaults to global.
|
# Defaults to global.
|
||||||
boards = filter.match(/boards:([^;]+)/)?[1].toLowerCase() or 'global'
|
boards = filter.match(/boards:([^;]+)/)?[1].toLowerCase() or 'global'
|
||||||
if boards isnt 'global' and not (g.BOARD.ID in boards.split ',')
|
if boards isnt 'global' and not (boards.split ',').contains g.BOARD.ID
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if key in ['uniqueID', 'MD5']
|
if ['uniqueID', 'MD5'].contains key
|
||||||
# MD5 filter will use strings instead of regular expressions.
|
# MD5 filter will use strings instead of regular expressions.
|
||||||
regexp = regexp[1]
|
regexp = regexp[1]
|
||||||
else
|
else
|
||||||
@ -915,7 +915,7 @@ Filter =
|
|||||||
{type} = @dataset
|
{type} = @dataset
|
||||||
# Convert value -> regexp, unless type is MD5
|
# Convert value -> regexp, unless type is MD5
|
||||||
value = Filter[type] Filter.menu.post
|
value = Filter[type] Filter.menu.post
|
||||||
re = if type in ['uniqueID', 'MD5'] then value else value.replace ///
|
re = if ['uniqueID', 'MD5'].contains type then value else value.replace ///
|
||||||
/
|
/
|
||||||
| \\
|
| \\
|
||||||
| \^
|
| \^
|
||||||
@ -941,7 +941,7 @@ Filter =
|
|||||||
"\\#{c}"
|
"\\#{c}"
|
||||||
|
|
||||||
re =
|
re =
|
||||||
if type in ['uniqueID', 'MD5']
|
if ['uniqueID', 'MD5'].contains type
|
||||||
"/#{re}/"
|
"/#{re}/"
|
||||||
else
|
else
|
||||||
"/^#{re}$/"
|
"/^#{re}$/"
|
||||||
@ -1341,7 +1341,7 @@ Recursive =
|
|||||||
apply: (recursive, post, args...) ->
|
apply: (recursive, post, args...) ->
|
||||||
{fullID} = post
|
{fullID} = post
|
||||||
for ID, post of g.posts
|
for ID, post of g.posts
|
||||||
if fullID in post.quotes
|
if post.quotes.contains fullID
|
||||||
recursive post, args...
|
recursive post, args...
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -1454,7 +1454,7 @@ DeleteLink =
|
|||||||
el: div
|
el: div
|
||||||
order: 40
|
order: 40
|
||||||
open: (post) ->
|
open: (post) ->
|
||||||
return false if post.isDead or !((thread = QR.yourPosts.threads[post.thread]) and post.ID in thread)
|
return false if post.isDead or !((thread = QR.yourPosts.threads[post.thread]) and thread.contains post.ID)
|
||||||
DeleteLink.post = post
|
DeleteLink.post = post
|
||||||
DeleteLink.cooldown.start post
|
DeleteLink.cooldown.start post
|
||||||
node = div.firstChild
|
node = div.firstChild
|
||||||
@ -1618,7 +1618,7 @@ Keybinds =
|
|||||||
keydown: (e) ->
|
keydown: (e) ->
|
||||||
return unless key = Keybinds.keyCode e
|
return unless key = Keybinds.keyCode e
|
||||||
{target} = e
|
{target} = e
|
||||||
if target.nodeName in ['INPUT', 'TEXTAREA']
|
if ['INPUT', 'TEXTAREA'].contains target.nodeName
|
||||||
return unless /(Esc|Alt|Ctrl|Meta)/.test key
|
return unless /(Esc|Alt|Ctrl|Meta)/.test key
|
||||||
|
|
||||||
threadRoot = Nav.getThread()
|
threadRoot = Nav.getThread()
|
||||||
@ -2234,7 +2234,7 @@ Get =
|
|||||||
# if it did quote this post,
|
# if it did quote this post,
|
||||||
# get all their backlinks.
|
# get all their backlinks.
|
||||||
for ID, quoterPost of g.posts
|
for ID, quoterPost of g.posts
|
||||||
if post.fullID in quoterPost.quotes
|
if quoterPost.quotes.contains post.fullID
|
||||||
for quoterPost in [quoterPost].concat quoterPost.clones
|
for quoterPost in [quoterPost].concat quoterPost.clones
|
||||||
quotelinks.push.apply quotelinks, quoterPost.nodes.quotelinks
|
quotelinks.push.apply quotelinks, quoterPost.nodes.quotelinks
|
||||||
# Second:
|
# Second:
|
||||||
@ -2285,7 +2285,7 @@ Get =
|
|||||||
return
|
return
|
||||||
|
|
||||||
{status} = req
|
{status} = req
|
||||||
if status not in [200, 304]
|
unless [200, 304].contains status
|
||||||
# The thread can die by the time we check a quote.
|
# The thread can die by the time we check a quote.
|
||||||
if url = Redirect.post board, postID
|
if url = Redirect.post board, postID
|
||||||
$.cache url, ->
|
$.cache url, ->
|
||||||
@ -2500,7 +2500,7 @@ Quotify =
|
|||||||
a.setAttribute 'data-board', board
|
a.setAttribute 'data-board', board
|
||||||
a.setAttribute 'data-postid', ID
|
a.setAttribute 'data-postid', ID
|
||||||
|
|
||||||
unless quoteID in @quotes
|
unless @quotes.contains quoteID
|
||||||
@quotes.push quoteID
|
@quotes.push quoteID
|
||||||
|
|
||||||
unless a
|
unless a
|
||||||
@ -2732,7 +2732,7 @@ QuoteYou =
|
|||||||
|
|
||||||
for quotelink in quotelinks
|
for quotelink in quotelinks
|
||||||
{threadID, postID} = Get.postDataFromLink quotelink
|
{threadID, postID} = Get.postDataFromLink quotelink
|
||||||
if (thread = QR.yourPosts.threads[threadID]) and postID in thread
|
if (thread = QR.yourPosts.threads[threadID]) and thread.contains postID
|
||||||
$.add quotelink, $.tn QuoteYou.text
|
$.add quotelink, $.tn QuoteYou.text
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -2753,13 +2753,13 @@ QuoteOP =
|
|||||||
{quotelinks} = @nodes
|
{quotelinks} = @nodes
|
||||||
|
|
||||||
# rm (OP) from cross-thread quotes.
|
# rm (OP) from cross-thread quotes.
|
||||||
if @isClone and @thread.fullID in quotes
|
if @isClone and quotes.contains @thread.fullID
|
||||||
for quotelink in quotelinks
|
for quotelink in quotelinks
|
||||||
quotelink.textContent = quotelink.textContent.replace QuoteOP.text, ''
|
quotelink.textContent = quotelink.textContent.replace QuoteOP.text, ''
|
||||||
|
|
||||||
op = (if @isClone then @context else @).thread.fullID
|
op = (if @isClone then @context else @).thread.fullID
|
||||||
# add (OP) to quotes quoting this context's OP.
|
# add (OP) to quotes quoting this context's OP.
|
||||||
return unless op in quotes
|
return unless quotes.contains op
|
||||||
for quotelink in quotelinks
|
for quotelink in quotelinks
|
||||||
{board, postID} = Get.postDataFromLink quotelink
|
{board, postID} = Get.postDataFromLink quotelink
|
||||||
if "#{board}.#{postID}" is op
|
if "#{board}.#{postID}" is op
|
||||||
@ -3243,7 +3243,7 @@ ImageExpand =
|
|||||||
label = $.el 'label',
|
label = $.el 'label',
|
||||||
innerHTML: "<input type=checkbox name='#{type}'> #{type}"
|
innerHTML: "<input type=checkbox name='#{type}'> #{type}"
|
||||||
input = label.firstElementChild
|
input = label.firstElementChild
|
||||||
if type in ['Fit width', 'Fit height']
|
if ['Fit width', 'Fit height'].contains type
|
||||||
$.on input, 'change', ImageExpand.cb.setFitness
|
$.on input, 'change', ImageExpand.cb.setFitness
|
||||||
if config
|
if config
|
||||||
label.title = config[1]
|
label.title = config[1]
|
||||||
@ -3270,7 +3270,7 @@ RevealSpoilers =
|
|||||||
|
|
||||||
AutoGIF =
|
AutoGIF =
|
||||||
init: ->
|
init: ->
|
||||||
return if g.VIEW is 'catalog' or !Conf['Auto-GIF'] or g.BOARD.ID in ['gif', 'wsg']
|
return if g.VIEW is 'catalog' or !Conf['Auto-GIF'] or ['gif', 'wsg'].contains g.BOARD.ID
|
||||||
|
|
||||||
Post::callbacks.push
|
Post::callbacks.push
|
||||||
name: 'Auto-GIF'
|
name: 'Auto-GIF'
|
||||||
@ -3368,7 +3368,7 @@ ExpandComment =
|
|||||||
post.nodes.comment = post.nodes.shortComment
|
post.nodes.comment = post.nodes.shortComment
|
||||||
parse: (req, a, post) ->
|
parse: (req, a, post) ->
|
||||||
{status} = req
|
{status} = req
|
||||||
if status not in [200, 304]
|
unless [200, 304].contains status
|
||||||
a.textContent = "Error #{req.statusText} (#{status})"
|
a.textContent = "Error #{req.statusText} (#{status})"
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -3468,7 +3468,7 @@ ExpandThread =
|
|||||||
parse: (req, thread, a) ->
|
parse: (req, thread, a) ->
|
||||||
return if a.textContent[0] is '+'
|
return if a.textContent[0] is '+'
|
||||||
{status} = req
|
{status} = req
|
||||||
if status not in [200, 304]
|
if [200, 304].contains status
|
||||||
a.textContent = "Error #{req.statusText} (#{status})"
|
a.textContent = "Error #{req.statusText} (#{status})"
|
||||||
$.off a, 'click', ExpandThread.cb.toggle
|
$.off a, 'click', ExpandThread.cb.toggle
|
||||||
return
|
return
|
||||||
@ -3549,13 +3549,13 @@ Unread =
|
|||||||
youInThisThread = yourPosts.threads[Unread.thread]
|
youInThisThread = yourPosts.threads[Unread.thread]
|
||||||
for post in newPosts
|
for post in newPosts
|
||||||
{ID} = post
|
{ID} = post
|
||||||
if ID <= Unread.lastReadPost or post.isHidden or youInThisThread and ID in youInThisThread
|
if ID <= Unread.lastReadPost or post.isHidden or youInThisThread and youInThisThread.contains ID
|
||||||
continue
|
continue
|
||||||
Unread.posts.push post
|
Unread.posts.push post
|
||||||
Unread.addPostQuotingYou post, yourPosts if yourPosts
|
Unread.addPostQuotingYou post, yourPosts if yourPosts
|
||||||
if Conf['Unread Line']
|
if Conf['Unread Line']
|
||||||
# Force line on visible threads if there were no unread posts previously.
|
# Force line on visible threads if there were no unread posts previously.
|
||||||
Unread.setLine Unread.posts[0] in newPosts
|
Unread.setLine newPosts.contains Unread.posts[0]
|
||||||
Unread.read()
|
Unread.read()
|
||||||
Unread.update()
|
Unread.update()
|
||||||
|
|
||||||
@ -3564,7 +3564,7 @@ Unread =
|
|||||||
[board, quoteID] = quote.split '.'
|
[board, quoteID] = quote.split '.'
|
||||||
continue unless board is Unread.thread.board.ID
|
continue unless board is Unread.thread.board.ID
|
||||||
for thread, postIDs of yourPosts.threads
|
for thread, postIDs of yourPosts.threads
|
||||||
if +quoteID in postIDs
|
if postIDs.contains +quoteID
|
||||||
Unread.postsQuotingYou.push post
|
Unread.postsQuotingYou.push post
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -3949,12 +3949,12 @@ ThreadUpdater =
|
|||||||
# giving us false-positive dead posts.
|
# giving us false-positive dead posts.
|
||||||
# continue if post.isDead
|
# continue if post.isDead
|
||||||
ID = +ID
|
ID = +ID
|
||||||
if post.isDead and ID in index
|
if post.isDead and index.contains ID
|
||||||
post.resurrect()
|
post.resurrect()
|
||||||
else unless ID in index
|
else unless index.contains ID
|
||||||
post.kill()
|
post.kill()
|
||||||
deletedPosts.push post
|
deletedPosts.push post
|
||||||
else if post.file and !post.file.isDead and ID not in files
|
else if post.file and !post.file.isDead and files.contains ID
|
||||||
post.kill true
|
post.kill true
|
||||||
deletedFiles.push post
|
deletedFiles.push post
|
||||||
|
|
||||||
|
|||||||
@ -329,7 +329,7 @@ QR =
|
|||||||
QR.selected.pasteText file
|
QR.selected.pasteText file
|
||||||
else if file.size > max
|
else if file.size > max
|
||||||
QR.error "File too large (file: #{$.bytesToString file.size}, max: #{$.bytesToString max})."
|
QR.error "File too large (file: #{$.bytesToString file.size}, max: #{$.bytesToString max})."
|
||||||
else unless file.type in QR.mimeTypes
|
else unless QR.mimeTypes.contains file.type
|
||||||
QR.error 'Unsupported file type.'
|
QR.error 'Unsupported file type.'
|
||||||
else
|
else
|
||||||
QR.selected.setFile file
|
QR.selected.setFile file
|
||||||
@ -342,7 +342,7 @@ QR =
|
|||||||
post.pasteText file
|
post.pasteText file
|
||||||
else if file.size > max
|
else if file.size > max
|
||||||
QR.error "#{file.name}: File too large (file: #{$.bytesToString file.size}, max: #{$.bytesToString max})."
|
QR.error "#{file.name}: File too large (file: #{$.bytesToString file.size}, max: #{$.bytesToString max})."
|
||||||
else unless file.type in QR.mimeTypes
|
else unless QR.mimeTypes.contains file.type
|
||||||
QR.error "#{file.name}: Unsupported file type."
|
QR.error "#{file.name}: Unsupported file type."
|
||||||
else
|
else
|
||||||
if (post = QR.posts[QR.posts.length - 1]).file
|
if (post = QR.posts[QR.posts.length - 1]).file
|
||||||
@ -823,7 +823,7 @@ QR =
|
|||||||
# prevent errors
|
# prevent errors
|
||||||
if threadID is 'new'
|
if threadID is 'new'
|
||||||
threadID = null
|
threadID = null
|
||||||
if g.BOARD.ID in ['vg', 'q'] and !post.sub
|
if ['vg', 'q'].contains(g.BOARD.ID) and !post.sub
|
||||||
err = 'New threads require a subject.'
|
err = 'New threads require a subject.'
|
||||||
else unless post.file or textOnly = !!$ 'input[name=textonly]', $.id 'postForm'
|
else unless post.file or textOnly = !!$ 'input[name=textonly]', $.id 'postForm'
|
||||||
err = 'No file selected.'
|
err = 'No file selected.'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user