Fix type and build
This commit is contained in:
parent
3470929e05
commit
56387a7162
@ -22,7 +22,7 @@
|
|||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 4chan X - Version 1.2.37 - 2013-09-12
|
* 4chan X - Version 1.2.37 - 2013-09-19
|
||||||
*
|
*
|
||||||
* Licensed under the MIT license.
|
* Licensed under the MIT license.
|
||||||
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
||||||
@ -241,7 +241,7 @@
|
|||||||
uniqueID: "# Filter a specific ID:\n#/Txhvk1Tl/",
|
uniqueID: "# Filter a specific ID:\n#/Txhvk1Tl/",
|
||||||
tripcode: "# Filter any tripfag\n#/^!/",
|
tripcode: "# Filter any tripfag\n#/^!/",
|
||||||
capcode: "# Set a custom class for mods:\n#/Mod$/;highlight:mod;op:yes\n# Set a custom class for moot:\n#/Admin$/;highlight:moot;op:yes",
|
capcode: "# Set a custom class for mods:\n#/Mod$/;highlight:mod;op:yes\n# Set a custom class for moot:\n#/Admin$/;highlight:moot;op:yes",
|
||||||
email: "# Filter any e-mails that are not `sage` on /a/ and /jp/:\n#/^(?!sage$)/;boards:a,jp",
|
email: "",
|
||||||
subject: "# Filter Generals on /v/:\n#/general/i;boards:v;op:only",
|
subject: "# Filter Generals on /v/:\n#/general/i;boards:v;op:only",
|
||||||
comment: "# Filter Stallman copypasta on /g/:\n#/what you\'re refer+ing to as linux/i;boards:g",
|
comment: "# Filter Stallman copypasta on /g/:\n#/what you\'re refer+ing to as linux/i;boards:g",
|
||||||
flag: '',
|
flag: '',
|
||||||
@ -956,7 +956,7 @@
|
|||||||
|
|
||||||
this.nodes.comment.normalize();
|
this.nodes.comment.normalize();
|
||||||
bq = this.nodes.comment.cloneNode(true);
|
bq = this.nodes.comment.cloneNode(true);
|
||||||
nodes = $$('.abbr, .capcodeReplies, .exif, b', bq);
|
nodes = $$('.abbr, .exif, b', bq);
|
||||||
i = 0;
|
i = 0;
|
||||||
while (node = nodes[i++]) {
|
while (node = nodes[i++]) {
|
||||||
$.rm(node);
|
$.rm(node);
|
||||||
@ -988,7 +988,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.nodes.quotelinks.push(quotelink);
|
this.nodes.quotelinks.push(quotelink);
|
||||||
if (this.isClone || !this.isReply && $.hasClass(quotelink.parentNode.parentNode, 'capcodeReplies')) {
|
if (this.isClone) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fullID = "" + match[1] + "." + match[2];
|
fullID = "" + match[1] + "." + match[2];
|
||||||
@ -1931,7 +1931,6 @@
|
|||||||
date: data.now,
|
date: data.now,
|
||||||
dateUTC: data.time,
|
dateUTC: data.time,
|
||||||
comment: data.com,
|
comment: data.com,
|
||||||
capcodeReplies: data.capcode_replies,
|
|
||||||
isSticky: !!data.sticky,
|
isSticky: !!data.sticky,
|
||||||
isClosed: !!data.closed
|
isClosed: !!data.closed
|
||||||
};
|
};
|
||||||
@ -1959,9 +1958,9 @@
|
|||||||
@license: https://github.com/4chan/4chan-JS/blob/master/LICENSE
|
@license: https://github.com/4chan/4chan-JS/blob/master/LICENSE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var a, boardID, capcode, capcodeClass, capcodeReplies, 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, boardID, capcode, capcodeClass, capcodeStart, closed, 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;
|
||||||
|
|
||||||
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, capcodeReplies = o.capcodeReplies, 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, file = o.file;
|
||||||
isOP = postID === threadID;
|
isOP = postID === threadID;
|
||||||
staticPath = '//static.4chan.org/image/';
|
staticPath = '//static.4chan.org/image/';
|
||||||
if (email) {
|
if (email) {
|
||||||
@ -2049,47 +2048,7 @@
|
|||||||
}
|
}
|
||||||
quote.href = "/" + boardID + "/res/" + href;
|
quote.href = "/" + boardID + "/res/" + href;
|
||||||
}
|
}
|
||||||
Build.capcodeReplies({
|
|
||||||
boardID: boardID,
|
|
||||||
threadID: threadID,
|
|
||||||
root: container,
|
|
||||||
capcodeReplies: capcodeReplies
|
|
||||||
});
|
|
||||||
return container;
|
return container;
|
||||||
},
|
|
||||||
capcodeReplies: function(_arg) {
|
|
||||||
var array, boardID, bq, capcodeReplies, capcodeType, generateCapcodeReplies, html, root, threadID;
|
|
||||||
|
|
||||||
boardID = _arg.boardID, threadID = _arg.threadID, bq = _arg.bq, root = _arg.root, capcodeReplies = _arg.capcodeReplies;
|
|
||||||
if (!capcodeReplies) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
generateCapcodeReplies = function(capcodeType, array) {
|
|
||||||
return "<span class=smaller><span class=bold>" + ((function() {
|
|
||||||
switch (capcodeType) {
|
|
||||||
case 'admin':
|
|
||||||
return 'Administrator';
|
|
||||||
case 'mod':
|
|
||||||
return 'Moderator';
|
|
||||||
case 'developer':
|
|
||||||
return 'Developer';
|
|
||||||
}
|
|
||||||
})()) + " Repl" + (array.length > 1 ? 'ies' : 'y') + ":</span> " + (array.map(function(ID) {
|
|
||||||
return "<a href='/" + boardID + "/res/" + threadID + "#p" + ID + "' class=quotelink>>>" + ID + "</a>";
|
|
||||||
}).join(' ')) + "</span><br>";
|
|
||||||
};
|
|
||||||
html = [];
|
|
||||||
for (capcodeType in capcodeReplies) {
|
|
||||||
array = capcodeReplies[capcodeType];
|
|
||||||
html.push(generateCapcodeReplies(capcodeType, array));
|
|
||||||
}
|
|
||||||
bq || (bq = $('blockquote', root));
|
|
||||||
return $.add(bq, [
|
|
||||||
$.el('br'), $.el('br'), $.el('span', {
|
|
||||||
className: 'capcodeReplies',
|
|
||||||
innerHTML: html.join('')
|
|
||||||
})
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2825,12 +2784,8 @@
|
|||||||
delete this.nodes.tripcode;
|
delete this.nodes.tripcode;
|
||||||
}
|
}
|
||||||
if (this.info.email) {
|
if (this.info.email) {
|
||||||
if (/sage/i.test(this.info.email)) {
|
$.replace(email, name);
|
||||||
return email.href = 'mailto:sage';
|
return delete this.nodes.email;
|
||||||
} else {
|
|
||||||
$.replace(email, name);
|
|
||||||
return delete this.nodes.email;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -5308,36 +5263,30 @@
|
|||||||
},
|
},
|
||||||
cooldown: {
|
cooldown: {
|
||||||
init: function() {
|
init: function() {
|
||||||
var board;
|
var key, setTimers, type, _base,
|
||||||
|
_this = this;
|
||||||
|
|
||||||
if (!Conf['Cooldown']) {
|
if (!Conf['Cooldown']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
board = g.BOARD.ID;
|
setTimers = function(e) {
|
||||||
QR.cooldown.types = {
|
return QR.cooldown.types = e.detail;
|
||||||
thread: (function() {
|
|
||||||
switch (board) {
|
|
||||||
case 'q':
|
|
||||||
return 86400;
|
|
||||||
case 'b':
|
|
||||||
case 'soc':
|
|
||||||
case 'r9k':
|
|
||||||
return 600;
|
|
||||||
default:
|
|
||||||
return 300;
|
|
||||||
}
|
|
||||||
})(),
|
|
||||||
sage: board === 'q' ? 600 : 60,
|
|
||||||
file: board === 'q' ? 300 : 30,
|
|
||||||
post: board === 'q' ? 150 : 30
|
|
||||||
};
|
};
|
||||||
|
$.on(window, 'cooldown:timers', setTimers);
|
||||||
|
$.globalEval('window.dispatchEvent(new CustomEvent("cooldown:timers", {detail: cooldowns}))');
|
||||||
|
(_base = QR.cooldown).types || (_base.types = {});
|
||||||
|
$.off(window, 'cooldown:timers', setTimers);
|
||||||
|
for (type in QR.cooldown.types) {
|
||||||
|
QR.cooldown.types[type] = +QR.cooldown.types[type];
|
||||||
|
}
|
||||||
QR.cooldown.upSpd = 0;
|
QR.cooldown.upSpd = 0;
|
||||||
QR.cooldown.upSpdAccuracy = .5;
|
QR.cooldown.upSpdAccuracy = .5;
|
||||||
$.get("cooldown." + board, {}, function(item) {
|
key = "cooldown." + g.BOARD;
|
||||||
QR.cooldown.cooldowns = item["cooldown." + board];
|
$.get(key, {}, function(item) {
|
||||||
|
QR.cooldown.cooldowns = item[key];
|
||||||
return QR.cooldown.start();
|
return QR.cooldown.start();
|
||||||
});
|
});
|
||||||
return $.sync("cooldown." + board, QR.cooldown.sync);
|
return $.sync(key, QR.cooldown.sync);
|
||||||
},
|
},
|
||||||
start: function() {
|
start: function() {
|
||||||
if (!Conf['Cooldown']) {
|
if (!Conf['Cooldown']) {
|
||||||
@ -5358,12 +5307,12 @@
|
|||||||
return QR.cooldown.start();
|
return QR.cooldown.start();
|
||||||
},
|
},
|
||||||
set: function(data) {
|
set: function(data) {
|
||||||
var cooldown, delay, hasFile, isReply, isSage, post, req, start, type, upSpd;
|
var cooldown, delay, hasFile, isReply, post, req, start, threadID, upSpd;
|
||||||
|
|
||||||
if (!Conf['Cooldown']) {
|
if (!Conf['Cooldown']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
req = data.req, post = data.post, isReply = data.isReply, delay = data.delay;
|
req = data.req, post = data.post, isReply = data.isReply, threadID = data.threadID, delay = data.delay;
|
||||||
start = req ? req.uploadEndTime : Date.now();
|
start = req ? req.uploadEndTime : Date.now();
|
||||||
if (delay) {
|
if (delay) {
|
||||||
cooldown = {
|
cooldown = {
|
||||||
@ -5371,18 +5320,15 @@
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
if (post.file) {
|
if (post.file) {
|
||||||
upSpd = post.file.size / ((req.uploadEndTime - req.uploadStartTime) / $.SECOND);
|
upSpd = post.file.size / ((start - req.uploadStartTime) / $.SECOND);
|
||||||
QR.cooldown.upSpdAccuracy = ((upSpd > QR.cooldown.upSpd * .9) + QR.cooldown.upSpdAccuracy) / 2;
|
QR.cooldown.upSpdAccuracy = ((upSpd > QR.cooldown.upSpd * .9) + QR.cooldown.upSpdAccuracy) / 2;
|
||||||
QR.cooldown.upSpd = upSpd;
|
QR.cooldown.upSpd = upSpd;
|
||||||
}
|
}
|
||||||
isSage = /sage/i.test(post.email);
|
|
||||||
hasFile = !!post.file;
|
hasFile = !!post.file;
|
||||||
type = !isReply ? 'thread' : isSage ? 'sage' : hasFile ? 'file' : 'post';
|
|
||||||
cooldown = {
|
cooldown = {
|
||||||
isReply: isReply,
|
isReply: isReply,
|
||||||
isSage: isSage,
|
|
||||||
hasFile: hasFile,
|
hasFile: hasFile,
|
||||||
timeout: start + QR.cooldown.types[type] * $.SECOND
|
threadID: threadID
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
QR.cooldown.cooldowns[start] = cooldown;
|
QR.cooldown.cooldowns[start] = cooldown;
|
||||||
@ -5398,7 +5344,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
count: function() {
|
count: function() {
|
||||||
var cooldown, cooldowns, elapsed, hasFile, isReply, isSage, now, post, seconds, start, type, types, upSpd, upSpdAccuracy, update, _ref;
|
var cooldown, cooldowns, elapsed, hasFile, isReply, maxTimer, now, post, seconds, start, type, types, upSpd, upSpdAccuracy, update, _ref;
|
||||||
|
|
||||||
if (!Object.keys(QR.cooldown.cooldowns).length) {
|
if (!Object.keys(QR.cooldown.cooldowns).length) {
|
||||||
$["delete"]("" + g.BOARD + ".cooldown");
|
$["delete"]("" + g.BOARD + ".cooldown");
|
||||||
@ -5407,11 +5353,11 @@
|
|||||||
QR.status();
|
QR.status();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setTimeout(QR.cooldown.count, $.SECOND);
|
clearTimeout(QR.cooldown.timeout);
|
||||||
|
QR.cooldown.timeout = setTimeout(QR.cooldown.count, $.SECOND);
|
||||||
now = Date.now();
|
now = Date.now();
|
||||||
post = QR.posts[0];
|
post = QR.posts[0];
|
||||||
isReply = post.thread !== 'new';
|
isReply = post.thread !== 'new';
|
||||||
isSage = /sage/i.test(post.email);
|
|
||||||
hasFile = !!post.file;
|
hasFile = !!post.file;
|
||||||
seconds = null;
|
seconds = null;
|
||||||
_ref = QR.cooldown, types = _ref.types, cooldowns = _ref.cooldowns, upSpd = _ref.upSpd, upSpdAccuracy = _ref.upSpdAccuracy;
|
_ref = QR.cooldown, types = _ref.types, cooldowns = _ref.cooldowns, upSpd = _ref.upSpd, upSpdAccuracy = _ref.upSpdAccuracy;
|
||||||
@ -5426,20 +5372,29 @@
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (isReply === cooldown.isReply) {
|
if ('timeout' in cooldown) {
|
||||||
type = !isReply ? 'thread' : isSage && cooldown.isSage ? 'sage' : hasFile && cooldown.hasFile ? 'file' : 'post';
|
|
||||||
elapsed = Math.floor((now - start) / $.SECOND);
|
|
||||||
if (elapsed >= 0) {
|
|
||||||
seconds = Math.max(seconds, types[type] - elapsed);
|
|
||||||
if (Conf['Cooldown Prediction'] && hasFile && upSpd) {
|
|
||||||
seconds -= Math.floor(post.file.size / upSpd * upSpdAccuracy);
|
|
||||||
seconds = Math.max(seconds, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!((start <= now && now <= cooldown.timeout))) {
|
|
||||||
QR.cooldown.unset(start);
|
QR.cooldown.unset(start);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
if (isReply === cooldown.isReply) {
|
||||||
|
elapsed = Math.floor((now - start) / $.SECOND);
|
||||||
|
if (elapsed < 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
type = !isReply ? 'thread' : hasFile ? 'image' : 'reply';
|
||||||
|
maxTimer = Math.max(types[type] || 0, types[type + '_intra'] || 0);
|
||||||
|
if (!((start <= now && now <= start + maxTimer * $.SECOND))) {
|
||||||
|
QR.cooldown.unset(start);
|
||||||
|
}
|
||||||
|
if (isReply && +post.thread === cooldown.threadID) {
|
||||||
|
type += '_intra';
|
||||||
|
}
|
||||||
|
seconds = Math.max(seconds, types[type] - elapsed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (seconds && Conf['Cooldown Prediction'] && hasFile && upSpd) {
|
||||||
|
seconds -= Math.floor(post.file.size / upSpd * upSpdAccuracy);
|
||||||
|
seconds = Math.max(seconds, 0);
|
||||||
}
|
}
|
||||||
update = seconds !== null || !!QR.cooldown.seconds;
|
update = seconds !== null || !!QR.cooldown.seconds;
|
||||||
QR.cooldown.seconds = seconds;
|
QR.cooldown.seconds = seconds;
|
||||||
@ -6269,7 +6224,7 @@
|
|||||||
thread = g.BOARD.threads[threadID];
|
thread = g.BOARD.threads[threadID];
|
||||||
if (threadID === 'new') {
|
if (threadID === 'new') {
|
||||||
threadID = null;
|
threadID = null;
|
||||||
if (['vg', 'q'].contains(g.BOARD.ID) && !post.sub) {
|
if (g.BOARD.ID === 'vg' && !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.';
|
||||||
@ -6448,7 +6403,8 @@
|
|||||||
QR.cooldown.set({
|
QR.cooldown.set({
|
||||||
req: req,
|
req: req,
|
||||||
post: post,
|
post: post,
|
||||||
isReply: isReply
|
isReply: isReply,
|
||||||
|
threadID: threadID
|
||||||
});
|
});
|
||||||
URL = threadID === postID ? "/" + g.BOARD + "/res/" + threadID : g.VIEW === 'index' && !QR.cooldown.auto && Conf['Open Post in New Tab'] ? "/" + g.BOARD + "/res/" + threadID + "#p" + postID : void 0;
|
URL = threadID === postID ? "/" + g.BOARD + "/res/" + threadID : g.VIEW === 'index' && !QR.cooldown.auto && Conf['Open Post in New Tab'] ? "/" + g.BOARD + "/res/" + threadID + "#p" + postID : void 0;
|
||||||
if (URL) {
|
if (URL) {
|
||||||
@ -7462,7 +7418,7 @@
|
|||||||
open: function(post) {
|
open: function(post) {
|
||||||
var node;
|
var node;
|
||||||
|
|
||||||
if (post.isDead || post.board.ID === 'q') {
|
if (post.isDead) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
DeleteLink.post = post;
|
DeleteLink.post = post;
|
||||||
@ -9697,12 +9653,6 @@
|
|||||||
}
|
}
|
||||||
quote.href = "/" + post.board + "/res/" + href;
|
quote.href = "/" + post.board + "/res/" + href;
|
||||||
}
|
}
|
||||||
Build.capcodeReplies({
|
|
||||||
boardID: post.board.ID,
|
|
||||||
threadID: post.thread.ID,
|
|
||||||
bq: clone,
|
|
||||||
capcodeReplies: postObj.capcode_replies
|
|
||||||
});
|
|
||||||
post.nodes.shortComment = comment;
|
post.nodes.shortComment = comment;
|
||||||
$.replace(comment, clone);
|
$.replace(comment, clone);
|
||||||
post.nodes.comment = post.nodes.longComment = clone;
|
post.nodes.comment = post.nodes.longComment = clone;
|
||||||
@ -9788,7 +9738,6 @@
|
|||||||
switch (g.BOARD.ID) {
|
switch (g.BOARD.ID) {
|
||||||
case 'b':
|
case 'b':
|
||||||
case 'vg':
|
case 'vg':
|
||||||
case 'q':
|
|
||||||
return 3;
|
return 3;
|
||||||
case 't':
|
case 't':
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// Generated by CoffeeScript
|
// Generated by CoffeeScript
|
||||||
/*
|
/*
|
||||||
* 4chan X - Version 1.2.37 - 2013-09-12
|
* 4chan X - Version 1.2.37 - 2013-09-19
|
||||||
*
|
*
|
||||||
* Licensed under the MIT license.
|
* Licensed under the MIT license.
|
||||||
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
||||||
@ -220,7 +220,7 @@
|
|||||||
uniqueID: "# Filter a specific ID:\n#/Txhvk1Tl/",
|
uniqueID: "# Filter a specific ID:\n#/Txhvk1Tl/",
|
||||||
tripcode: "# Filter any tripfag\n#/^!/",
|
tripcode: "# Filter any tripfag\n#/^!/",
|
||||||
capcode: "# Set a custom class for mods:\n#/Mod$/;highlight:mod;op:yes\n# Set a custom class for moot:\n#/Admin$/;highlight:moot;op:yes",
|
capcode: "# Set a custom class for mods:\n#/Mod$/;highlight:mod;op:yes\n# Set a custom class for moot:\n#/Admin$/;highlight:moot;op:yes",
|
||||||
email: "# Filter any e-mails that are not `sage` on /a/ and /jp/:\n#/^(?!sage$)/;boards:a,jp",
|
email: "",
|
||||||
subject: "# Filter Generals on /v/:\n#/general/i;boards:v;op:only",
|
subject: "# Filter Generals on /v/:\n#/general/i;boards:v;op:only",
|
||||||
comment: "# Filter Stallman copypasta on /g/:\n#/what you\'re refer+ing to as linux/i;boards:g",
|
comment: "# Filter Stallman copypasta on /g/:\n#/what you\'re refer+ing to as linux/i;boards:g",
|
||||||
flag: '',
|
flag: '',
|
||||||
@ -965,7 +965,7 @@
|
|||||||
|
|
||||||
this.nodes.comment.normalize();
|
this.nodes.comment.normalize();
|
||||||
bq = this.nodes.comment.cloneNode(true);
|
bq = this.nodes.comment.cloneNode(true);
|
||||||
nodes = $$('.abbr, .capcodeReplies, .exif, b', bq);
|
nodes = $$('.abbr, .exif, b', bq);
|
||||||
i = 0;
|
i = 0;
|
||||||
while (node = nodes[i++]) {
|
while (node = nodes[i++]) {
|
||||||
$.rm(node);
|
$.rm(node);
|
||||||
@ -997,7 +997,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.nodes.quotelinks.push(quotelink);
|
this.nodes.quotelinks.push(quotelink);
|
||||||
if (this.isClone || !this.isReply && $.hasClass(quotelink.parentNode.parentNode, 'capcodeReplies')) {
|
if (this.isClone) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fullID = "" + match[1] + "." + match[2];
|
fullID = "" + match[1] + "." + match[2];
|
||||||
@ -1945,7 +1945,6 @@
|
|||||||
date: data.now,
|
date: data.now,
|
||||||
dateUTC: data.time,
|
dateUTC: data.time,
|
||||||
comment: data.com,
|
comment: data.com,
|
||||||
capcodeReplies: data.capcode_replies,
|
|
||||||
isSticky: !!data.sticky,
|
isSticky: !!data.sticky,
|
||||||
isClosed: !!data.closed
|
isClosed: !!data.closed
|
||||||
};
|
};
|
||||||
@ -1973,9 +1972,9 @@
|
|||||||
@license: https://github.com/4chan/4chan-JS/blob/master/LICENSE
|
@license: https://github.com/4chan/4chan-JS/blob/master/LICENSE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var a, boardID, capcode, capcodeClass, capcodeReplies, 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, boardID, capcode, capcodeClass, capcodeStart, closed, 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;
|
||||||
|
|
||||||
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, capcodeReplies = o.capcodeReplies, 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, file = o.file;
|
||||||
isOP = postID === threadID;
|
isOP = postID === threadID;
|
||||||
staticPath = '//static.4chan.org/image/';
|
staticPath = '//static.4chan.org/image/';
|
||||||
if (email) {
|
if (email) {
|
||||||
@ -2063,47 +2062,7 @@
|
|||||||
}
|
}
|
||||||
quote.href = "/" + boardID + "/res/" + href;
|
quote.href = "/" + boardID + "/res/" + href;
|
||||||
}
|
}
|
||||||
Build.capcodeReplies({
|
|
||||||
boardID: boardID,
|
|
||||||
threadID: threadID,
|
|
||||||
root: container,
|
|
||||||
capcodeReplies: capcodeReplies
|
|
||||||
});
|
|
||||||
return container;
|
return container;
|
||||||
},
|
|
||||||
capcodeReplies: function(_arg) {
|
|
||||||
var array, boardID, bq, capcodeReplies, capcodeType, generateCapcodeReplies, html, root, threadID;
|
|
||||||
|
|
||||||
boardID = _arg.boardID, threadID = _arg.threadID, bq = _arg.bq, root = _arg.root, capcodeReplies = _arg.capcodeReplies;
|
|
||||||
if (!capcodeReplies) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
generateCapcodeReplies = function(capcodeType, array) {
|
|
||||||
return "<span class=smaller><span class=bold>" + ((function() {
|
|
||||||
switch (capcodeType) {
|
|
||||||
case 'admin':
|
|
||||||
return 'Administrator';
|
|
||||||
case 'mod':
|
|
||||||
return 'Moderator';
|
|
||||||
case 'developer':
|
|
||||||
return 'Developer';
|
|
||||||
}
|
|
||||||
})()) + " Repl" + (array.length > 1 ? 'ies' : 'y') + ":</span> " + (array.map(function(ID) {
|
|
||||||
return "<a href='/" + boardID + "/res/" + threadID + "#p" + ID + "' class=quotelink>>>" + ID + "</a>";
|
|
||||||
}).join(' ')) + "</span><br>";
|
|
||||||
};
|
|
||||||
html = [];
|
|
||||||
for (capcodeType in capcodeReplies) {
|
|
||||||
array = capcodeReplies[capcodeType];
|
|
||||||
html.push(generateCapcodeReplies(capcodeType, array));
|
|
||||||
}
|
|
||||||
bq || (bq = $('blockquote', root));
|
|
||||||
return $.add(bq, [
|
|
||||||
$.el('br'), $.el('br'), $.el('span', {
|
|
||||||
className: 'capcodeReplies',
|
|
||||||
innerHTML: html.join('')
|
|
||||||
})
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2832,12 +2791,8 @@
|
|||||||
delete this.nodes.tripcode;
|
delete this.nodes.tripcode;
|
||||||
}
|
}
|
||||||
if (this.info.email) {
|
if (this.info.email) {
|
||||||
if (/sage/i.test(this.info.email)) {
|
$.replace(email, name);
|
||||||
return email.href = 'mailto:sage';
|
return delete this.nodes.email;
|
||||||
} else {
|
|
||||||
$.replace(email, name);
|
|
||||||
return delete this.nodes.email;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -5318,36 +5273,30 @@
|
|||||||
},
|
},
|
||||||
cooldown: {
|
cooldown: {
|
||||||
init: function() {
|
init: function() {
|
||||||
var board;
|
var key, setTimers, type, _base,
|
||||||
|
_this = this;
|
||||||
|
|
||||||
if (!Conf['Cooldown']) {
|
if (!Conf['Cooldown']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
board = g.BOARD.ID;
|
setTimers = function(e) {
|
||||||
QR.cooldown.types = {
|
return QR.cooldown.types = e.detail;
|
||||||
thread: (function() {
|
|
||||||
switch (board) {
|
|
||||||
case 'q':
|
|
||||||
return 86400;
|
|
||||||
case 'b':
|
|
||||||
case 'soc':
|
|
||||||
case 'r9k':
|
|
||||||
return 600;
|
|
||||||
default:
|
|
||||||
return 300;
|
|
||||||
}
|
|
||||||
})(),
|
|
||||||
sage: board === 'q' ? 600 : 60,
|
|
||||||
file: board === 'q' ? 300 : 30,
|
|
||||||
post: board === 'q' ? 150 : 30
|
|
||||||
};
|
};
|
||||||
|
$.on(window, 'cooldown:timers', setTimers);
|
||||||
|
$.globalEval('window.dispatchEvent(new CustomEvent("cooldown:timers", {detail: cooldowns}))');
|
||||||
|
(_base = QR.cooldown).types || (_base.types = {});
|
||||||
|
$.off(window, 'cooldown:timers', setTimers);
|
||||||
|
for (type in QR.cooldown.types) {
|
||||||
|
QR.cooldown.types[type] = +QR.cooldown.types[type];
|
||||||
|
}
|
||||||
QR.cooldown.upSpd = 0;
|
QR.cooldown.upSpd = 0;
|
||||||
QR.cooldown.upSpdAccuracy = .5;
|
QR.cooldown.upSpdAccuracy = .5;
|
||||||
$.get("cooldown." + board, {}, function(item) {
|
key = "cooldown." + g.BOARD;
|
||||||
QR.cooldown.cooldowns = item["cooldown." + board];
|
$.get(key, {}, function(item) {
|
||||||
|
QR.cooldown.cooldowns = item[key];
|
||||||
return QR.cooldown.start();
|
return QR.cooldown.start();
|
||||||
});
|
});
|
||||||
return $.sync("cooldown." + board, QR.cooldown.sync);
|
return $.sync(key, QR.cooldown.sync);
|
||||||
},
|
},
|
||||||
start: function() {
|
start: function() {
|
||||||
if (!Conf['Cooldown']) {
|
if (!Conf['Cooldown']) {
|
||||||
@ -5368,12 +5317,12 @@
|
|||||||
return QR.cooldown.start();
|
return QR.cooldown.start();
|
||||||
},
|
},
|
||||||
set: function(data) {
|
set: function(data) {
|
||||||
var cooldown, delay, hasFile, isReply, isSage, post, req, start, type, upSpd;
|
var cooldown, delay, hasFile, isReply, post, req, start, threadID, upSpd;
|
||||||
|
|
||||||
if (!Conf['Cooldown']) {
|
if (!Conf['Cooldown']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
req = data.req, post = data.post, isReply = data.isReply, delay = data.delay;
|
req = data.req, post = data.post, isReply = data.isReply, threadID = data.threadID, delay = data.delay;
|
||||||
start = req ? req.uploadEndTime : Date.now();
|
start = req ? req.uploadEndTime : Date.now();
|
||||||
if (delay) {
|
if (delay) {
|
||||||
cooldown = {
|
cooldown = {
|
||||||
@ -5381,18 +5330,15 @@
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
if (post.file) {
|
if (post.file) {
|
||||||
upSpd = post.file.size / ((req.uploadEndTime - req.uploadStartTime) / $.SECOND);
|
upSpd = post.file.size / ((start - req.uploadStartTime) / $.SECOND);
|
||||||
QR.cooldown.upSpdAccuracy = ((upSpd > QR.cooldown.upSpd * .9) + QR.cooldown.upSpdAccuracy) / 2;
|
QR.cooldown.upSpdAccuracy = ((upSpd > QR.cooldown.upSpd * .9) + QR.cooldown.upSpdAccuracy) / 2;
|
||||||
QR.cooldown.upSpd = upSpd;
|
QR.cooldown.upSpd = upSpd;
|
||||||
}
|
}
|
||||||
isSage = /sage/i.test(post.email);
|
|
||||||
hasFile = !!post.file;
|
hasFile = !!post.file;
|
||||||
type = !isReply ? 'thread' : isSage ? 'sage' : hasFile ? 'file' : 'post';
|
|
||||||
cooldown = {
|
cooldown = {
|
||||||
isReply: isReply,
|
isReply: isReply,
|
||||||
isSage: isSage,
|
|
||||||
hasFile: hasFile,
|
hasFile: hasFile,
|
||||||
timeout: start + QR.cooldown.types[type] * $.SECOND
|
threadID: threadID
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
QR.cooldown.cooldowns[start] = cooldown;
|
QR.cooldown.cooldowns[start] = cooldown;
|
||||||
@ -5408,7 +5354,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
count: function() {
|
count: function() {
|
||||||
var cooldown, cooldowns, elapsed, hasFile, isReply, isSage, now, post, seconds, start, type, types, upSpd, upSpdAccuracy, update, _ref;
|
var cooldown, cooldowns, elapsed, hasFile, isReply, maxTimer, now, post, seconds, start, type, types, upSpd, upSpdAccuracy, update, _ref;
|
||||||
|
|
||||||
if (!Object.keys(QR.cooldown.cooldowns).length) {
|
if (!Object.keys(QR.cooldown.cooldowns).length) {
|
||||||
$["delete"]("" + g.BOARD + ".cooldown");
|
$["delete"]("" + g.BOARD + ".cooldown");
|
||||||
@ -5417,11 +5363,11 @@
|
|||||||
QR.status();
|
QR.status();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setTimeout(QR.cooldown.count, $.SECOND);
|
clearTimeout(QR.cooldown.timeout);
|
||||||
|
QR.cooldown.timeout = setTimeout(QR.cooldown.count, $.SECOND);
|
||||||
now = Date.now();
|
now = Date.now();
|
||||||
post = QR.posts[0];
|
post = QR.posts[0];
|
||||||
isReply = post.thread !== 'new';
|
isReply = post.thread !== 'new';
|
||||||
isSage = /sage/i.test(post.email);
|
|
||||||
hasFile = !!post.file;
|
hasFile = !!post.file;
|
||||||
seconds = null;
|
seconds = null;
|
||||||
_ref = QR.cooldown, types = _ref.types, cooldowns = _ref.cooldowns, upSpd = _ref.upSpd, upSpdAccuracy = _ref.upSpdAccuracy;
|
_ref = QR.cooldown, types = _ref.types, cooldowns = _ref.cooldowns, upSpd = _ref.upSpd, upSpdAccuracy = _ref.upSpdAccuracy;
|
||||||
@ -5436,20 +5382,29 @@
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (isReply === cooldown.isReply) {
|
if ('timeout' in cooldown) {
|
||||||
type = !isReply ? 'thread' : isSage && cooldown.isSage ? 'sage' : hasFile && cooldown.hasFile ? 'file' : 'post';
|
|
||||||
elapsed = Math.floor((now - start) / $.SECOND);
|
|
||||||
if (elapsed >= 0) {
|
|
||||||
seconds = Math.max(seconds, types[type] - elapsed);
|
|
||||||
if (Conf['Cooldown Prediction'] && hasFile && upSpd) {
|
|
||||||
seconds -= Math.floor(post.file.size / upSpd * upSpdAccuracy);
|
|
||||||
seconds = Math.max(seconds, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!((start <= now && now <= cooldown.timeout))) {
|
|
||||||
QR.cooldown.unset(start);
|
QR.cooldown.unset(start);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
if (isReply === cooldown.isReply) {
|
||||||
|
elapsed = Math.floor((now - start) / $.SECOND);
|
||||||
|
if (elapsed < 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
type = !isReply ? 'thread' : hasFile ? 'image' : 'reply';
|
||||||
|
maxTimer = Math.max(types[type] || 0, types[type + '_intra'] || 0);
|
||||||
|
if (!((start <= now && now <= start + maxTimer * $.SECOND))) {
|
||||||
|
QR.cooldown.unset(start);
|
||||||
|
}
|
||||||
|
if (isReply && +post.thread === cooldown.threadID) {
|
||||||
|
type += '_intra';
|
||||||
|
}
|
||||||
|
seconds = Math.max(seconds, types[type] - elapsed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (seconds && Conf['Cooldown Prediction'] && hasFile && upSpd) {
|
||||||
|
seconds -= Math.floor(post.file.size / upSpd * upSpdAccuracy);
|
||||||
|
seconds = Math.max(seconds, 0);
|
||||||
}
|
}
|
||||||
update = seconds !== null || !!QR.cooldown.seconds;
|
update = seconds !== null || !!QR.cooldown.seconds;
|
||||||
QR.cooldown.seconds = seconds;
|
QR.cooldown.seconds = seconds;
|
||||||
@ -6254,7 +6209,7 @@
|
|||||||
thread = g.BOARD.threads[threadID];
|
thread = g.BOARD.threads[threadID];
|
||||||
if (threadID === 'new') {
|
if (threadID === 'new') {
|
||||||
threadID = null;
|
threadID = null;
|
||||||
if (['vg', 'q'].contains(g.BOARD.ID) && !post.sub) {
|
if (g.BOARD.ID === 'vg' && !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.';
|
||||||
@ -6433,7 +6388,8 @@
|
|||||||
QR.cooldown.set({
|
QR.cooldown.set({
|
||||||
req: req,
|
req: req,
|
||||||
post: post,
|
post: post,
|
||||||
isReply: isReply
|
isReply: isReply,
|
||||||
|
threadID: threadID
|
||||||
});
|
});
|
||||||
URL = threadID === postID ? "/" + g.BOARD + "/res/" + threadID : g.VIEW === 'index' && !QR.cooldown.auto && Conf['Open Post in New Tab'] ? "/" + g.BOARD + "/res/" + threadID + "#p" + postID : void 0;
|
URL = threadID === postID ? "/" + g.BOARD + "/res/" + threadID : g.VIEW === 'index' && !QR.cooldown.auto && Conf['Open Post in New Tab'] ? "/" + g.BOARD + "/res/" + threadID + "#p" + postID : void 0;
|
||||||
if (URL) {
|
if (URL) {
|
||||||
@ -7447,7 +7403,7 @@
|
|||||||
open: function(post) {
|
open: function(post) {
|
||||||
var node;
|
var node;
|
||||||
|
|
||||||
if (post.isDead || post.board.ID === 'q') {
|
if (post.isDead) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
DeleteLink.post = post;
|
DeleteLink.post = post;
|
||||||
@ -9688,12 +9644,6 @@
|
|||||||
}
|
}
|
||||||
quote.href = "/" + post.board + "/res/" + href;
|
quote.href = "/" + post.board + "/res/" + href;
|
||||||
}
|
}
|
||||||
Build.capcodeReplies({
|
|
||||||
boardID: post.board.ID,
|
|
||||||
threadID: post.thread.ID,
|
|
||||||
bq: clone,
|
|
||||||
capcodeReplies: postObj.capcode_replies
|
|
||||||
});
|
|
||||||
post.nodes.shortComment = comment;
|
post.nodes.shortComment = comment;
|
||||||
$.replace(comment, clone);
|
$.replace(comment, clone);
|
||||||
post.nodes.comment = post.nodes.longComment = clone;
|
post.nodes.comment = post.nodes.longComment = clone;
|
||||||
@ -9779,7 +9729,6 @@
|
|||||||
switch (g.BOARD.ID) {
|
switch (g.BOARD.ID) {
|
||||||
case 'b':
|
case 'b':
|
||||||
case 'vg':
|
case 'vg':
|
||||||
case 'q':
|
|
||||||
return 3;
|
return 3;
|
||||||
case 't':
|
case 't':
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@ -898,7 +898,7 @@ QR =
|
|||||||
form: 'form'
|
form: 'form'
|
||||||
dumpButton: '#dump-button'
|
dumpButton: '#dump-button'
|
||||||
name: '[data-name=name]'
|
name: '[data-name=name]'
|
||||||
email: '[data-'q'=email]'
|
email: '[data-name=email]'
|
||||||
sub: '[data-name=sub]'
|
sub: '[data-name=sub]'
|
||||||
com: '[data-name=com]'
|
com: '[data-name=com]'
|
||||||
dumpList: '#dump-list'
|
dumpList: '#dump-list'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user