Cache boards.json (ccd0: Navigate.coffee changes only)
This commit is contained in:
parent
368baebfc1
commit
ee4ad9b86e
@ -8,7 +8,7 @@ Navigate =
|
||||
$.on window, 'popstate', Navigate.popstate
|
||||
|
||||
@title = -> return
|
||||
|
||||
|
||||
Thread.callbacks.push
|
||||
name: 'Navigate'
|
||||
cb: @thread
|
||||
@ -118,15 +118,11 @@ Navigate =
|
||||
|
||||
QR.flagsInput()
|
||||
|
||||
onload = (e) ->
|
||||
if e.type is 'abort'
|
||||
req.onloadend = null
|
||||
return
|
||||
|
||||
return unless req.status is 200
|
||||
$.cache '//a.4cdn.org/boards.json', ({target}) ->
|
||||
return unless target.status is 200
|
||||
|
||||
try
|
||||
for aboard in req.response.boards when aboard.board is boardID
|
||||
for aboard in target.response.boards when aboard.board is boardID
|
||||
board = aboard
|
||||
break
|
||||
|
||||
@ -141,10 +137,6 @@ Navigate =
|
||||
Navigate.updateTitle board
|
||||
Navigate.updateSFW !!board.ws_board
|
||||
|
||||
req = $.ajax '//a.4cdn.org/boards.json',
|
||||
onabort: onload
|
||||
onloadend: onload
|
||||
|
||||
updateSFW: (sfw) ->
|
||||
# TODO: think of a better name for this. Changes style, too.
|
||||
Favicon.el.href = "//s.4cdn.org/image/favicon#{if sfw then '-ws' else ''}.ico"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user