From 3ce9bc395fb66d188d221f09751fe91f6e3c8ca1 Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Thu, 25 Apr 2013 04:14:11 -0700 Subject: [PATCH] Move the QR out of 4chanXInitFinished and into $.ready --- builds/4chan-X.js | 9 ++++----- builds/4chan-X.user.js | 9 ++++----- builds/crx/script.js | 9 ++++----- src/features/posting/qr.coffee | 3 +-- src/main.coffee | 4 ++-- 5 files changed, 15 insertions(+), 19 deletions(-) diff --git a/builds/4chan-X.js b/builds/4chan-X.js index e11f52d41..451b41705 100644 --- a/builds/4chan-X.js +++ b/builds/4chan-X.js @@ -6892,7 +6892,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 @@ -6901,7 +6901,6 @@ initReady: function() { var link, title; - $.off(d, '4chanXInitFinished', QR.initReady); QR.postingIsEnabled = !!$.id('postForm'); if (!QR.postingIsEnabled) { return; @@ -9664,13 +9663,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 b9f4b3f1f..e5e41e07d 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -6888,7 +6888,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 @@ -6897,7 +6897,6 @@ initReady: function() { var link, title; - $.off(d, '4chanXInitFinished', QR.initReady); QR.postingIsEnabled = !!$.id('postForm'); if (!QR.postingIsEnabled) { return; @@ -9687,13 +9686,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 27c5834e2..058cbac40 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -6757,7 +6757,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 @@ -6766,7 +6766,6 @@ initReady: function() { var link, title; - $.off(d, '4chanXInitFinished', QR.initReady); QR.postingIsEnabled = !!$.id('postForm'); if (!QR.postingIsEnabled) { return; @@ -9530,13 +9529,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 a7ce02090..da8ba92d5 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 335125b54..e7ab395ba 100644 --- a/src/main.coffee +++ b/src/main.coffee @@ -196,7 +196,7 @@ Main = Main.callbackNodesDB Post, posts, -> $.event '4chanXInitFinished' Main.checkUpdate() - + return $.event '4chanXInitFinished' @@ -223,11 +223,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