mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
- fixed touch swipe detection
- removed unnecessary hideswipebuttons calls - restyled swipe buttons to display flex
This commit is contained in:
@ -2709,7 +2709,7 @@ function showSwipeButtons() {
|
|||||||
if (swipeId !== undefined && swipeId != 0) {
|
if (swipeId !== undefined && swipeId != 0) {
|
||||||
currentMessage.children('.swipe_left').css('display', 'flex');
|
currentMessage.children('.swipe_left').css('display', 'flex');
|
||||||
}
|
}
|
||||||
if (is_send_press === false || chat[chat.length - 1].swipes.length > swipeId) { //only show right when generate is off, or when next right swipe would not make a generate happen
|
if (is_send_press === false || chat[chat.length - 1].swipes.length >= swipeId) { //only show right when generate is off, or when next right swipe would not make a generate happen
|
||||||
currentMessage.children('.swipe_right').css('display', 'flex');
|
currentMessage.children('.swipe_right').css('display', 'flex');
|
||||||
currentMessage.children('.swipe_right').css('opacity', '0.3');
|
currentMessage.children('.swipe_right').css('opacity', '0.3');
|
||||||
}
|
}
|
||||||
@ -3024,7 +3024,7 @@ $(document).ready(function () {
|
|||||||
});
|
});
|
||||||
$("#send_but").click(function () {
|
$("#send_but").click(function () {
|
||||||
if (is_send_press == false) {
|
if (is_send_press == false) {
|
||||||
hideSwipeButtons();
|
//hideSwipeButtons();
|
||||||
is_send_press = true;
|
is_send_press = true;
|
||||||
|
|
||||||
Generate();
|
Generate();
|
||||||
@ -3040,7 +3040,7 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
$("#send_textarea").keydown(function (e) {
|
$("#send_textarea").keydown(function (e) {
|
||||||
if (!e.shiftKey && !e.ctrlKey && e.key == "Enter" && is_send_press == false) {
|
if (!e.shiftKey && !e.ctrlKey && e.key == "Enter" && is_send_press == false) {
|
||||||
hideSwipeButtons();
|
//hideSwipeButtons();
|
||||||
is_send_press = true;
|
is_send_press = true;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
Generate();
|
Generate();
|
||||||
@ -3667,7 +3667,7 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
else if (id == "option_regenerate") {
|
else if (id == "option_regenerate") {
|
||||||
if (is_send_press == false) {
|
if (is_send_press == false) {
|
||||||
hideSwipeButtons();
|
//hideSwipeButtons();
|
||||||
is_send_press = true;
|
is_send_press = true;
|
||||||
Generate("regenerate");
|
Generate("regenerate");
|
||||||
}
|
}
|
||||||
|
@ -279,7 +279,8 @@ $("document").ready(function () {
|
|||||||
var SwipeButR = $('.swipe_right:last');
|
var SwipeButR = $('.swipe_right:last');
|
||||||
var SwipeTargetMesClassParent = e.target.closest('.last_mes');
|
var SwipeTargetMesClassParent = e.target.closest('.last_mes');
|
||||||
if (SwipeTargetMesClassParent !== null) {
|
if (SwipeTargetMesClassParent !== null) {
|
||||||
if (SwipeButR.attr('style') == 'display: flex;' == true) {
|
if (SwipeButR.css('display') === 'flex') {
|
||||||
|
//if (SwipeButR.attr('style') == 'display: flex;' == true) {
|
||||||
SwipeButR.click();
|
SwipeButR.click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -287,8 +288,10 @@ $("document").ready(function () {
|
|||||||
document.addEventListener('swiped-right', function (e) {
|
document.addEventListener('swiped-right', function (e) {
|
||||||
var SwipeButL = $('.swipe_left:last');
|
var SwipeButL = $('.swipe_left:last');
|
||||||
var SwipeTargetMesClassParent = e.target.closest('.last_mes');
|
var SwipeTargetMesClassParent = e.target.closest('.last_mes');
|
||||||
|
//console.log('Touch swipe check -- closest last_mes = "' + (SwipeTargetMesClassParent !== null) + ' Button display = ' + (SwipeButL.attr('style') == 'display: flex;' == true));
|
||||||
if (SwipeTargetMesClassParent !== null) {
|
if (SwipeTargetMesClassParent !== null) {
|
||||||
if (SwipeButL.attr('style') == 'display: flex;' == true) {
|
if (SwipeButL.css('display') === 'flex') {
|
||||||
|
//if (SwipeButL.attr('style') == 'display: flex;' == true) {
|
||||||
SwipeButL.click();
|
SwipeButL.click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -363,34 +363,33 @@ code {
|
|||||||
/* SWIPE RELATED STYLES*/
|
/* SWIPE RELATED STYLES*/
|
||||||
|
|
||||||
.swipe_right,.swipe_left {
|
.swipe_right,.swipe_left {
|
||||||
height: 30px;
|
height: 40px;
|
||||||
width: 30px;
|
width: 40px;
|
||||||
opacity: 0.36;
|
opacity: 0.36;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 15px;
|
right: 15px;
|
||||||
margin-top: 62px;
|
margin-top: 60px;
|
||||||
left: auto;
|
left: auto;
|
||||||
background-color: var(--black50a);
|
background-color: var(--black50a);
|
||||||
padding: 20px;
|
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
/* display: none; */
|
|
||||||
border: 1px solid grey;
|
border: 1px solid grey;
|
||||||
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.swipe_right img, .swipe_left img {
|
.swipe_right img, .swipe_left img {
|
||||||
height: 30px;
|
height: 30px;
|
||||||
|
display: flex;
|
||||||
width: 30px;
|
width: 30px;
|
||||||
}
|
}
|
||||||
.swipes-counter{
|
.swipes-counter{
|
||||||
display: inline;
|
display: flex;
|
||||||
height: 15px;
|
color: white;
|
||||||
width: 30px;
|
position: fixed;
|
||||||
color: white;
|
font-size: 12px;
|
||||||
position: fixed;
|
padding: 0;
|
||||||
border: 1px solid red;
|
margin-top: 60px;
|
||||||
font-size: 12px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.swipe_left {
|
.swipe_left {
|
||||||
@ -2631,7 +2630,9 @@ a {
|
|||||||
min-width: 33%;
|
min-width: 33%;
|
||||||
}
|
}
|
||||||
/*for debug purposes*/
|
/*for debug purposes*/
|
||||||
/** {border: 1px solid purple;}*/
|
/*
|
||||||
|
* {border: 1px solid purple;}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
|
Reference in New Issue
Block a user