Add mode and sort options for custom board links.
This commit is contained in:
parent
274419b639
commit
1e528eabe2
@ -186,7 +186,7 @@ Header =
|
||||
return unless boardnav
|
||||
boardnav = boardnav.replace /(\r\n|\n|\r)/g, ' '
|
||||
as = $$ '#full-board-list a[title]', Header.boardList
|
||||
re = /[\w@]+(-(all|title|replace|full|index|catalog|archive|expired|text:"[^"]+"(,"[^"]+")?))*|[^\w@]+/g
|
||||
re = /[\w@]+(-(all|title|replace|full|index|catalog|archive|expired|(mode|sort|text):"[^"]+"(,"[^"]+")?))*|[^\w@]+/g
|
||||
nodes = (Header.mapCustomNavigation t, as for t in boardnav.match re)
|
||||
|
||||
$.add list, nodes
|
||||
@ -202,6 +202,11 @@ Header =
|
||||
url = m2
|
||||
''
|
||||
|
||||
indexOptions = []
|
||||
t = t.replace /-(?:mode|sort):"([^"]+)"/g, (m0, m1) ->
|
||||
indexOptions.push m1.toLowerCase().replace(/\ /g, '-')
|
||||
''
|
||||
|
||||
if /^toggle-all/.test t
|
||||
a = $.el 'a',
|
||||
className: 'show-board-list-button'
|
||||
@ -252,6 +257,9 @@ 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 /-archive/.test t
|
||||
if href = Redirect.to 'board', {boardID}
|
||||
a.href = href
|
||||
|
||||
@ -32,6 +32,8 @@
|
||||
<div>Custom text link: <code>g-text:"Install Gentoo"</code></div>
|
||||
<div>Index-only link: <code>g-index</code></div>
|
||||
<div>Catalog-only link: <code>g-catalog</code></div>
|
||||
<div>Index mode: <code>g-mode:"infinite scrolling"</code></div>
|
||||
<div>Index sort: <code>g-sort:"creation date"</code></div>
|
||||
<div>External link: <code>external-text:"Google","http://www.google.com"</code></div>
|
||||
<div>Combinations are possible: <code>g-index-text:"Technology Index"</code></div>
|
||||
<div>Full board list toggle: <code>toggle-all</code></div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user