Make mode/sort options for custom board links compatible with Catalog Links.
This commit is contained in:
parent
1e528eabe2
commit
6296393365
@ -206,6 +206,7 @@ Header =
|
|||||||
t = t.replace /-(?:mode|sort):"([^"]+)"/g, (m0, m1) ->
|
t = t.replace /-(?:mode|sort):"([^"]+)"/g, (m0, m1) ->
|
||||||
indexOptions.push m1.toLowerCase().replace(/\ /g, '-')
|
indexOptions.push m1.toLowerCase().replace(/\ /g, '-')
|
||||||
''
|
''
|
||||||
|
indexOptions = indexOptions.join('/')
|
||||||
|
|
||||||
if /^toggle-all/.test t
|
if /^toggle-all/.test t
|
||||||
a = $.el 'a',
|
a = $.el 'a',
|
||||||
@ -257,8 +258,10 @@ Header =
|
|||||||
else
|
else
|
||||||
return a.firstChild # Its text node.
|
return a.firstChild # Its text node.
|
||||||
|
|
||||||
if Conf['JSON Index'] and indexOptions.length and a.host is location.host and /\/$/.test(a.pathname)
|
if Conf['JSON Index'] and indexOptions
|
||||||
a.href += (if a.hash then '/' else '#') + indexOptions.join('/')
|
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 /-archive/.test t
|
||||||
if href = Redirect.to 'board', {boardID}
|
if href = Redirect.to 'board', {boardID}
|
||||||
|
|||||||
@ -67,6 +67,9 @@ CatalogLinks =
|
|||||||
# conditions where External Catalog has been disabled between switches.
|
# conditions where External Catalog has been disabled between switches.
|
||||||
a.href = if useCatalog then CatalogLinks.catalog(board) else "/#{board}/"
|
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'}."
|
CatalogLinks.el.title = "Turn catalog links #{if useCatalog then 'off' else 'on'}."
|
||||||
$('input', CatalogLinks.el).checked = useCatalog
|
$('input', CatalogLinks.el).checked = useCatalog
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user