Remove search highlights from the page and the history

Co-authored-by: the-sink <lucianedean@gmail.com>
This commit is contained in:
Yuri Sizov
2022-11-21 22:13:24 +03:00
parent 754f30d355
commit 0209919fc2
3 changed files with 20 additions and 3 deletions

View File

@@ -1090,12 +1090,21 @@ kbd.compound > .kbd,
background-color: var(--navbar-current-background-color-active);
}
/* Hide the obnoxious automatic highlight in search results */
/* Hide the obnoxious automatic highlight from the search context. */
.rst-content .highlighted {
background-color: transparent;
box-shadow: none;
font-weight: inherit;
padding: 0;
}
/* Still slightly highlight matched parts on the dedicated search results page. */
.rst-content #search-results .highlighted {
background-color: #ffcd0029;
border-radius: 2px;
color: var(--body-color);
font-weight: 600;
padding: 0 3px;
}
/* Allows the scrollbar to be shown in the sidebar */
@media only screen and (min-width: 769px) {

View File

@@ -233,6 +233,14 @@ const registerSidebarObserver = (function(){
})();
$(document).ready(() => {
// Remove the search match highlights from the page, and adjust the URL in the
// navigation history.
const url = new URL(location.href);
if (url.searchParams.has('highlight')) {
Documentation.hideSearchWords();
}
// Initialize handlers for page scrolling and our custom sidebar.
const mediaQuery = window.matchMedia('only screen and (min-width: 769px)');
registerOnScrollEvent(mediaQuery);