From 4d9dae9095188988589ef8268099dcae637a8484 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Mon, 8 Jul 2019 18:30:10 -0700 Subject: [PATCH] Make bottom board list code work on Tinyboard/vichan sites. --- src/General/Header.coffee | 10 +++++----- src/css/style.css | 4 ++-- src/site/SW.tinyboard.coffee | 1 + src/site/SW.yotsuba.coffee | 1 + 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/General/Header.coffee b/src/General/Header.coffee index 77dd060a5..2d85fced2 100644 --- a/src/General/Header.coffee +++ b/src/General/Header.coffee @@ -95,7 +95,7 @@ Header = $.onExists doc, "#{Site.selectors.boardList} + *", Header.generateFullBoardList Main.ready -> - if not (footer = $.id 'boardNavDesktopFoot') + if Site.software is 'yotsuba' and not (footer = $.id 'boardNavDesktopFoot') return unless (absbot = $.id 'absbot') footer = $.id('boardNavDesktop').cloneNode true footer.id = 'boardNavDesktopFoot' @@ -103,10 +103,10 @@ Header = $('#settingsWindowLink', footer).id = 'settingsWindowLinkBot' $.before absbot, footer $.globalEval 'window.cloneTopNav = function() {};' - if (a = $ "a[href*='/#{g.BOARD}/']", footer) - a.className = 'current' - Header.bottomBoardList = $ '.boardList', footer - CatalogLinks.setLinks Header.bottomBoardList + if (Header.bottomBoardList = $ Site.selectors.boardListBottom) + for a in $$ 'a', Header.bottomBoardList + a.className = 'current' if a.hostname is location.hostname and a.pathname.split('/')[1] is g.BOARD.ID + CatalogLinks.setLinks Header.bottomBoardList if Site.software is 'yotsuba' and (g.VIEW is 'catalog' or !Conf['Disable Native Extension']) cs = $.el 'a', href: 'javascript:;' diff --git a/src/css/style.css b/src/css/style.css index 0ec463418..fcfb5e5c7 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -57,7 +57,7 @@ a[href="javascript:;"] { #boardNavDesktop, #boardNavMobile { display: none !important; } -:root.hide-bottom-board-list #boardNavDesktopFoot { +:root.hide-bottom-board-list $site$boardListBottom { display: none; } body.hasDropDownNav{ @@ -366,7 +366,7 @@ audio.controls-added { #toggleMsgBtn { display: none !important; } -.current { +#board-list .current { font-weight: bold; } @media (min-width: 1300px) { diff --git a/src/site/SW.tinyboard.coffee b/src/site/SW.tinyboard.coffee index 115603677..f6b33ab64 100644 --- a/src/site/SW.tinyboard.coffee +++ b/src/site/SW.tinyboard.coffee @@ -100,6 +100,7 @@ SW.tinyboard = spoiler: '.spoiler' quotelink: 'a[onclick^="highlightReply("]' boardList: '.boardlist' + boardListBottom: '.boardlist.bottom' styleSheet: '#stylesheet' xpath: diff --git a/src/site/SW.yotsuba.coffee b/src/site/SW.yotsuba.coffee index 02ca99659..5b6d16d04 100644 --- a/src/site/SW.yotsuba.coffee +++ b/src/site/SW.yotsuba.coffee @@ -48,6 +48,7 @@ SW.yotsuba = spoiler: 's' quotelink: ':not(pre) > .quotelink' # XXX https://github.com/4chan/4chan-JS/issues/77: 4chan currently creates quote links inside [code] tags; ignore them boardList: '#boardNavDesktop > .boardList' + boardListBottom: '#boardNavDesktopFoot > .boardList' styleSheet: 'link[title=switch]' xpath: