From c2985dbe95b31a87191dd653c02a6b7f4c47e471 Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 28 Dec 2010 16:52:06 -0800 Subject: [PATCH] simplify request callback --- 4chan_x.coffee | 6 +++--- 4chan_x.js | 8 +++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/4chan_x.coffee b/4chan_x.coffee index 771cc16c4..5011335e7 100644 --- a/4chan_x.coffee +++ b/4chan_x.coffee @@ -806,13 +806,13 @@ threadF = (current) -> request = (url, callback) -> r = new XMLHttpRequest() - r.onload = -> callback this + r.onload = callback r.open 'get', url, true r.send() r -updateCallback = (res) -> - body = n 'body', innerHTML: res.responseText +updateCallback = -> + body = n 'body', innerHTML: @responseText replies = $$ 'td.reply', body root = $('br[clear]').previousElementSibling diff --git a/4chan_x.js b/4chan_x.js index 487656fc7..be082df56 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1064,17 +1064,15 @@ request = function(url, callback) { var r; r = new XMLHttpRequest(); - r.onload = function() { - return callback(this); - }; + r.onload = callback; r.open('get', url, true); r.send(); return r; }; - updateCallback = function(res) { + updateCallback = function() { var body, count, i, id, replies, reply, root, span, table; body = n('body', { - innerHTML: res.responseText + innerHTML: this.responseText }); replies = $$('td.reply', body); root = $('br[clear]').previousElementSibling;