From 6296393365d39dae2229d8d647f4850b86d3b008 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 12 Mar 2016 18:29:16 -0800 Subject: [PATCH] Make mode/sort options for custom board links compatible with Catalog Links. --- src/General/Header.coffee | 7 +++++-- src/Miscellaneous/CatalogLinks.coffee | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/General/Header.coffee b/src/General/Header.coffee index 1134a4f6c..dfa5b62e4 100644 --- a/src/General/Header.coffee +++ b/src/General/Header.coffee @@ -206,6 +206,7 @@ Header = t = t.replace /-(?:mode|sort):"([^"]+)"/g, (m0, m1) -> indexOptions.push m1.toLowerCase().replace(/\ /g, '-') '' + indexOptions = indexOptions.join('/') if /^toggle-all/.test t a = $.el 'a', @@ -257,8 +258,10 @@ Header = else return a.firstChild # Its text node. - if Conf['JSON Index'] and indexOptions.length and a.host is location.host and /\/$/.test(a.pathname) - a.href += (if a.hash then '/' else '#') + indexOptions.join('/') + if Conf['JSON Index'] and indexOptions + a.dataset.indexOptions = indexOptions + if a.hostname is 'boards.4chan.org' and a.pathname.split('/')[2] is '' + a.href += (if a.hash then '/' else '#') + indexOptions if /-archive/.test t if href = Redirect.to 'board', {boardID} diff --git a/src/Miscellaneous/CatalogLinks.coffee b/src/Miscellaneous/CatalogLinks.coffee index dbc05a05a..c9489a831 100644 --- a/src/Miscellaneous/CatalogLinks.coffee +++ b/src/Miscellaneous/CatalogLinks.coffee @@ -67,6 +67,9 @@ CatalogLinks = # conditions where External Catalog has been disabled between switches. a.href = if useCatalog then CatalogLinks.catalog(board) else "/#{board}/" + if a.dataset.indexOptions and a.hostname is 'boards.4chan.org' and a.pathname.split('/')[2] is '' + a.href += (if a.hash then '/' else '#') + a.dataset.indexOptions + CatalogLinks.el.title = "Turn catalog links #{if useCatalog then 'off' else 'on'}." $('input', CatalogLinks.el).checked = useCatalog