mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Require single quotes
This commit is contained in:
@ -3,9 +3,9 @@
|
||||
*/
|
||||
async function searchSettings() {
|
||||
removeHighlighting(); // Remove previous highlights
|
||||
const searchString = String($("#settingsSearch").val());
|
||||
const searchableText = $("#user-settings-block-content"); // Get the HTML block
|
||||
if (searchString.trim() !== "") {
|
||||
const searchString = String($('#settingsSearch').val());
|
||||
const searchableText = $('#user-settings-block-content'); // Get the HTML block
|
||||
if (searchString.trim() !== '') {
|
||||
highlightMatchingElements(searchableText[0], searchString); // Highlight matching elements
|
||||
}
|
||||
}
|
||||
@ -29,14 +29,14 @@ function highlightMatchingElements(element, searchString) {
|
||||
const isTextNode = this.nodeType === Node.TEXT_NODE;
|
||||
const isElementNode = this.nodeType === Node.ELEMENT_NODE;
|
||||
|
||||
if (isTextNode && this.nodeValue.trim() !== "" && !isParentHeader(this)) {
|
||||
if (isTextNode && this.nodeValue.trim() !== '' && !isParentHeader(this)) {
|
||||
const parentElement = $(this).parent();
|
||||
const elementText = this.nodeValue;
|
||||
|
||||
if (elementText.toLowerCase().includes(searchString.toLowerCase())) {
|
||||
parentElement.addClass('highlighted'); // Add CSS class to highlight matched elements
|
||||
}
|
||||
} else if (isElementNode && !$(this).is("h4")) {
|
||||
} else if (isElementNode && !$(this).is('h4')) {
|
||||
highlightMatchingElements(this, searchString);
|
||||
}
|
||||
});
|
||||
@ -46,7 +46,7 @@ function highlightMatchingElements(element, searchString) {
|
||||
* Remove highlighting from previously highlighted elements.
|
||||
*/
|
||||
function removeHighlighting() {
|
||||
$(".highlighted").removeClass("highlighted"); // Remove CSS class from previously highlighted elements
|
||||
$('.highlighted').removeClass('highlighted'); // Remove CSS class from previously highlighted elements
|
||||
}
|
||||
|
||||
jQuery(() => {
|
||||
|
Reference in New Issue
Block a user