Make mode/sort options for custom board links compatible with Catalog Links.

This commit is contained in:
ccd0 2016-03-12 18:29:16 -08:00
parent 1e528eabe2
commit 6296393365
2 changed files with 8 additions and 2 deletions

View File

@ -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}

View File

@ -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