diff --git a/Gruntfile.coffee b/Gruntfile.coffee
index 9dda11d9a..4d617dc6f 100644
--- a/Gruntfile.coffee
+++ b/Gruntfile.coffee
@@ -59,6 +59,7 @@ module.exports = (grunt) ->
files:
'builds/<%= pkg.name %>.meta.js': 'src/General/meta/metadata.js'
'builds/<%= pkg.name %>.user.js': [
+ 'src/General/meta/botproc.js'
'src/General/meta/metadata.js'
'src/General/meta/banner.js'
'src/General/meta/usestrict.js'
diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js
index db60047f5..44df79589 100644
--- a/builds/4chan-X.user.js
+++ b/builds/4chan-X.user.js
@@ -1,3 +1,4 @@
+// Generated by CoffeeScript
// ==UserScript==
// @name 4chan X
// @version 1.2.25
@@ -430,13 +431,12 @@
fd = new FormData();
for (key in form) {
val = form[key];
- if (!val) {
- continue;
- }
- if (val.size && val.name) {
- fd.append(key, val, val.name);
- } else {
- fd.append(key, val);
+ if (val) {
+ if (val.size && val.name) {
+ fd.append(key, val, val.name);
+ } else {
+ fd.append(key, val);
+ }
}
}
return fd;
@@ -1080,7 +1080,7 @@
_ref1 = Get.allQuotelinksLinkingTo(this);
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
quotelink = _ref1[_j];
- if ($.hasClass(quotelink, 'deadlink')) {
+ if (!(!$.hasClass(quotelink, 'deadlink'))) {
continue;
}
$.add(quotelink, $.tn('\u00A0(Dead)'));
@@ -1844,6 +1844,7 @@
date: data.now,
dateUTC: data.time,
comment: data.com,
+ capReps: data.capcode_replies,
isSticky: !!data.sticky,
isClosed: !!data.closed
};
@@ -1871,9 +1872,9 @@
@license: https://github.com/4chan/4chan-JS/blob/master/LICENSE
*/
- var a, boardID, capcode, capcodeClass, capcodeStart, closed, comment, container, date, dateUTC, email, emailEnd, emailStart, ext, file, fileDims, fileHTML, fileInfo, fileSize, fileThumb, filename, flag, flagCode, flagName, href, imgSrc, isClosed, isOP, isSticky, name, postID, quote, shortFilename, spoilerRange, staticPath, sticky, subject, threadID, tripcode, uniqueID, userID, _i, _len, _ref;
+ var a, array, boardID, capReps, capcode, capcodeClass, capcodeReplies, capcodeStart, capcodeType, closed, comment, container, date, dateUTC, email, emailEnd, emailStart, ext, file, fileDims, fileHTML, fileInfo, fileSize, fileThumb, filename, flag, flagCode, flagName, generateCapcodeReplies, href, imgSrc, isClosed, isOP, isSticky, name, postID, quote, shortFilename, spoilerRange, staticPath, sticky, subject, threadID, tripcode, uniqueID, userID, _i, _len, _ref;
- postID = o.postID, threadID = o.threadID, boardID = o.boardID, name = o.name, capcode = o.capcode, tripcode = o.tripcode, uniqueID = o.uniqueID, email = o.email, subject = o.subject, flagCode = o.flagCode, flagName = o.flagName, date = o.date, dateUTC = o.dateUTC, isSticky = o.isSticky, isClosed = o.isClosed, comment = o.comment, file = o.file;
+ postID = o.postID, threadID = o.threadID, boardID = o.boardID, name = o.name, capcode = o.capcode, tripcode = o.tripcode, uniqueID = o.uniqueID, email = o.email, subject = o.subject, flagCode = o.flagCode, flagName = o.flagName, date = o.date, dateUTC = o.dateUTC, isSticky = o.isSticky, isClosed = o.isClosed, comment = o.comment, capReps = o.capReps, file = o.file;
isOP = postID === threadID;
staticPath = '//static.4chan.org/image/';
if (email) {
@@ -1947,10 +1948,32 @@
tripcode = tripcode ? " " + tripcode + " " : '';
sticky = isSticky ? " " : '';
closed = isClosed ? " " : '';
+ capcodeReplies = '';
+ if (capReps) {
+ generateCapcodeReplies = function(capcodeType, array) {
+ return "" + ((function() {
+ switch (capcodeType) {
+ case 'admin':
+ return 'Administrator';
+ case 'mod':
+ return 'Moderator';
+ case 'developer':
+ return 'Developer';
+ }
+ })()) + " Repl" + (array.length > 1 ? 'ies' : 'y') + ": " + (array.map(function(ID) {
+ return ">>" + ID + " ";
+ }).join(' ')) + " ";
+ };
+ for (capcodeType in capReps) {
+ array = capReps[capcodeType];
+ capcodeReplies += generateCapcodeReplies(capcodeType, array);
+ }
+ capcodeReplies = "" + capcodeReplies + " ";
+ }
container = $.el('div', {
id: "pc" + postID,
className: "postContainer " + (isOP ? 'op' : 'reply') + "Container",
- innerHTML: (isOP ? '' : "
>>
") + ("") + ("
") + ("
") + ("" + (name || '') + " ") + tripcode + capcodeStart + capcode + userID + flag + sticky + closed + (" " + subject) + (" " + date) + ("No. ") + ("" + postID + " ") + ' ' + '
' + (isOP ? fileHTML : '') + ("
") + ("
") + ("" + subject + " ") + ("
") + emailStart + ("" + (name || '') + " ") + tripcode + capcodeStart + emailEnd + capcode + userID + flag + sticky + closed + ' ' + ("
" + date + " ") + "
" + ("No. ") + ("" + postID + " ") + ' ' + '
' + (isOP ? '' : fileHTML) + ("
" + (comment || '') + " ") + '
'
+ innerHTML: (isOP ? '' : ">>
") + ("") + ("
") + ("
") + ("" + (name || '') + " ") + tripcode + capcodeStart + capcode + userID + flag + sticky + closed + (" " + subject) + (" " + date) + ("No. ") + ("" + postID + " ") + ' ' + '
' + (isOP ? fileHTML : '') + ("
") + ("
") + ("" + subject + " ") + ("
") + emailStart + ("" + (name || '') + " ") + tripcode + capcodeStart + emailEnd + capcode + userID + flag + sticky + closed + ' ' + ("
" + date + " ") + "
" + ("No. ") + ("" + postID + " ") + ' ' + '
' + (isOP ? '' : fileHTML) + ("
" + (comment || '') + capcodeReplies + " ") + '
'
});
_ref = $$('.quotelink', container);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
@@ -4996,12 +5019,11 @@
list = $("#list-" + type, QR.nodes.el);
for (_i = 0, _len = arr.length; _i < _len; _i++) {
val = arr[_i];
- if (!val) {
- continue;
+ if (val) {
+ $.add(list, $.el('option', {
+ textContent: val
+ }));
}
- $.add(list, $.el('option', {
- textContent: val
- }));
}
},
getPassword: function() {
@@ -9908,14 +9930,13 @@
_ref = Config.hotkeys;
for (key in _ref) {
val = _ref[key];
- if (!(key in data.Conf)) {
- continue;
+ if (key in data.Conf) {
+ data.Conf[key] = data.Conf[key].replace(/ctrl|alt|meta/g, function(s) {
+ return "" + (s[0].toUpperCase()) + s.slice(1);
+ }).replace(/(^|.+\+)[A-Z]$/g, function(s) {
+ return "Shift+" + s.slice(0, -1) + (s.slice(-1).toLowerCase());
+ });
}
- data.Conf[key] = data.Conf[key].replace(/ctrl|alt|meta/g, function(s) {
- return "" + (s[0].toUpperCase()) + s.slice(1);
- }).replace(/(^|.+\+)[A-Z]$/g, function(s) {
- return "Shift+" + s.slice(0, -1) + (s.slice(-1).toLowerCase());
- });
}
data.Conf.WatchedThreads = data.WatchedThreads;
} else if (version[0] === '3') {
diff --git a/builds/crx/script.js b/builds/crx/script.js
index aee40189e..ddab4bd0b 100644
--- a/builds/crx/script.js
+++ b/builds/crx/script.js
@@ -411,13 +411,12 @@
fd = new FormData();
for (key in form) {
val = form[key];
- if (!val) {
- continue;
- }
- if (val.size && val.name) {
- fd.append(key, val, val.name);
- } else {
- fd.append(key, val);
+ if (val) {
+ if (val.size && val.name) {
+ fd.append(key, val, val.name);
+ } else {
+ fd.append(key, val);
+ }
}
}
return fd;
@@ -1092,7 +1091,7 @@
_ref1 = Get.allQuotelinksLinkingTo(this);
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
quotelink = _ref1[_j];
- if ($.hasClass(quotelink, 'deadlink')) {
+ if (!(!$.hasClass(quotelink, 'deadlink'))) {
continue;
}
$.add(quotelink, $.tn('\u00A0(Dead)'));
@@ -1856,6 +1855,7 @@
date: data.now,
dateUTC: data.time,
comment: data.com,
+ capReps: data.capcode_replies,
isSticky: !!data.sticky,
isClosed: !!data.closed
};
@@ -1883,9 +1883,9 @@
@license: https://github.com/4chan/4chan-JS/blob/master/LICENSE
*/
- var a, boardID, capcode, capcodeClass, capcodeStart, closed, comment, container, date, dateUTC, email, emailEnd, emailStart, ext, file, fileDims, fileHTML, fileInfo, fileSize, fileThumb, filename, flag, flagCode, flagName, href, imgSrc, isClosed, isOP, isSticky, name, postID, quote, shortFilename, spoilerRange, staticPath, sticky, subject, threadID, tripcode, uniqueID, userID, _i, _len, _ref;
+ var a, array, boardID, capReps, capcode, capcodeClass, capcodeReplies, capcodeStart, capcodeType, closed, comment, container, date, dateUTC, email, emailEnd, emailStart, ext, file, fileDims, fileHTML, fileInfo, fileSize, fileThumb, filename, flag, flagCode, flagName, generateCapcodeReplies, href, imgSrc, isClosed, isOP, isSticky, name, postID, quote, shortFilename, spoilerRange, staticPath, sticky, subject, threadID, tripcode, uniqueID, userID, _i, _len, _ref;
- postID = o.postID, threadID = o.threadID, boardID = o.boardID, name = o.name, capcode = o.capcode, tripcode = o.tripcode, uniqueID = o.uniqueID, email = o.email, subject = o.subject, flagCode = o.flagCode, flagName = o.flagName, date = o.date, dateUTC = o.dateUTC, isSticky = o.isSticky, isClosed = o.isClosed, comment = o.comment, file = o.file;
+ postID = o.postID, threadID = o.threadID, boardID = o.boardID, name = o.name, capcode = o.capcode, tripcode = o.tripcode, uniqueID = o.uniqueID, email = o.email, subject = o.subject, flagCode = o.flagCode, flagName = o.flagName, date = o.date, dateUTC = o.dateUTC, isSticky = o.isSticky, isClosed = o.isClosed, comment = o.comment, capReps = o.capReps, file = o.file;
isOP = postID === threadID;
staticPath = '//static.4chan.org/image/';
if (email) {
@@ -1959,10 +1959,32 @@
tripcode = tripcode ? " " + tripcode + " " : '';
sticky = isSticky ? " " : '';
closed = isClosed ? " " : '';
+ capcodeReplies = '';
+ if (capReps) {
+ generateCapcodeReplies = function(capcodeType, array) {
+ return "" + ((function() {
+ switch (capcodeType) {
+ case 'admin':
+ return 'Administrator';
+ case 'mod':
+ return 'Moderator';
+ case 'developer':
+ return 'Developer';
+ }
+ })()) + " Repl" + (array.length > 1 ? 'ies' : 'y') + ": " + (array.map(function(ID) {
+ return ">>" + ID + " ";
+ }).join(' ')) + " ";
+ };
+ for (capcodeType in capReps) {
+ array = capReps[capcodeType];
+ capcodeReplies += generateCapcodeReplies(capcodeType, array);
+ }
+ capcodeReplies = "" + capcodeReplies + " ";
+ }
container = $.el('div', {
id: "pc" + postID,
className: "postContainer " + (isOP ? 'op' : 'reply') + "Container",
- innerHTML: (isOP ? '' : ">>
") + ("") + ("
") + ("
") + ("" + (name || '') + " ") + tripcode + capcodeStart + capcode + userID + flag + sticky + closed + (" " + subject) + (" " + date) + ("No. ") + ("" + postID + " ") + ' ' + '
' + (isOP ? fileHTML : '') + ("
") + ("
") + ("" + subject + " ") + ("
") + emailStart + ("" + (name || '') + " ") + tripcode + capcodeStart + emailEnd + capcode + userID + flag + sticky + closed + ' ' + ("
" + date + " ") + "
" + ("No. ") + ("" + postID + " ") + ' ' + '
' + (isOP ? '' : fileHTML) + ("
" + (comment || '') + " ") + '
'
+ innerHTML: (isOP ? '' : ">>
") + ("") + ("
") + ("
") + ("" + (name || '') + " ") + tripcode + capcodeStart + capcode + userID + flag + sticky + closed + (" " + subject) + (" " + date) + ("No. ") + ("" + postID + " ") + ' ' + '
' + (isOP ? fileHTML : '') + ("
") + ("
") + ("" + subject + " ") + ("
") + emailStart + ("" + (name || '') + " ") + tripcode + capcodeStart + emailEnd + capcode + userID + flag + sticky + closed + ' ' + ("
" + date + " ") + "
" + ("No. ") + ("" + postID + " ") + ' ' + '
' + (isOP ? '' : fileHTML) + ("
" + (comment || '') + capcodeReplies + " ") + '
'
});
_ref = $$('.quotelink', container);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
@@ -5002,12 +5024,11 @@
list = $("#list-" + type, QR.nodes.el);
for (_i = 0, _len = arr.length; _i < _len; _i++) {
val = arr[_i];
- if (!val) {
- continue;
+ if (val) {
+ $.add(list, $.el('option', {
+ textContent: val
+ }));
}
- $.add(list, $.el('option', {
- textContent: val
- }));
}
},
getPassword: function() {
@@ -9892,14 +9913,13 @@
_ref = Config.hotkeys;
for (key in _ref) {
val = _ref[key];
- if (!(key in data.Conf)) {
- continue;
+ if (key in data.Conf) {
+ data.Conf[key] = data.Conf[key].replace(/ctrl|alt|meta/g, function(s) {
+ return "" + (s[0].toUpperCase()) + s.slice(1);
+ }).replace(/(^|.+\+)[A-Z]$/g, function(s) {
+ return "Shift+" + s.slice(0, -1) + (s.slice(-1).toLowerCase());
+ });
}
- data.Conf[key] = data.Conf[key].replace(/ctrl|alt|meta/g, function(s) {
- return "" + (s[0].toUpperCase()) + s.slice(1);
- }).replace(/(^|.+\+)[A-Z]$/g, function(s) {
- return "Shift+" + s.slice(0, -1) + (s.slice(-1).toLowerCase());
- });
}
data.Conf.WatchedThreads = data.WatchedThreads;
} else if (version[0] === '3') {
diff --git a/src/General/Build.coffee b/src/General/Build.coffee
index 4f4453e6d..bb0903db1 100644
--- a/src/General/Build.coffee
+++ b/src/General/Build.coffee
@@ -27,6 +27,7 @@ Build =
date: data.now
dateUTC: data.time
comment: data.com
+ capReps: data.capcode_replies
# thread status
isSticky: !!data.sticky
isClosed: !!data.closed
@@ -58,7 +59,7 @@ Build =
postID, threadID, boardID
name, capcode, tripcode, uniqueID, email, subject, flagCode, flagName, date, dateUTC
isSticky, isClosed
- comment
+ comment, capReps
file
} = o
isOP = postID is threadID
@@ -176,22 +177,39 @@ Build =
else
fileHTML = ''
- tripcode =
- if tripcode
- " #{tripcode} "
- else
- ''
+ tripcode = if tripcode
+ " #{tripcode} "
+ else
+ ''
- sticky =
- if isSticky
- " "
- else
- ''
- closed =
- if isClosed
- " "
- else
- ''
+ sticky = if isSticky
+ " "
+ else
+ ''
+ closed = if isClosed
+ " "
+ else
+ ''
+
+ capcodeReplies = ''
+ if capReps
+ generateCapcodeReplies = (capcodeType, array) ->
+ "#{
+ switch capcodeType
+ when 'admin'
+ 'Administrator'
+ when 'mod'
+ 'Moderator'
+ when 'developer'
+ 'Developer'
+ } Repl#{if array.length > 1 then 'ies' else 'y'}: #{
+ array.map (ID) ->
+ ">>#{ID} "
+ .join ' '
+ } "
+ for capcodeType, array of capReps
+ capcodeReplies += generateCapcodeReplies capcodeType, array
+ capcodeReplies = "#{capcodeReplies} "
container = $.el 'div',
id: "pc#{postID}"
@@ -245,7 +263,7 @@ Build =
(if isOP then '' else fileHTML) +
- "#{comment or ''} " +
+ "#{comment or ''}#{capcodeReplies} " +
''
diff --git a/src/General/Settings.coffee b/src/General/Settings.coffee
index cc7b8790e..8af3c568f 100644
--- a/src/General/Settings.coffee
+++ b/src/General/Settings.coffee
@@ -262,8 +262,7 @@ Settings =
'%board'
else
c
- for key, val of Config.hotkeys
- continue unless key of data.Conf
+ for key, val of Config.hotkeys when key of data.Conf
data.Conf[key] = data.Conf[key].replace(/ctrl|alt|meta/g, (s) -> "#{s[0].toUpperCase()}#{s[1..]}").replace /(^|.+\+)[A-Z]$/g, (s) ->
"Shift+#{s[0...-1]}#{s[-1..].toLowerCase()}"
data.Conf.WatchedThreads = data.WatchedThreads
diff --git a/src/General/lib/$.coffee b/src/General/lib/$.coffee
index 8cf3f31b6..a9afda0bb 100644
--- a/src/General/lib/$.coffee
+++ b/src/General/lib/$.coffee
@@ -61,8 +61,7 @@ $.formData = (form) ->
if form instanceof HTMLFormElement
return new FormData form
fd = new FormData()
- for key, val of form
- continue unless val
+ for key, val of form when val
# XXX GM bug
# if val instanceof Blob
if val.size and val.name
diff --git a/src/General/lib/post.class b/src/General/lib/post.class
index 2b5c26aa4..02e9fb9a0 100644
--- a/src/General/lib/post.class
+++ b/src/General/lib/post.class
@@ -174,8 +174,7 @@ class Post
return if file
# Get quotelinks/backlinks to this post
# and paint them (Dead).
- for quotelink in Get.allQuotelinksLinkingTo @
- continue if $.hasClass quotelink, 'deadlink'
+ for quotelink in Get.allQuotelinksLinkingTo @ when not $.hasClass quotelink, 'deadlink'
$.add quotelink, $.tn '\u00A0(Dead)'
$.addClass quotelink, 'deadlink'
return
diff --git a/src/Posting/QuickReply.coffee b/src/Posting/QuickReply.coffee
index 1127ba29b..e923dddb0 100644
--- a/src/Posting/QuickReply.coffee
+++ b/src/Posting/QuickReply.coffee
@@ -213,9 +213,7 @@ QR =
loadPersonas: (type, arr) ->
list = $ "#list-#{type}", QR.nodes.el
- for val in arr
- # XXX Firefox displays empty s in the completion list.
- continue unless val
+ for val in arr when val
$.add list, $.el 'option',
textContent: val
return