diff --git a/CHANGELOG.md b/CHANGELOG.md index e9c652f2a..db7433a73 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,3 @@ - **MayhemYDG**: - Tiny posting cooldown adjustment: - You can post an image reply immediately after a non-image reply. @@ -37,6 +36,8 @@ - Navigating across index pages is now instantaneous. - Added a keybind to open the catalog search field on index pages. +- Minor cooldown fix: + - You cannot post an image reply immediately after a non-image reply anymore. - Various minor fixes ### v1.2.43 diff --git a/LICENSE b/LICENSE index b14fa2a9d..caa85caeb 100755 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ /* -* 4chan X - Version 1.2.43 - 2013-11-23 +* 4chan X - Version 1.2.43 - 2013-11-26 * * Licensed under the MIT license. * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 30d36197b..0eb7de8e8 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -22,7 +22,7 @@ // ==/UserScript== /* -* 4chan X - Version 1.2.43 - 2013-11-23 +* 4chan X - Version 1.2.43 - 2013-11-26 * * Licensed under the MIT license. * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE @@ -2663,6 +2663,14 @@ return filename; } }, + thumbRotate: (function() { + var n; + + n = 0; + return function() { + return n = (n + 1) % 3; + }; + })(), postFromObject: function(data, boardID) { var o; @@ -2693,7 +2701,7 @@ width: data.w, MD5: data.md5, size: data.fsize, - turl: "//t.4cdn.org/" + boardID + "/thumb/" + data.tim + "s.jpg", + turl: "//" + (Build.thumbRotate()) + ".t.4cdn.org/" + boardID + "/thumb/" + data.tim + "s.jpg", theight: data.tn_h, twidth: data.tn_w, isSpoiler: !!data.spoiler, @@ -6197,7 +6205,7 @@ return QR.cooldown.start(); }, set: function(data) { - var cooldown, delay, hasFile, isReply, post, req, start, threadID, upSpd; + var cooldown, delay, isReply, post, req, start, threadID, upSpd; if (!Conf['Cooldown']) { return; @@ -6209,14 +6217,13 @@ delay: delay }; } else { - if (hasFile = !!post.file) { + if (post.file) { upSpd = post.file.size / ((start - req.uploadStartTime) / $.SECOND); QR.cooldown.upSpdAccuracy = ((upSpd > QR.cooldown.upSpd * .9) + QR.cooldown.upSpdAccuracy) / 2; QR.cooldown.upSpd = upSpd; } cooldown = { isReply: isReply, - hasFile: hasFile, threadID: threadID }; } @@ -6266,17 +6273,7 @@ if (elapsed < 0) { continue; } - if (!isReply) { - type = 'thread'; - } else if (hasFile) { - if (!cooldown.hasFile) { - seconds = Math.max(seconds, 0); - continue; - } - type = 'image'; - } else { - type = 'reply'; - } + 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); diff --git a/builds/crx/script.js b/builds/crx/script.js index ff87cc49c..4bd7d8622 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -1,6 +1,6 @@ // Generated by CoffeeScript /* -* 4chan X - Version 1.2.43 - 2013-11-23 +* 4chan X - Version 1.2.43 - 2013-11-26 * * Licensed under the MIT license. * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE @@ -2675,6 +2675,14 @@ return filename; } }, + thumbRotate: (function() { + var n; + + n = 0; + return function() { + return n = (n + 1) % 3; + }; + })(), postFromObject: function(data, boardID) { var o; @@ -2705,7 +2713,7 @@ width: data.w, MD5: data.md5, size: data.fsize, - turl: "//t.4cdn.org/" + boardID + "/thumb/" + data.tim + "s.jpg", + turl: "//" + (Build.thumbRotate()) + ".t.4cdn.org/" + boardID + "/thumb/" + data.tim + "s.jpg", theight: data.tn_h, twidth: data.tn_w, isSpoiler: !!data.spoiler, @@ -6207,7 +6215,7 @@ return QR.cooldown.start(); }, set: function(data) { - var cooldown, delay, hasFile, isReply, post, req, start, threadID, upSpd; + var cooldown, delay, isReply, post, req, start, threadID, upSpd; if (!Conf['Cooldown']) { return; @@ -6219,14 +6227,13 @@ delay: delay }; } else { - if (hasFile = !!post.file) { + if (post.file) { upSpd = post.file.size / ((start - req.uploadStartTime) / $.SECOND); QR.cooldown.upSpdAccuracy = ((upSpd > QR.cooldown.upSpd * .9) + QR.cooldown.upSpdAccuracy) / 2; QR.cooldown.upSpd = upSpd; } cooldown = { isReply: isReply, - hasFile: hasFile, threadID: threadID }; } @@ -6276,17 +6283,7 @@ if (elapsed < 0) { continue; } - if (!isReply) { - type = 'thread'; - } else if (hasFile) { - if (!cooldown.hasFile) { - seconds = Math.max(seconds, 0); - continue; - } - type = 'image'; - } else { - type = 'reply'; - } + 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); diff --git a/src/General/Build.coffee b/src/General/Build.coffee index ef41ce7da..900b5b0dc 100755 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -9,6 +9,9 @@ Build = "#{filename[...threshold - 5]}(...).#{filename[-3..]}" else filename + thumbRotate: do -> + n = 0 + -> n = (n + 1) % 3 postFromObject: (data, boardID) -> o = # id @@ -43,7 +46,7 @@ Build = width: data.w MD5: data.md5 size: data.fsize - turl: "//t.4cdn.org/#{boardID}/thumb/#{data.tim}s.jpg" + turl: "//#{Build.thumbRotate()}.t.4cdn.org/#{boardID}/thumb/#{data.tim}s.jpg" theight: data.tn_h twidth: data.tn_w isSpoiler: !!data.spoiler diff --git a/src/Posting/QuickReply.coffee b/src/Posting/QuickReply.coffee index a1675fb5e..92e09f9ff 100755 --- a/src/Posting/QuickReply.coffee +++ b/src/Posting/QuickReply.coffee @@ -312,11 +312,11 @@ QR = if delay cooldown = {delay} else - if hasFile = !!post.file + if post.file upSpd = post.file.size / ((start - req.uploadStartTime) / $.SECOND) QR.cooldown.upSpdAccuracy = ((upSpd > QR.cooldown.upSpd * .9) + QR.cooldown.upSpdAccuracy) / 2 QR.cooldown.upSpd = upSpd - cooldown = {isReply, hasFile, threadID} + cooldown = {isReply, threadID} QR.cooldown.cooldowns[start] = cooldown $.set "cooldown.#{g.BOARD}", QR.cooldown.cooldowns QR.cooldown.start() @@ -360,16 +360,12 @@ QR = # reply cooldown with a reply, thread cooldown with a thread elapsed = Math.floor (now - start) / $.SECOND continue if elapsed < 0 # clock changed since then? - unless isReply - type = 'thread' + type = unless isReply + 'thread' else if hasFile - # You can post an image reply immediately after a non-image reply. - unless cooldown.hasFile - seconds = Math.max seconds, 0 - continue - type = 'image' + 'image' else - type = 'reply' + 'reply' maxTimer = Math.max types[type] or 0, types[type + '_intra'] or 0 unless start <= now <= start + maxTimer * $.SECOND QR.cooldown.unset start