Implement -expired header links. #274

This commit is contained in:
ccd0 2015-01-04 17:30:58 -08:00
parent 050daf3f1a
commit abd74fc0ce
3 changed files with 9 additions and 1 deletions

View File

@ -173,7 +173,7 @@ Header =
return unless boardnav
boardnav = boardnav.replace /(\r\n|\n|\r)/g, ' '
as = $$ '#full-board-list a[title]', Header.boardList
nodes = boardnav.match(/[\w@]+(-(all|title|replace|full|index|catalog|archive|text:"[^"]+"(,"[^"]+")?))*|[^\w@]+/g).map (t) ->
nodes = boardnav.match(/[\w@]+(-(all|title|replace|full|index|catalog|archive|expired|text:"[^"]+"(,"[^"]+")?))*|[^\w@]+/g).map (t) ->
if /^[^\w@]/.test t
return $.tn t
text = url = null
@ -222,6 +222,12 @@ Header =
else
return $.tn a.textContent
if /-expired/.test t
if boardID not in ['b', 'f']
a.href = "/#{boardID}/archive"
else
return $.tn a.textContent
$.addClass a, 'navSmall' if boardID is '@'
return a
$.tn t

View File

@ -19,6 +19,7 @@
<div class=note>In the following examples for /g/, <code>g</code> can be changed to a different board ID (<code>a</code>, <code>b</code>, etc...), the current board (<code>current</code>), or the Twitter link (<code>@</code>).</div>
<div>Board link: <code>g</code></div>
<div>Archive link: <code>g-archive</code></div>
<div>Internal archive link: <code>g-expired</code></div>
<div>Title link: <code>g-title</code></div>
<div>Board link (Replace with title when on that board): <code>g-replace</code></div>
<div>Full text link: <code>g-full</code></div>

View File

@ -52,6 +52,7 @@ CatalogLinks =
continue if a.hostname not in ['boards.4chan.org', 'catalog.neet.tv', '4index.gropes.us'] or
!(board = a.pathname.split('/')[1]) or
board in ['f', 'status', '4chan'] or
a.pathname.split('/')[2] is 'archive' or
$.hasClass a, 'external'
# Href is easier than pathname because then we don't have