From 755a51209d31ed3cf1bf484ef5f9f7bd7545e016 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 25 Oct 2014 13:51:45 -0700 Subject: [PATCH] Convert text in full board list to elements. --- src/General/Header.coffee | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/General/Header.coffee b/src/General/Header.coffee index 26bae4067..7c31d9ceb 100755 --- a/src/General/Header.coffee +++ b/src/General/Header.coffee @@ -127,25 +127,36 @@ Header = id: 'scroll-marker' setBoardList: -> - fourchannav = $.id 'boardNavDesktop' Header.boardList = boardList = $.el 'span', id: 'board-list' $.extend boardList, <%= html( '' + '' ) %> - for a in $$ 'a', boardList - if a.pathname.split('/')[1] is g.BOARD.ID - a.className = 'current' - fullBoardList = $ '#full-board-list', boardList - btn = $ '.hide-board-list-button', fullBoardList + + btn = $('.hide-board-list-button', boardList) $.on btn, 'click', Header.toggleBoardList - $.rm $ '#navtopright', fullBoardList - $.add boardList, fullBoardList + nodes = [] + spacer = -> $.el 'span', className: 'spacer' + for node in $('#boardNavDesktop > .boardList').childNodes + switch node.nodeName + when '#text' + for c in node.nodeValue + span = $.el 'span', textContent: c + span.className = 'space' if c is ' ' + nodes.push spacer() if c is ']' + nodes.push span + nodes.push spacer() if c is '[' + when 'A' + a = node.cloneNode true + a.className = 'current' if a.pathname.split('/')[1] is g.BOARD.ID + nodes.push a + $.add $('.boardList', boardList), nodes + $.add Header.bar, [Header.boardList, Header.shortcuts, Header.noticesRoot, Header.toggle] Header.setCustomNav Conf['Custom Board Navigation']