From 736242bf1037b40f26bab5bef95c8c6ded01321e Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sun, 21 Sep 2014 11:10:46 -0700 Subject: [PATCH] fix catalog reverting to index on refresh --- src/General/Index.coffee | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 03d9a6f7c..43db0076e 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -235,20 +235,23 @@ Index = Index.sort() Index.buildIndex() hashchange: (e) -> - switch command = location.hash[1..] + {pathname, hash} = location + switch command = hash[1..] when 'paged', 'infinite', 'all-pages', 'catalog' mode = command.replace /-/g, ' ' when 'index' mode = Conf['Previous Index Mode'] if mode Index.setMode mode - history.replaceState {mode}, '', if Index.currentPage is 1 then './' else Index.currentPage - if e - # hash change, not call from init - Index.buildIndex() - Index.setPage() - return - history.replaceState {mode: Conf['Index Mode']}, '' + pathname = if Index.currentPage is 1 then './' else Index.currentPage + hash = '' + if Conf['Use 4chan X Catalog'] and Conf['Index Mode'] is 'catalog' + hash = '#catalog' + history.replaceState {mode: Conf['Index Mode']}, '', pathname + hash + if mode and e + # hash change, not call from init + Index.buildIndex() + Index.setPage() popstate: (e) -> unless e?.state # page load or hash change