Debounce Character and Persona search

This commit is contained in:
Wolfsblvt 2024-04-28 06:27:55 +02:00
parent d7ade487b8
commit 61e2877c4b
2 changed files with 12 additions and 6 deletions

View File

@ -8668,14 +8668,20 @@ jQuery(async function () {
$(document).on('click', '.swipe_left', swipe_left);
const debouncedCharacterSearch = debounce((searchQuery) => {
entitiesFilter.setFilterData(FILTER_TYPES.SEARCH, searchQuery);
});
$('#character_search_bar').on('input', function () {
const searchValue = String($(this).val()).toLowerCase();
entitiesFilter.setFilterData(FILTER_TYPES.SEARCH, searchValue);
const searchQuery = String($(this).val()).toLowerCase();
debouncedCharacterSearch(searchQuery);
});
const debouncedPersonaSearch = debounce((searchQuery) => {
personasFilter.setFilterData(FILTER_TYPES.PERSONA_SEARCH, searchQuery);
});
$('#persona_search_bar').on('input', function () {
const searchValue = String($(this).val()).toLowerCase();
personasFilter.setFilterData(FILTER_TYPES.PERSONA_SEARCH, searchValue);
const searchQuery = String($(this).val()).toLowerCase();
debouncedPersonaSearch(searchQuery);
});
$('#mes_continue').on('click', function () {

View File

@ -3038,12 +3038,12 @@ jQuery(() => {
}
});
const debouncedWISearch = debounce((searchQuery) => {
const debouncedWorldInfoSearch = debounce((searchQuery) => {
worldInfoFilter.setFilterData(FILTER_TYPES.WORLD_INFO_SEARCH, searchQuery);
});
$('#world_info_search').on('input', function () {
const searchQuery = $(this).val();
debouncedWISearch(searchQuery);
debouncedWorldInfoSearch(searchQuery);
});
$('#world_refresh').on('click', () => {