Cache boards.json
This commit is contained in:
parent
b4d28414df
commit
5a76a9109c
@ -3239,8 +3239,7 @@
|
||||
Index.pageNav(pageNum);
|
||||
return;
|
||||
}
|
||||
Index.buildIndex();
|
||||
return Index.setPage();
|
||||
return Index.buildIndex();
|
||||
},
|
||||
parseThreadList: function(pages) {
|
||||
Index.threadsNumPerPage = pages[0].threads.length;
|
||||
@ -3250,7 +3249,7 @@
|
||||
Index.liveThreadIDs = Index.liveThreadData.map(function(data) {
|
||||
return data.no;
|
||||
});
|
||||
g.BOARD.threads.forEach(function(thread) {
|
||||
return g.BOARD.threads.forEach(function(thread) {
|
||||
var _ref;
|
||||
if (_ref = thread.ID, __indexOf.call(Index.liveThreadIDs, _ref) < 0) {
|
||||
return thread.collect();
|
||||
@ -12851,23 +12850,20 @@
|
||||
}[g.VIEW]();
|
||||
},
|
||||
updateBoard: function(boardID) {
|
||||
var fullBoardList, onload, req;
|
||||
var fullBoardList;
|
||||
fullBoardList = $('#full-board-list', Header.boardList);
|
||||
$.rmClass($('.current', fullBoardList), 'current');
|
||||
$.addClass($("a[href*='/" + boardID + "/']", fullBoardList), 'current');
|
||||
Header.generateBoardList(Conf['boardnav'].replace(/(\r\n|\n|\r)/g, ' '));
|
||||
QR.flagsInput();
|
||||
onload = function(e) {
|
||||
var aboard, board, err, _i, _len, _ref;
|
||||
if (e.type === 'abort') {
|
||||
req.onloadend = null;
|
||||
return;
|
||||
}
|
||||
if (req.status !== 200) {
|
||||
return $.cache('//a.4cdn.org/boards.json', function(_arg) {
|
||||
var aboard, board, err, target, _i, _len, _ref;
|
||||
target = _arg.target;
|
||||
if (target.status !== 200) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
_ref = req.response.boards;
|
||||
_ref = target.response.boards;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
aboard = _ref[_i];
|
||||
if (!(aboard.board === boardID)) {
|
||||
@ -12891,10 +12887,6 @@
|
||||
}
|
||||
Navigate.updateTitle(board);
|
||||
return Navigate.updateSFW(!!board.ws_board);
|
||||
};
|
||||
return req = $.ajax('//a.4cdn.org/boards.json', {
|
||||
onabort: onload,
|
||||
onloadend: onload
|
||||
});
|
||||
},
|
||||
updateSFW: function(sfw) {
|
||||
|
||||
@ -3290,8 +3290,7 @@
|
||||
Index.pageNav(pageNum);
|
||||
return;
|
||||
}
|
||||
Index.buildIndex();
|
||||
return Index.setPage();
|
||||
return Index.buildIndex();
|
||||
},
|
||||
parseThreadList: function(pages) {
|
||||
Index.threadsNumPerPage = pages[0].threads.length;
|
||||
@ -3301,7 +3300,7 @@
|
||||
Index.liveThreadIDs = Index.liveThreadData.map(function(data) {
|
||||
return data.no;
|
||||
});
|
||||
g.BOARD.threads.forEach(function(thread) {
|
||||
return g.BOARD.threads.forEach(function(thread) {
|
||||
var _ref;
|
||||
if (_ref = thread.ID, __indexOf.call(Index.liveThreadIDs, _ref) < 0) {
|
||||
return thread.collect();
|
||||
@ -12857,23 +12856,20 @@
|
||||
}[g.VIEW]();
|
||||
},
|
||||
updateBoard: function(boardID) {
|
||||
var fullBoardList, onload, req;
|
||||
var fullBoardList;
|
||||
fullBoardList = $('#full-board-list', Header.boardList);
|
||||
$.rmClass($('.current', fullBoardList), 'current');
|
||||
$.addClass($("a[href*='/" + boardID + "/']", fullBoardList), 'current');
|
||||
Header.generateBoardList(Conf['boardnav'].replace(/(\r\n|\n|\r)/g, ' '));
|
||||
QR.flagsInput();
|
||||
onload = function(e) {
|
||||
var aboard, board, err, _i, _len, _ref;
|
||||
if (e.type === 'abort') {
|
||||
req.onloadend = null;
|
||||
return;
|
||||
}
|
||||
if (req.status !== 200) {
|
||||
return $.cache('//a.4cdn.org/boards.json', function(_arg) {
|
||||
var aboard, board, err, target, _i, _len, _ref;
|
||||
target = _arg.target;
|
||||
if (target.status !== 200) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
_ref = req.response.boards;
|
||||
_ref = target.response.boards;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
aboard = _ref[_i];
|
||||
if (!(aboard.board === boardID)) {
|
||||
@ -12897,10 +12893,6 @@
|
||||
}
|
||||
Navigate.updateTitle(board);
|
||||
return Navigate.updateSFW(!!board.ws_board);
|
||||
};
|
||||
return req = $.ajax('//a.4cdn.org/boards.json', {
|
||||
onabort: onload,
|
||||
onloadend: onload
|
||||
});
|
||||
},
|
||||
updateSFW: function(sfw) {
|
||||
|
||||
@ -562,7 +562,6 @@ Index =
|
||||
Index.pageNav pageNum
|
||||
return
|
||||
Index.buildIndex()
|
||||
Index.setPage()
|
||||
|
||||
parseThreadList: (pages) ->
|
||||
Index.threadsNumPerPage = pages[0].threads.length
|
||||
@ -570,7 +569,6 @@ Index =
|
||||
Index.liveThreadIDs = Index.liveThreadData.map (data) -> data.no
|
||||
g.BOARD.threads.forEach (thread) ->
|
||||
thread.collect() unless thread.ID in Index.liveThreadIDs
|
||||
return
|
||||
|
||||
buildThreads: ->
|
||||
Index.nodes = []
|
||||
|
||||
@ -7,7 +7,7 @@ Navigate =
|
||||
$.ready -> $.on window, 'popstate', Navigate.popstate
|
||||
|
||||
@title = -> return
|
||||
|
||||
|
||||
Thread.callbacks.push
|
||||
name: 'Navigate'
|
||||
cb: @thread
|
||||
@ -117,15 +117,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
|
||||
|
||||
@ -140,10 +136,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