Require single quotes

This commit is contained in:
valadaptive
2023-12-02 13:04:51 -05:00
parent a06f1e8ad6
commit a37f874e38
76 changed files with 4135 additions and 4134 deletions

View File

@ -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(() => {