mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
added
- swipes library - CSS for mobile, - swipe left/right on last msg to regenerate
This commit is contained in:
@@ -15,7 +15,8 @@ import {
|
||||
api_server,
|
||||
api_key_novel,
|
||||
getCharacters,
|
||||
is_send_press
|
||||
is_send_press,
|
||||
chat
|
||||
} from "../script.js";
|
||||
|
||||
var NavToggle = document.getElementById("nav-toggle");
|
||||
@@ -339,6 +340,37 @@ $("document").ready(function () {
|
||||
(this.scrollHeight) + 'px';
|
||||
});
|
||||
|
||||
//Regenerate if user swipes on the last mesage in chat
|
||||
//TODO:
|
||||
//1. Make it detect if the last message is from user, and ignore swipes then...
|
||||
//2. find a way to make the chat slide down smoothly when the last mes div gets .remove()-d
|
||||
|
||||
document.addEventListener('swiped-left', function(e) {
|
||||
var SwipeTargetMesClassParent = e.target.closest('.mes');
|
||||
if (is_send_press == false){
|
||||
if (SwipeTargetMesClassParent !== null && SwipeTargetMesClassParent.nextSibling == null ){
|
||||
$('#chat').children().last().css({'transition':'all 0.5s ease-in-out'});
|
||||
$('#chat').children().last().css({'transform':'translateX(-100vw) scale(0,0)','overflow':'hidden'});
|
||||
$('#chat').children().last().css({'opacity':'0'});
|
||||
|
||||
Generate('regenerate');
|
||||
}
|
||||
}
|
||||
});
|
||||
document.addEventListener('swiped-right', function(e) {
|
||||
var SwipeTargetMesClassParent = e.target.closest('.mes');
|
||||
console.log(is_send_press);
|
||||
if (is_send_press === false){
|
||||
if (SwipeTargetMesClassParent !== null && SwipeTargetMesClassParent.nextSibling == null){
|
||||
$('#chat').children().last().css({'transition':'all 0.5s ease-in-out'});
|
||||
$('#chat').children().last().css({'transform':'translateX(100vh) scale(0,0)','overflow':'hidden'});
|
||||
$('#chat').children().last().css({'opacity':'0'});
|
||||
Generate('regenerate');
|
||||
console.log(is_send_press);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//Additional hotkeys CTRL+ENTER and CTRL+UPARROW
|
||||
document.addEventListener("keydown", (event) => {
|
||||
if (event.ctrlKey && event.key == "Enter") {
|
||||
|
Reference in New Issue
Block a user