From 3eb7dadd65001c8ab48e834b692fb7a66e9e3daa Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 25 Oct 2014 23:05:04 -0700 Subject: [PATCH] Don't interpret -options in text/URLs. --- src/General/Header.coffee | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/General/Header.coffee b/src/General/Header.coffee index 7a52e545f..f0703b32b 100755 --- a/src/General/Header.coffee +++ b/src/General/Header.coffee @@ -160,30 +160,36 @@ Header = $.add Header.bar, [Header.boardList, Header.shortcuts, Header.noticesRoot, Header.toggle] Header.setCustomNav Conf['Custom Board Navigation'] - Header.generateBoardList Conf['boardnav'].replace /(\r\n|\n|\r)/g, ' ' + Header.generateBoardList Conf['boardnav'] $.sync 'Custom Board Navigation', Header.setCustomNav $.sync 'boardnav', Header.generateBoardList - generateBoardList: (text) -> + generateBoardList: (boardnav) -> list = $ '#custom-board-list', Header.boardList $.rmAll list - return unless text + return unless boardnav + boardnav = boardnav.replace /(\r\n|\n|\r)/g, ' ' as = $$ '#full-board-list a[title]', Header.boardList - nodes = text.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|text:"[^"]+"(,"[^"]+")?))*|[^\w@]+/g).map (t) -> if /^[^\w@]/.test t return $.tn t + text = url = null + t = t.replace /-text:"([^"]+)"(?:,"([^"]+)")?/g, (m0, m1, m2) -> + text = m1 + url = m2 + '' if /^toggle-all/.test t a = $.el 'a', className: 'show-board-list-button' - textContent: (t.match(/-text:"(.+)"/) || [null, '+'])[1] + textContent: text or '+' href: 'javascript:;' $.on a, 'click', Header.toggleBoardList return a if /^external/.test t a = $.el 'a', - href: (t.match(/\,"(.+)"/) || [null, '+'])[1] - textContent: (t.match(/-text:"(.+)"\,/) || [null, '+'])[1] + href: url or 'javascript:;' + textContent: text or '+' className: 'external' return a boardID = if /^current/.test t @@ -198,8 +204,8 @@ Header = a.title else if /-full/.test t "/#{boardID}/ - #{a.title}" - else if m = t.match /-text:"(.+)"/ - m[1] + else if text + text else a.textContent