From 1079cf1434ba338885291de2867e2fe22ea36035 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 6 Mar 2012 10:50:24 +0100 Subject: [PATCH] Fix Updater.update when it's executed as an event callback. --- 4chan_x.user.js | 10 +++++----- script.coffee | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index dce64eee0..40e4328dd 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2691,14 +2691,14 @@ }, update: function() { var url, _ref; - this.timer.textContent = 0; - if ((_ref = this.request) != null) _ref.abort(); + Updater.timer.textContent = 0; + if ((_ref = Updater.request) != null) _ref.abort(); url = location.pathname + '?' + Date.now(); - return this.request = $.ajax(url, { - onload: this.cb.update + return Updater.request = $.ajax(url, { + onload: Updater.cb.update }, { headers: { - 'If-Modified-Since': this.lastModified + 'If-Modified-Since': Updater.lastModified } }); } diff --git a/script.coffee b/script.coffee index 6e67dc619..d60d37e7c 100644 --- a/script.coffee +++ b/script.coffee @@ -2251,12 +2251,12 @@ Updater = @update() update: -> - @timer.textContent = 0 - @request?.abort() + Updater.timer.textContent = 0 + Updater.request?.abort() #fool the cache url = location.pathname + '?' + Date.now() - @request = $.ajax url, onload: @cb.update, - headers: 'If-Modified-Since': @lastModified + Updater.request = $.ajax url, onload: Updater.cb.update, + headers: 'If-Modified-Since': Updater.lastModified Watcher = init: ->