Cache boards.json (ccd0: Navigate.coffee changes only)

This commit is contained in:
Zixaphir 2014-02-28 18:28:47 -07:00 committed by ccd0
parent 368baebfc1
commit ee4ad9b86e

View File

@ -118,15 +118,11 @@ Navigate =
QR.flagsInput() QR.flagsInput()
onload = (e) -> $.cache '//a.4cdn.org/boards.json', ({target}) ->
if e.type is 'abort' return unless target.status is 200
req.onloadend = null
return
return unless req.status is 200
try 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 board = aboard
break break
@ -141,10 +137,6 @@ Navigate =
Navigate.updateTitle board Navigate.updateTitle board
Navigate.updateSFW !!board.ws_board Navigate.updateSFW !!board.ws_board
req = $.ajax '//a.4cdn.org/boards.json',
onabort: onload
onloadend: onload
updateSFW: (sfw) -> updateSFW: (sfw) ->
# TODO: think of a better name for this. Changes style, too. # 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" Favicon.el.href = "//s.4cdn.org/image/favicon#{if sfw then '-ws' else ''}.ico"