Revert "Fetch boards.json data."
This reverts commit 19ba43ae3dfc6008893ad9ebdbd0e68ecb60de01.
This commit is contained in:
parent
fa2d5bd891
commit
cc03357e07
@ -108,7 +108,6 @@ module.exports = (grunt) ->
|
|||||||
'src/classes/Connection.coffee'
|
'src/classes/Connection.coffee'
|
||||||
'src/classes/Fetcher.coffee'
|
'src/classes/Fetcher.coffee'
|
||||||
'src/General/Polyfill.coffee'
|
'src/General/Polyfill.coffee'
|
||||||
'src/General/BoardsJSON.coffee'
|
|
||||||
'src/General/Header.coffee'
|
'src/General/Header.coffee'
|
||||||
'src/General/Index.coffee'
|
'src/General/Index.coffee'
|
||||||
'src/General/Build.coffee'
|
'src/General/Build.coffee'
|
||||||
|
|||||||
@ -1,32 +0,0 @@
|
|||||||
BoardsJSON =
|
|
||||||
cbs: []
|
|
||||||
|
|
||||||
init: ->
|
|
||||||
if (Conf['boardsJSON'].lastChecked or 0) < Date.now() - 2 * $.HOUR
|
|
||||||
$.ajax '//a.4cdn.org/boards.json', onloadend: @load
|
|
||||||
else
|
|
||||||
@set Conf['boardsJSON'].boards
|
|
||||||
|
|
||||||
load: ->
|
|
||||||
if @status is 200
|
|
||||||
boards = {}
|
|
||||||
for board in @response.boards
|
|
||||||
boards[board.board] = board
|
|
||||||
$.set 'boardsJSON', {boards, lastChecked: Date.now()}
|
|
||||||
else
|
|
||||||
{boards} = Conf['boardsJSON']
|
|
||||||
new Notice 'warning', "Failed to load boards JSON. Error #{@statusText} (#{@status})", 20
|
|
||||||
BoardsJSON.set boards
|
|
||||||
|
|
||||||
set: (@boards) ->
|
|
||||||
for ID, board of @boards
|
|
||||||
g.boards[ID]?.json = board
|
|
||||||
for cb in @cbs
|
|
||||||
$.queueTask cb
|
|
||||||
return
|
|
||||||
|
|
||||||
ready: (cb) ->
|
|
||||||
if @boards
|
|
||||||
cb()
|
|
||||||
else
|
|
||||||
@cbs.push cb
|
|
||||||
@ -36,7 +36,6 @@ Main =
|
|||||||
|
|
||||||
for db in DataBoard.keys
|
for db in DataBoard.keys
|
||||||
Conf[db] = boards: {}
|
Conf[db] = boards: {}
|
||||||
Conf['boardsJSON'] = boards: {}
|
|
||||||
Conf['selectedArchives'] = {}
|
Conf['selectedArchives'] = {}
|
||||||
Conf['cooldowns'] = {}
|
Conf['cooldowns'] = {}
|
||||||
|
|
||||||
@ -358,7 +357,6 @@ Main =
|
|||||||
|
|
||||||
features: [
|
features: [
|
||||||
['Polyfill', Polyfill]
|
['Polyfill', Polyfill]
|
||||||
['Boards JSON', BoardsJSON]
|
|
||||||
['Normalize URL', NormalizeURL]
|
['Normalize URL', NormalizeURL]
|
||||||
['Captcha Configuration', Captcha.replace]
|
['Captcha Configuration', Captcha.replace]
|
||||||
['Redirect', Redirect]
|
['Redirect', Redirect]
|
||||||
|
|||||||
@ -4,6 +4,5 @@ class Board
|
|||||||
constructor: (@ID) ->
|
constructor: (@ID) ->
|
||||||
@threads = new SimpleDict()
|
@threads = new SimpleDict()
|
||||||
@posts = new SimpleDict()
|
@posts = new SimpleDict()
|
||||||
@json = BoardsJSON.boards?[@ID]
|
|
||||||
|
|
||||||
g.boards[@] = @
|
g.boards[@] = @
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user