$.ajax: Each feature gets its own last-modified list.
This commit is contained in:
parent
e15883c5cb
commit
cd23973d99
@ -431,7 +431,7 @@ Index =
|
||||
Index.req = $.ajax "//a.4cdn.org/#{g.BOARD}/catalog.json",
|
||||
onloadend: (e) -> Index.load e, state
|
||||
,
|
||||
whenModified: true
|
||||
whenModified: 'Index'
|
||||
$.addClass Index.button, 'fa-spin'
|
||||
|
||||
load: (e, state) ->
|
||||
|
||||
@ -64,8 +64,8 @@ $.ajax = do ->
|
||||
options.onerror?()
|
||||
return
|
||||
if whenModified
|
||||
r.setRequestHeader 'If-Modified-Since', lastModified[url] if url of lastModified
|
||||
$.on r, 'load', -> lastModified[url] = r.getResponseHeader 'Last-Modified'
|
||||
r.setRequestHeader 'If-Modified-Since', lastModified[whenModified][url] if lastModified[whenModified]?[url]?
|
||||
$.on r, 'load', -> (lastModified[whenModified] or= {})[url] = r.getResponseHeader 'Last-Modified'
|
||||
if /\.json$/.test url
|
||||
r.responseType = 'json'
|
||||
$.extend r, options
|
||||
|
||||
@ -75,7 +75,7 @@ ThreadStats =
|
||||
return
|
||||
ThreadStats.timeout = setTimeout ThreadStats.fetchPage, 2 * $.MINUTE
|
||||
$.ajax "//a.4cdn.org/#{ThreadStats.thread.board}/threads.json", onload: ThreadStats.onThreadsLoad,
|
||||
whenModified: true
|
||||
whenModified: 'ThreadStats'
|
||||
|
||||
onThreadsLoad: ->
|
||||
return unless Conf["Page Count in Stats"] and @status is 200
|
||||
|
||||
@ -241,7 +241,7 @@ ThreadUpdater =
|
||||
onloadend: ThreadUpdater.cb.load
|
||||
timeout: $.MINUTE
|
||||
,
|
||||
whenModified: true
|
||||
whenModified: 'ThreadUpdater'
|
||||
|
||||
updateThreadStatus: (type, status) ->
|
||||
return unless hasChanged = ThreadUpdater.thread["is#{type}"] isnt status
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user