diff --git a/src/General/Header.coffee b/src/General/Header.coffee index 79235d72c..be9f7b804 100644 --- a/src/General/Header.coffee +++ b/src/General/Header.coffee @@ -165,25 +165,14 @@ Header = $.sync 'boardnav', Header.generateBoardList generateFullBoardList: -> - nodes = [] - spacer = -> $.el 'span', className: 'spacer' - items = $.X './/a|.//text()[not(ancestor::a)]', $(g.SITE.selectors.boardList) - i = 0 - while node = items.snapshotItem i++ - switch node.nodeName - when '#text' - for chr in node.nodeValue - span = $.el 'span', textContent: chr - span.className = 'space' if chr is ' ' - nodes.push spacer() if chr is ']' - nodes.push span - nodes.push spacer() if chr is '[' - when 'A' - a = node.cloneNode true - a.className = 'current' if a.hostname is location.hostname and a.pathname.split('/')[1] is g.BOARD.ID - nodes.push a + if g.SITE.transformBoardList + nodes = g.SITE.transformBoardList() + else + nodes = [$(g.SITE.selectors.boardList).cloneNode(true).childNodes...] fullBoardList = $ '.boardList', Header.boardList $.add fullBoardList, nodes + for a in $$ 'a', fullBoardList + a.className = 'current' if a.hostname is location.hostname and a.pathname.split('/')[1] is g.BOARD.ID CatalogLinks.setLinks fullBoardList generateBoardList: (boardnav) -> diff --git a/src/css/style.css b/src/css/style.css index 021555423..0e186fd42 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -379,52 +379,52 @@ audio.controls-added { font-weight: bold; } @media (min-width: 1300px) { - :root.fixed:not(.centered-links) #header-bar { + :root.sw-yotsuba.fixed:not(.centered-links) #header-bar { white-space: nowrap; display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; } - :root.fixed:not(.centered-links) #board-list { + :root.sw-yotsuba.fixed:not(.centered-links) #board-list { -webkit-flex: auto; flex: auto; } - :root.fixed:not(.centered-links) #full-board-list { + :root.sw-yotsuba.fixed:not(.centered-links) #full-board-list { display: -webkit-flex; display: flex; } - :root.fixed:not(.centered-links) .hide-board-list-container { + :root.sw-yotsuba.fixed:not(.centered-links) .hide-board-list-container { -webkit-flex: none; flex: none; margin-right: 5px; } - :root.fixed:not(.centered-links) #full-board-list > .boardList { + :root.sw-yotsuba.fixed:not(.centered-links) #full-board-list > .boardList { -webkit-flex: auto; flex: auto; display: -webkit-flex; display: flex; width: 0px; /* XXX Fixes Edge not shrinking the board list below default size when needed */ } - :root.fixed:not(.centered-links) #full-board-list > .boardList > a, - :root.fixed:not(.centered-links) #full-board-list > .boardList > span:not(.space):not(.spacer) { + :root.sw-yotsuba.fixed:not(.centered-links) #full-board-list > .boardList > a, + :root.sw-yotsuba.fixed:not(.centered-links) #full-board-list > .boardList > span:not(.space):not(.spacer) { -webkit-flex: none; flex: none; padding: .17em; margin: -.17em -.32em; } - :root.fixed:not(.centered-links) #full-board-list > .boardList > span { + :root.sw-yotsuba.fixed:not(.centered-links) #full-board-list > .boardList > span { pointer-events: none; } - :root.fixed:not(.centered-links) #full-board-list > .boardList > span.space { + :root.sw-yotsuba.fixed:not(.centered-links) #full-board-list > .boardList > span.space { -webkit-flex: 0 .63 .63em; flex: 0 .63 .63em; } - :root.fixed:not(.centered-links) #full-board-list > .boardList > span.spacer { + :root.sw-yotsuba.fixed:not(.centered-links) #full-board-list > .boardList > span.spacer { -webkit-flex: 0 .38 .38em; flex: 0 .38 .38em; } - :root.fixed:not(.centered-links) #shortcuts { + :root.sw-yotsuba.fixed:not(.centered-links) #shortcuts { float: initial; -webkit-flex: none; flex: none; diff --git a/src/site/SW.yotsuba.coffee b/src/site/SW.yotsuba.coffee index a6939b4c1..9fb99ecb2 100644 --- a/src/site/SW.yotsuba.coffee +++ b/src/site/SW.yotsuba.coffee @@ -239,3 +239,22 @@ SW.yotsuba = testNativeExtension: -> $.global -> @enabled = 'true' if window.Parser.postMenuIcon + + transformBoardList: -> + nodes = [] + spacer = -> $.el 'span', className: 'spacer' + items = $.X './/a|.//text()[not(ancestor::a)]', $(SW.yotsuba.selectors.boardList) + i = 0 + while node = items.snapshotItem i++ + switch node.nodeName + when '#text' + for chr in node.nodeValue + span = $.el 'span', textContent: chr + span.className = 'space' if chr is ' ' + nodes.push spacer() if chr is ']' + nodes.push span + nodes.push spacer() if chr is '[' + when 'A' + a = node.cloneNode true + nodes.push a + return nodes