Proper manual input debounce

This commit is contained in:
Cohee 2023-11-12 23:28:34 +02:00
parent 8fd5a5886b
commit 6c02a12e88
1 changed files with 5 additions and 2 deletions

View File

@ -9104,8 +9104,11 @@ jQuery(async function () {
}
});
let manualInputTimeout;
$(document).on('input', '.range-block-counter input, .neo-range-input', function () {
setTimeout(() => {
clearTimeout(manualInputTimeout);
manualInputTimeout = setTimeout(() => {
const caretPosition = saveCaretPosition($(this).get(0));
const myText = $(this).val().trim();
$(this).val(myText); // trim line breaks and spaces
@ -9171,7 +9174,7 @@ jQuery(async function () {
restoreCaretPosition($(this).get(0), caretPosition);
}, 2000);
})
});
$(".user_stats_button").on('click', function () {
userStatsHandler();