Skip to content

Commit

Permalink
Improve search result responsiveness
Browse files Browse the repository at this point in the history
  • Loading branch information
Foereaper committed Sep 26, 2024
1 parent 2b85ea2 commit 21c0b24
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 29 deletions.
38 changes: 16 additions & 22 deletions docs/ElunaDoc/static/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -274,7 +274,7 @@ nav.sub {
}

.block a:hover {
background: var(--clr-light-codebox);
background: var(--clr-light-element-highlight);
}

.content {
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand All @@ -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);
}
Expand All @@ -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;
Expand Down
7 changes: 0 additions & 7 deletions docs/ElunaDoc/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 21c0b24

Please sign in to comment.