mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Fix swipes counter on old chats. Remove force height on last message
This commit is contained in:
@@ -2677,12 +2677,23 @@ function read_bg_load(input) {
|
|||||||
|
|
||||||
function showSwipeButtons() {
|
function showSwipeButtons() {
|
||||||
if (
|
if (
|
||||||
chat[chat.length - 1].name === 'TavernAI' ||
|
chat[chat.length - 1].is_system ||
|
||||||
!swipes ||
|
!swipes ||
|
||||||
$('.mes:last').attr('mesid') <= 0 ||
|
$('.mes:last').attr('mesid') <= 0 ||
|
||||||
chat[chat.length - 1].is_user ||
|
chat[chat.length - 1].is_user ||
|
||||||
count_view_mes <= 1
|
count_view_mes <= 1
|
||||||
) { return; }
|
) { return; }
|
||||||
|
|
||||||
|
//had to add this to make the swipe counter work
|
||||||
|
//(copied from the onclick functions for swipe buttons..
|
||||||
|
//don't know why the array isn't set for non-swipe messsages in Generate or addOneMessage..)
|
||||||
|
|
||||||
|
if (chat[chat.length - 1]['swipe_id'] === undefined) { // if there is no swipe-message in the last spot of the chat array
|
||||||
|
chat[chat.length - 1]['swipe_id'] = 0; // set it to id 0
|
||||||
|
chat[chat.length - 1]['swipes'] = []; // empty the array
|
||||||
|
chat[chat.length - 1]['swipes'][0] = chat[chat.length - 1]['mes']; //assign swipe array with last message from chat
|
||||||
|
}
|
||||||
|
|
||||||
const currentMessage = $("#chat").children().filter(`[mesid="${count_view_mes - 1}"]`);
|
const currentMessage = $("#chat").children().filter(`[mesid="${count_view_mes - 1}"]`);
|
||||||
const swipeId = chat[chat.length - 1].swipe_id;
|
const swipeId = chat[chat.length - 1].swipe_id;
|
||||||
var swipesCounterHTML = (`${(swipeId + 1)}/${(chat[chat.length - 1].swipes.length)}`);
|
var swipesCounterHTML = (`${(swipeId + 1)}/${(chat[chat.length - 1].swipes.length)}`);
|
||||||
@@ -2694,16 +2705,6 @@ function showSwipeButtons() {
|
|||||||
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');
|
||||||
}
|
}
|
||||||
|
|
||||||
//had to add this to make the swipe counter work
|
|
||||||
//(copied from the onclick functions for swipe buttons..
|
|
||||||
//don't know why the array isn't set for non-swipe messsages in Generate or addOneMessage..)
|
|
||||||
|
|
||||||
if (chat[chat.length - 1]['swipe_id'] === undefined) { // if there is no swipe-message in the last spot of the chat array
|
|
||||||
chat[chat.length - 1]['swipe_id'] = 0; // set it to id 0
|
|
||||||
chat[chat.length - 1]['swipes'] = []; // empty the array
|
|
||||||
chat[chat.length - 1]['swipes'][0] = chat[chat.length - 1]['mes']; //assign swipe array with last message from chat
|
|
||||||
}
|
|
||||||
//console.log((chat[chat.length - 1]));
|
//console.log((chat[chat.length - 1]));
|
||||||
if (is_send_press === false && (chat[chat.length - 1].swipes.length - swipeId) === 1) {
|
if (is_send_press === false && (chat[chat.length - 1].swipes.length - swipeId) === 1) {
|
||||||
console.log('highlighting R swipe');
|
console.log('highlighting R swipe');
|
||||||
|
@@ -384,9 +384,9 @@ code {
|
|||||||
color: var(--ivory, white); */
|
color: var(--ivory, white); */
|
||||||
}
|
}
|
||||||
|
|
||||||
.last_mes .mes_text {
|
/*.last_mes .mes_text {
|
||||||
min-height: 10em;
|
min-height: 10em;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
.last_mes{
|
.last_mes{
|
||||||
grid-template-columns: [checkbox] fit-content(60px) [avatar] 50px [msg_block] auto [rightswipe] fit-content(48px);
|
grid-template-columns: [checkbox] fit-content(60px) [avatar] 50px [msg_block] auto [rightswipe] fit-content(48px);
|
||||||
|
Reference in New Issue
Block a user