diff --git a/builds/4chan-X.js b/builds/4chan-X.js index ef2c9d0ed..226c43fbb 100644 --- a/builds/4chan-X.js +++ b/builds/4chan-X.js @@ -6975,7 +6975,7 @@ return $.addClass(doc, 'hide-original-post-form'); }); } - $.on(d, '4chanXInitFinished', this.initReady); + $.ready(this.initReady); return Post.prototype.callbacks.push({ name: 'Quick Reply', cb: this.node @@ -6984,7 +6984,6 @@ initReady: function() { var link, title; - $.off(d, '4chanXInitFinished', QR.initReady); QR.postingIsEnabled = !!$.id('postForm'); if (!QR.postingIsEnabled) { return; @@ -9749,13 +9748,13 @@ softTask = function() { var args, func, task; - if (!queue.length) { - return; - } task = queue.shift(); func = task[0]; args = Array.prototype.slice.call(task, 1); func.apply(func, args); + if (!queue.length) { + return; + } if ((queue.length % 7) === 0) { return setTimeout(softTask, 0); } else { diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 35c497e8d..3b131a176 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -6971,7 +6971,7 @@ return $.addClass(doc, 'hide-original-post-form'); }); } - $.on(d, '4chanXInitFinished', this.initReady); + $.ready(this.initReady); return Post.prototype.callbacks.push({ name: 'Quick Reply', cb: this.node @@ -6980,7 +6980,6 @@ initReady: function() { var link, title; - $.off(d, '4chanXInitFinished', QR.initReady); QR.postingIsEnabled = !!$.id('postForm'); if (!QR.postingIsEnabled) { return; @@ -9772,13 +9771,13 @@ softTask = function() { var args, func, task; - if (!queue.length) { - return; - } task = queue.shift(); func = task[0]; args = Array.prototype.slice.call(task, 1); func.apply(func, args); + if (!queue.length) { + return; + } if ((queue.length % 7) === 0) { return setTimeout(softTask, 0); } else { diff --git a/builds/crx/script.js b/builds/crx/script.js index 6bed750f6..b57c9d150 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -6840,7 +6840,7 @@ return $.addClass(doc, 'hide-original-post-form'); }); } - $.on(d, '4chanXInitFinished', this.initReady); + $.ready(this.initReady); return Post.prototype.callbacks.push({ name: 'Quick Reply', cb: this.node @@ -6849,7 +6849,6 @@ initReady: function() { var link, title; - $.off(d, '4chanXInitFinished', QR.initReady); QR.postingIsEnabled = !!$.id('postForm'); if (!QR.postingIsEnabled) { return; @@ -9615,13 +9614,13 @@ softTask = function() { var args, func, task; - if (!queue.length) { - return; - } task = queue.shift(); func = task[0]; args = Array.prototype.slice.call(task, 1); func.apply(func, args); + if (!queue.length) { + return; + } if ((queue.length % 7) === 0) { return setTimeout(softTask, 0); } else { diff --git a/src/features/posting/qr.coffee b/src/features/posting/qr.coffee index 49a38e511..2a860ef63 100644 --- a/src/features/posting/qr.coffee +++ b/src/features/posting/qr.coffee @@ -24,14 +24,13 @@ QR = if Conf['Hide Original Post Form'] $.asap (-> doc), -> $.addClass doc, 'hide-original-post-form' - $.on d, '4chanXInitFinished', @initReady + $.ready @initReady Post::callbacks.push name: 'Quick Reply' cb: @node initReady: -> - $.off d, '4chanXInitFinished', QR.initReady QR.postingIsEnabled = !!$.id 'postForm' return unless QR.postingIsEnabled diff --git a/src/main.coffee b/src/main.coffee index 00e618a0b..530ed91c2 100644 --- a/src/main.coffee +++ b/src/main.coffee @@ -198,7 +198,7 @@ Main = Main.callbackNodesDB Post, posts, -> $.event '4chanXInitFinished' Main.checkUpdate() - + return $.event '4chanXInitFinished' @@ -225,11 +225,11 @@ Main = callbackNodesDB: (klass, nodes, cb) -> queue = [] softTask = -> - return unless queue.length task = queue.shift() func = task[0] args = Array::slice.call task, 1 func.apply func, args + return unless queue.length if (queue.length % 7) is 0 setTimeout softTask, 0 else