mirror of
https://github.com/imfing/hextra.git
synced 2025-08-23 12:46:39 -04:00
fix: search colors (#752)
This commit is contained in:

committed by
GitHub

parent
776c758825
commit
80ada64da0
@@ -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');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user