fix: search colors (#752)

This commit is contained in:
Ludovic Fernandez
2025-08-15 02:57:18 +02:00
committed by GitHub
parent 776c758825
commit 80ada64da0

View File

@@ -392,7 +392,7 @@ document.addEventListener("DOMContentLoaded", function () {
function highlightMatches(text, query) { function highlightMatches(text, query) {
const escapedQuery = query.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&'); const escapedQuery = query.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&');
const regex = new RegExp(escapedQuery, 'gi'); const regex = new RegExp(escapedQuery, 'gi');
return text.replace(regex, (match) => `<span class="match">${match}</span>`); return text.replace(regex, (match) => `<span class="hextra-search-match">${match}</span>`);
} }
// Create a DOM element from the HTML string. // Create a DOM element from the HTML string.
@@ -405,11 +405,11 @@ document.addEventListener("DOMContentLoaded", function () {
function handleMouseMove(e) { function handleMouseMove(e) {
const target = e.target.closest('a'); const target = e.target.closest('a');
if (target) { if (target) {
const active = resultsElement.querySelector('a.active'); const active = resultsElement.querySelector('a.hextra-search-active');
if (active) { if (active) {
active.classList.remove('active'); active.classList.remove('hextra-search-active');
} }
target.classList.add('active'); target.classList.add('hextra-search-active');
} }
} }