From f01293b743ad2d1377281fa728890231c6fb3f32 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Mon, 27 Oct 2014 22:08:13 -0700 Subject: [PATCH] Navigating to the index (as opposed to the catalog) will only switch to a non-catalog index mode if Use 4chan X Catalog is enabled. --- src/General/Index.coffee | 5 +++++ src/Miscellaneous/CatalogLinks.coffee | 2 +- src/Miscellaneous/Keybinds.coffee | 5 ++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 6ba74c7fe..a69f8ef3d 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -81,6 +81,7 @@ Index = $.on @searchInput, 'input', @onSearchInput $.on $('#index-search-clear', @navLinks), 'click', @clearSearch $.on $('#hidden-toggle a', @navLinks), 'click', @cb.toggleHiddenThreads + $.on $('.returnlink a', @navLinks), 'click', @cb.frontPage unless Conf['Use 4chan X Catalog'] @selectSort.value = Conf[@selectSort.name] $.on @selectSort, 'change', $.cb.value $.on @selectSort, 'change', @cb.sort @@ -234,6 +235,10 @@ Index = return if a.textContent is 'Catalog' e.preventDefault() Index.userPageNav +a.pathname.split('/')[2] or 1 + frontPage: (e) -> + return if e.shiftKey or e.altKey or e.ctrlKey or e.metaKey or e.button isnt 0 + e.preventDefault() + Index.userPageNav 1 scrollToIndex: -> Header.scrollToIfNeeded Index.navLinks diff --git a/src/Miscellaneous/CatalogLinks.coffee b/src/Miscellaneous/CatalogLinks.coffee index faf1059bb..81524b6d6 100755 --- a/src/Miscellaneous/CatalogLinks.coffee +++ b/src/Miscellaneous/CatalogLinks.coffee @@ -57,7 +57,7 @@ CatalogLinks = "/#{board}/catalog" index: (board=g.BOARD.ID) -> - if Conf['JSON Navigation'] + if Conf['JSON Navigation'] and Conf['Use 4chan X Catalog'] if g.BOARD.ID is board and g.VIEW is 'index' then '#index' else "/#{board}/\#index" else "/#{board}/" diff --git a/src/Miscellaneous/Keybinds.coffee b/src/Miscellaneous/Keybinds.coffee index c9439d239..b83078668 100755 --- a/src/Miscellaneous/Keybinds.coffee +++ b/src/Miscellaneous/Keybinds.coffee @@ -102,7 +102,10 @@ Keybinds = FappeTyme.cb.toggle.call {name: 'werk'} # Board Navigation when Conf['Front page'] - window.location = CatalogLinks.index() + if Conf['JSON Navigation'] and !Conf['Use 4chan X Catalog'] and g.VIEW is 'index' + Index.userPageNav 1 + else + window.location = CatalogLinks.index() when Conf['Open front page'] $.open CatalogLinks.index() when Conf['Next page']