From d1792f8d590be3c9c4a64b07d6ada7f58832c93d Mon Sep 17 00:00:00 2001 From: simov Date: Sat, 4 Jan 2020 13:09:55 +0200 Subject: [PATCH] Use css class for headers in toc --- content/index.css | 6 +++--- content/index.js | 4 ++-- test/popup-options.js | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/content/index.css b/content/index.css index 8ef653a..9a3ef0e 100644 --- a/content/index.css +++ b/content/index.css @@ -68,11 +68,11 @@ body._toc-right { padding-right: 300px !important; } overflow-y: auto; overflow-x: hidden; } -#_toc #_ul { +#_toc ._ul { padding: 0 0 0 20px !important; margin: 0 !important; } -#_toc #_ul a { +#_toc ._ul a { font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif !important; font-size: 14px !important; line-height: 17px !important; @@ -87,7 +87,7 @@ body._toc-right { padding-right: 300px !important; } padding: 10px 15px !important; display: block !important; } -#_toc #_ul a:hover { +#_toc ._ul a:hover { text-decoration: underline !important; } diff --git a/content/index.js b/content/index.js index a4e41f7..bbf042f 100644 --- a/content/index.js +++ b/content/index.js @@ -180,11 +180,11 @@ var toc = ( title: node.innerText })) .reduce((html, header) => { - html += '
'.repeat(header.level) + html += '
'.repeat(header.level) html += link(header) html += '
'.repeat(header.level) return html - }, '
') + '
' + }, '
') + '
' if (document.readyState === 'complete') { mount() diff --git a/test/popup-options.js b/test/popup-options.js index 08edca0..06f7e26 100644 --- a/test/popup-options.js +++ b/test/popup-options.js @@ -387,7 +387,7 @@ module.exports = ({popup, advanced, content}) => { t.deepStrictEqual( await content.evaluate(() => - Array.from(document.querySelectorAll('#_toc #_ul a')) + Array.from(document.querySelectorAll('#_toc ._ul a')) .map((a) => ({href: a.getAttribute('href'), text: a.innerText})) ), [