From f2bb9b00a343a305e04f4f29285084c758471c34 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Thu, 28 Jan 2016 21:53:11 -0800 Subject: [PATCH] BoardsJSON -> BoardConfig. --- Gruntfile.coffee | 2 +- .../{BoardsJSON.coffee => BoardConfig.coffee} | 16 ++++++++-------- src/General/Main.coffee | 4 ++-- src/General/Settings.coffee | 2 +- src/classes/Board.coffee | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) rename src/General/{BoardsJSON.coffee => BoardConfig.coffee} (50%) diff --git a/Gruntfile.coffee b/Gruntfile.coffee index 367218796..43c809def 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -108,7 +108,7 @@ module.exports = (grunt) -> 'src/classes/Connection.coffee' 'src/classes/Fetcher.coffee' 'src/General/Polyfill.coffee' - 'src/General/BoardsJSON.coffee' + 'src/General/BoardConfig.coffee' 'src/General/Header.coffee' 'src/General/Index.coffee' 'src/General/Build.coffee' diff --git a/src/General/BoardsJSON.coffee b/src/General/BoardConfig.coffee similarity index 50% rename from src/General/BoardsJSON.coffee rename to src/General/BoardConfig.coffee index e73630f76..7973782ec 100644 --- a/src/General/BoardsJSON.coffee +++ b/src/General/BoardConfig.coffee @@ -1,26 +1,26 @@ -BoardsJSON = +BoardConfig = cbs: [] init: -> - if (Conf['boardsJSON'].lastChecked or 0) < Date.now() - 2 * $.HOUR + if (Conf['boardConfig'].lastChecked or 0) < Date.now() - 2 * $.HOUR $.ajax '//a.4cdn.org/boards.json', onloadend: @load else - @set Conf['boardsJSON'].boards + @set Conf['boardConfig'].boards load: -> if @status is 200 boards = {} for board in @response.boards boards[board.board] = board - $.set 'boardsJSON', {boards, lastChecked: Date.now()} + $.set 'boardConfig', {boards, lastChecked: Date.now()} else - {boards} = Conf['boardsJSON'] - new Notice 'warning', "Failed to load boards JSON. Error #{@statusText} (#{@status})", 20 - BoardsJSON.set boards + {boards} = Conf['boardConfig'] + new Notice 'warning', "Failed to load board configuration data. Error #{@statusText} (#{@status})", 20 + BoardConfig.set boards set: (@boards) -> for ID, board of @boards - g.boards[ID]?.json = board + g.boards[ID]?.config = board for cb in @cbs $.queueTask cb return diff --git a/src/General/Main.coffee b/src/General/Main.coffee index 61d09af42..7c13b6b15 100644 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -36,7 +36,7 @@ Main = for db in DataBoard.keys Conf[db] = boards: {} - Conf['boardsJSON'] = boards: {} + Conf['boardConfig'] = boards: {} Conf['selectedArchives'] = {} Conf['cooldowns'] = {} @@ -358,7 +358,7 @@ Main = features: [ ['Polyfill', Polyfill] - ['Boards JSON', BoardsJSON] + ['Board Configuration', BoardConfig] ['Normalize URL', NormalizeURL] ['Captcha Configuration', Captcha.replace] ['Redirect', Redirect] diff --git a/src/General/Settings.coffee b/src/General/Settings.coffee index 83340f9d5..3bc5c6a82 100644 --- a/src/General/Settings.coffee +++ b/src/General/Settings.coffee @@ -182,7 +182,7 @@ Settings = # Make sure to export the most recent data. $.get Conf, (Conf) -> # Don't export cached JSON data. - delete Conf['boardsJSON'] + delete Conf['boardConfig'] Settings.downloadExport {version: g.VERSION, date: Date.now(), Conf} downloadExport: (data) -> diff --git a/src/classes/Board.coffee b/src/classes/Board.coffee index 073f24fd5..f92886ae9 100644 --- a/src/classes/Board.coffee +++ b/src/classes/Board.coffee @@ -4,6 +4,6 @@ class Board constructor: (@ID) -> @threads = new SimpleDict() @posts = new SimpleDict() - @json = BoardsJSON.boards?[@ID] + @config = BoardConfig.boards?[@ID] g.boards[@] = @