From 063ea136ba8a10f422cdfde04fb82d09b77d1993 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Fri, 7 Sep 2012 22:20:26 +0200 Subject: [PATCH] Network tweak: get the Last-Modified header when we open the thread via a HEAD request. --- 4chan_x.user.js | 9 +++++++++ script.coffee | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/4chan_x.user.js b/4chan_x.user.js index 4b04b0d60..81c515f77 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2851,6 +2851,15 @@ this.thread = $.id("t" + g.THREAD_ID); this.unsuccessfulFetchCount = 0; this.lastModified = '0'; + $.ajax("//api.4chan.org/" + g.BOARD + "/res/" + g.THREAD_ID + ".json", { + type: 'head', + onload: function() { + if (this.status !== 200) { + return; + } + return Updater.lastModified = this.getResponseHeader('Last-Modified'); + } + }); _ref = $$('input', dialog); for (_i = 0, _len = _ref.length; _i < _len; _i++) { input = _ref[_i]; diff --git a/script.coffee b/script.coffee index 6867e9db9..fec950281 100644 --- a/script.coffee +++ b/script.coffee @@ -2281,6 +2281,11 @@ Updater = @unsuccessfulFetchCount = 0 @lastModified = '0' + $.ajax "//api.4chan.org/#{g.BOARD}/res/#{g.THREAD_ID}.json", + type: 'head' + onload: -> + return if @status isnt 200 + Updater.lastModified = @getResponseHeader 'Last-Modified' for input in $$ 'input', dialog if input.type is 'checkbox'