mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
- made right swipe highlight when next swipe will generate
- added a swipe counter below right swipe (could add a toggle for displaying it later) - removed spammy console.logs from expressions index.js - swipes no longer trigger under the following conditions: - - when an input it focused - - when character_popup or history popup are visible - - when send_textarea has something typed into it (I think this a bit too restrictive, may seek a smarter way to handle it) ISSUE: Pyg repeating gens cause swipes animation to lag/freeze not sure what is the cause, but should seek to remedy somehow.
This commit is contained in:
@@ -294,6 +294,10 @@ $("document").ready(function () {
|
||||
}
|
||||
});
|
||||
|
||||
function isInputElementInFocus() {
|
||||
return $(document.activeElement).is(":input");
|
||||
}
|
||||
|
||||
//Additional hotkeys CTRL+ENTER and CTRL+UPARROW
|
||||
document.addEventListener("keydown", (event) => {
|
||||
if (event.ctrlKey && event.key == "Enter") {
|
||||
@@ -316,11 +320,36 @@ $("document").ready(function () {
|
||||
ClearLocal();
|
||||
}
|
||||
if (event.key == "ArrowLeft") { //swipes left
|
||||
$('.swipe_left:last').click();
|
||||
}
|
||||
if (event.key == "ArrowRight") { //swipes right
|
||||
$('.swipe_right:last').click();
|
||||
}
|
||||
});
|
||||
/* console.log('SWIPE FILTER -- ' +
|
||||
$("#send_textarea").val() + ' ' +
|
||||
$("#character_popup").css("display") + ' ' +
|
||||
$("#shadow_select_chat_popup").css("display") + ' ' +
|
||||
isInputElementInFocus()); */
|
||||
|
||||
})
|
||||
if (
|
||||
$("#send_textarea").val() === '' &&
|
||||
$("#character_popup").css("display") === "none" &&
|
||||
$("#shadow_select_chat_popup").css("display") === "none" &&
|
||||
!isInputElementInFocus()
|
||||
) {
|
||||
$('.swipe_left:last').click();
|
||||
}
|
||||
}
|
||||
if (event.key == "ArrowRight") { //swipes right
|
||||
/* console.log('SWIPE FILTER -- ' +
|
||||
$("#send_textarea").val() + ' ' +
|
||||
$("#character_popup").css("display") + ' ' +
|
||||
$("#shadow_select_chat_popup").css("display") + ' ' +
|
||||
isInputElementInFocus()); */
|
||||
|
||||
if (
|
||||
$("#send_textarea").val() === '' &&
|
||||
$("#character_popup").css("display") === "none" &&
|
||||
$("#shadow_select_chat_popup").css("display") === "none" &&
|
||||
!isInputElementInFocus()
|
||||
) {
|
||||
$('.swipe_right:last').click();
|
||||
}
|
||||
};
|
||||
})
|
||||
});
|
||||
|
Reference in New Issue
Block a user