Fix custom navigation for unlisted board links (e.g. /qa/) and the 4chan Twitter link. #309

This commit is contained in:
ccd0 2015-02-03 01:26:35 -08:00
parent 8c17090b3d
commit aa1d2cda7f

View File

@ -220,16 +220,22 @@ Header =
boardID = t.split('-')[0]
boardID = g.BOARD.ID if boardID is 'current'
for aOrig in as
if aOrig.textContent is boardID
a = aOrig.cloneNode true
if !a
if /^current/.test t
a = $.el 'a',
href: "/#{boardID}/"
textContent: boardID
else
return $.tn t
a = do ->
if boardID is '@'
return $.el 'a',
href: 'https://twitter.com/4chan'
title: '4chan Twitter'
textContent: '@'
for a in as when a.textContent is boardID
return a.cloneNode true
a = $.el 'a',
href: "/#{boardID}/"
textContent: boardID
a.href += g.VIEW if g.VIEW in ['catalog', 'archive']
a.className = 'current' if boardID is g.BOARD.ID
a
a.textContent = if /-title/.test(t) or /-replace/.test(t) and boardID is g.BOARD.ID
a.title or a.textContent