From 3b7aa9f398e30a3b41d960dfbb853a5dac525863 Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Thu, 16 Jan 2014 04:27:33 -0700 Subject: [PATCH] Deal with 304 status with board navigation --- builds/4chan-X.user.js | 4 +++- builds/crx/script.js | 4 +++- src/General/Index.coffee | 5 ++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 99c90f1b1..3ea1d8519 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -2192,6 +2192,7 @@ if (g.BOARD.ID === 'f' || g.VIEW === 'catalog' || !Conf['JSON Navigation']) { return; } + this.board = "" + g.BOARD; this.button = $.el('a', { className: 'index-refresh-shortcut fa fa-refresh', title: 'Refresh', @@ -2585,7 +2586,8 @@ } Navigate.title(); try { - if (req.status === 200) { + if (req.status === 200 || Index.board !== ("" + g.BOARD)) { + Index.board = "" + g.BOARD; Index.parse(JSON.parse(req.response), pageNum); } else if (req.status === 304 && (pageNum != null)) { Index.pageNav(pageNum); diff --git a/builds/crx/script.js b/builds/crx/script.js index 8b9d645f9..ac9efb420 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -2202,6 +2202,7 @@ if (g.BOARD.ID === 'f' || g.VIEW === 'catalog' || !Conf['JSON Navigation']) { return; } + this.board = "" + g.BOARD; this.button = $.el('a', { className: 'index-refresh-shortcut fa fa-refresh', title: 'Refresh', @@ -2595,7 +2596,8 @@ } Navigate.title(); try { - if (req.status === 200) { + if (req.status === 200 || Index.board !== ("" + g.BOARD)) { + Index.board = "" + g.BOARD; Index.parse(JSON.parse(req.response), pageNum); } else if (req.status === 304 && (pageNum != null)) { Index.pageNav(pageNum); diff --git a/src/General/Index.coffee b/src/General/Index.coffee index b011fc9ea..1959cdb1f 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -2,6 +2,8 @@ Index = init: -> return if g.BOARD.ID is 'f' or g.VIEW is 'catalog' or !Conf['JSON Navigation'] + @board = "#{g.BOARD}" + @button = $.el 'a', className: 'index-refresh-shortcut fa fa-refresh' title: 'Refresh' @@ -274,7 +276,8 @@ Index = Navigate.title() try - if req.status is 200 + if req.status is 200 or Index.board isnt "#{g.BOARD}" + Index.board = "#{g.BOARD}" Index.parse JSON.parse(req.response), pageNum else if req.status is 304 and pageNum? Index.pageNav pageNum