From 21c0b249a3d1f7e051c3c9492ef14465452c26bb Mon Sep 17 00:00:00 2001 From: Foereaper Date: Thu, 26 Sep 2024 21:23:40 +0200 Subject: [PATCH] Improve search result responsiveness --- docs/ElunaDoc/static/main.css | 38 +++++++++++++++-------------------- docs/ElunaDoc/static/main.js | 7 ------- 2 files changed, 16 insertions(+), 29 deletions(-) diff --git a/docs/ElunaDoc/static/main.css b/docs/ElunaDoc/static/main.css index 25a669ea88..8b5bd0828b 100644 --- a/docs/ElunaDoc/static/main.css +++ b/docs/ElunaDoc/static/main.css @@ -67,7 +67,7 @@ --clr-light-main: #fff; --clr-light-searchbox-back: #fff; --clr-light-searchbox-text: #555; - --clr-light-codebox: #F5F5F5; + --clr-light-element-highlight: #F5F5F5; --clr-light-current-selection: #8c6067; --clr-light-table-border: #ddd; --clr-light-table-header: #f5f5f5; @@ -77,7 +77,7 @@ --clr-dark-main: #333; --clr-dark-searchbox-back: #2f2f2f; --clr-dark-searchbox-text: #fff; - --clr-dark-codebox: #2f2f2f; + --clr-dark-element-highlight: #2d2d2d; --clr-dark-current-selection: #4d76ae; --clr-dark-table: #2f2f2f; --clr-dark-table-border: #444; @@ -157,13 +157,13 @@ code, pre { } .docblock code { - background-color: var(--clr-light-codebox); + background-color: var(--clr-light-element-highlight); border-radius: 4px; transition: background-color 0.3s; } pre { - background-color: var(--clr-light-codebox); + background-color: var(--clr-light-element-highlight); padding: 14px; } @@ -274,7 +274,7 @@ nav.sub { } .block a:hover { - background: var(--clr-light-codebox); + background: var(--clr-light-element-highlight); } .content { @@ -292,18 +292,6 @@ nav.sub { background-color: #f6fdb0; } -.content .highlighted { - cursor: pointer; - color: #000 !important; - background-color: #ccc; -} -.content .highlighted a { color: #000 !important; } -.content .highlighted.trait { background-color: #fece7e; } -.content .highlighted.mod { background-color: #afc6e4; } -.content .highlighted.enum { background-color: #b4d1b9; } -.content .highlighted.struct { background-color: #e7b1a0; } -.content .highlighted.fn { background-color: var(--clr-light-content-highlight); } - .docblock.short.nowrap { display: block; overflow: hidden; @@ -448,6 +436,10 @@ p a:hover { text-decoration: underline; } display: block; } +tr.result:hover { + background-color: var(--clr-light-element-highlight); +} + .toggle-container { margin: auto; text-align: center; @@ -595,11 +587,11 @@ pre.rust { position: relative; } } .dark-mode .docblock code { - background-color: var(--clr-dark-codebox); + background-color: var(--clr-dark-element-highlight); } .dark-mode pre { - background-color: var(--clr-dark-codebox); + background-color: var(--clr-dark-element-highlight); } .dark-mode .docblock table { @@ -620,11 +612,9 @@ pre.rust { position: relative; } } .dark-mode .block a:hover { - background: var(--clr-dark-codebox); + background: var(--clr-dark-element-highlight); } -.dark-mode .content .highlighted.fn { background-color: var(--clr-dark-content-highlight); } - .dark-mode a { color: var(--clr-light-main); } @@ -641,6 +631,10 @@ pre.rust { position: relative; } background-color: var(--clr-dark-searchbox-back); } +.dark-mode tr.result:hover { + background-color: var(--clr-dark-element-highlight); +} + .sun-icon, .moon-icon { width: 24px; height: 24px; diff --git a/docs/ElunaDoc/static/main.js b/docs/ElunaDoc/static/main.js index cb3f4bfc94..c2fb62ef3d 100644 --- a/docs/ElunaDoc/static/main.js +++ b/docs/ElunaDoc/static/main.js @@ -396,13 +396,6 @@ $('#main').removeClass('hidden'); } document.location.href = dst.href; - }).on('mouseover', function() { - var $el = $(this); - clearTimeout(hoverTimeout); - hoverTimeout = setTimeout(function() { - $results.removeClass('highlighted'); - $el.addClass('highlighted'); - }, 20); }); $(document).off('keydown.searchnav');