mirror of
https://github.com/huhu/rust-search-extension
synced 2024-11-14 23:57:07 +00:00
Fix docs.rs header css selector, add min-width for TOC
This commit is contained in:
parent
51f9c2f924
commit
2db365d90c
2 changed files with 3 additions and 2 deletions
|
@ -63,6 +63,7 @@ div.nav-container form.landing-search-form-nav {
|
||||||
border-left: solid #bbb 1px;
|
border-left: solid #bbb 1px;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
max-width: 320px;
|
max-width: 320px;
|
||||||
|
min-width: 120px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.rse-doc-toc-item {
|
.rse-doc-toc-item {
|
||||||
|
|
|
@ -11,7 +11,7 @@ let installedVersion = undefined;
|
||||||
|
|
||||||
// Highlight the TOC
|
// Highlight the TOC
|
||||||
function highlight() {
|
function highlight() {
|
||||||
let headers = Array.from(document.querySelectorAll("#main>.docblock>.section-header"))
|
let headers = Array.from(document.querySelectorAll("#main .docblock .section-header"))
|
||||||
.filter(header => ["H1", "H2", "H3"].includes(header.tagName));
|
.filter(header => ["H1", "H2", "H3"].includes(header.tagName));
|
||||||
const scrollHandler = entries => {
|
const scrollHandler = entries => {
|
||||||
entries.forEach(entry => {
|
entries.forEach(entry => {
|
||||||
|
@ -36,7 +36,7 @@ function highlight() {
|
||||||
|
|
||||||
// Show TOC of docs.rs
|
// Show TOC of docs.rs
|
||||||
document.addEventListener("DOMContentLoaded", () => {
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
let headers = Array.from(document.querySelectorAll("#main>.docblock>.section-header"))
|
let headers = Array.from(document.querySelectorAll("#main .docblock .section-header"))
|
||||||
.filter(header => ["H1", "H2", "H3"].includes(header.tagName));
|
.filter(header => ["H1", "H2", "H3"].includes(header.tagName));
|
||||||
if (!headers || headers.length < 3) {
|
if (!headers || headers.length < 3) {
|
||||||
// Don't show TOC if headers less than 3.
|
// Don't show TOC if headers less than 3.
|
||||||
|
|
Loading…
Reference in a new issue