Remove commented debug code
| @@ -2370,8 +2370,6 @@ export function addOneMessage(mes, { type = 'normal', insertAfter = null, scroll | |||
| 2370 | 2370 | ||
| 2371 | addCopyToCodeBlocks(newMessage); | 2371 | addCopyToCodeBlocks(newMessage); |
| 2372 | 2372 | ||
| 2373 | //const currentMessage = $('#chat').children().filter(`[mesid="${chat.length - 1}"]`); | ||
| 2374 | |||
| 2375 | // Set the swipes counter for past messages, only visible if 'Show Swipes on All Message' is enabled | 2373 | // Set the swipes counter for past messages, only visible if 'Show Swipes on All Message' is enabled |
| 2376 | if (!params.isUser && newMessageId !== 0 && newMessageId !== chat.length - 1) { | 2374 | if (!params.isUser && newMessageId !== 0 && newMessageId !== chat.length - 1) { |
| 2377 | const swipesNum = chat[newMessageId].swipes?.length; | 2375 | const swipesNum = chat[newMessageId].swipes?.length; |
| @@ -2379,11 +2377,9 @@ export function addOneMessage(mes, { type = 'normal', insertAfter = null, scroll | |||
| 2379 | newMessage.find('.swipes-counter').text(`${swipeId}\u200B/\u200b${swipesNum}`); | 2377 | newMessage.find('.swipes-counter').text(`${swipeId}\u200B/\u200b${swipesNum}`); |
| 2380 | } | 2378 | } |
| 2381 | 2379 | ||
| 2382 | |||
| 2383 | if (showSwipes) { | 2380 | if (showSwipes) { |
| 2384 | $('#chat .mes').last().addClass('last_mes'); | 2381 | $('#chat .mes').last().addClass('last_mes'); |
| 2385 | $('#chat .mes').eq(-2).removeClass('last_mes'); | 2382 | $('#chat .mes').eq(-2).removeClass('last_mes'); |
| 2386 | //.find('.swipe_right').hide(); //otherwise it stays looking like it did when it was last_mes | ||
| 2387 | hideSwipeButtons(); | 2383 | hideSwipeButtons(); |
| 2388 | showSwipeButtons(); | 2384 | showSwipeButtons(); |
| 2389 | } | 2385 | } |
| @@ -7483,7 +7479,6 @@ export function showSwipeButtons() { | |||
| 7483 | //had to add this to make the swipe counter work | 7479 | //had to add this to make the swipe counter work |
| 7484 | //(copied from the onclick functions for swipe buttons.. | 7480 | //(copied from the onclick functions for swipe buttons.. |
| 7485 | //don't know why the array isn't set for non-swipe messsages in Generate or addOneMessage..) | 7481 | //don't know why the array isn't set for non-swipe messsages in Generate or addOneMessage..) |
| 7486 | |||
| 7487 | if (chat[chat.length - 1]['swipe_id'] === undefined) { // if there is no swipe-message in the last spot of the chat array | 7482 | if (chat[chat.length - 1]['swipe_id'] === undefined) { // if there is no swipe-message in the last spot of the chat array |
| 7488 | chat[chat.length - 1]['swipe_id'] = 0; // set it to id 0 | 7483 | chat[chat.length - 1]['swipe_id'] = 0; // set it to id 0 |
| 7489 | chat[chat.length - 1]['swipes'] = []; // empty the array | 7484 | chat[chat.length - 1]['swipes'] = []; // empty the array |
| @@ -7502,33 +7497,24 @@ export function showSwipeButtons() { | |||
| 7502 | } | 7497 | } |
| 7503 | //only show right when generate is off, or when next right swipe would not make a generate happen | 7498 | //only show right when generate is off, or when next right swipe would not make a generate happen |
| 7504 | if (is_send_press === false || chat[chat.length - 1].swipes.length >= swipeId) { | 7499 | if (is_send_press === false || chat[chat.length - 1].swipes.length >= swipeId) { |
| 7505 | // console.error('showingSwipeButtons: showing.'); | ||
| 7506 | swipeRight.css('display', 'flex').css('opacity', '0.3'); | 7500 | swipeRight.css('display', 'flex').css('opacity', '0.3'); |
| 7507 | swipeCounter.css('opacity', '0.3'); | 7501 | swipeCounter.css('opacity', '0.3'); |
| 7508 | } | 7502 | } |
| 7509 | //console.log((chat[chat.length - 1])); | ||
| 7510 | if ((chat[chat.length - 1].swipes.length - swipeId) === 1) { | 7503 | if ((chat[chat.length - 1].swipes.length - swipeId) === 1) { |
| 7511 | // console.error('highlighting R swipe'); | ||
| 7512 | |||
| 7513 | //chevron was moved out of hardcode in HTML to class toggle dependent on last_mes or not | 7504 | //chevron was moved out of hardcode in HTML to class toggle dependent on last_mes or not |
| 7514 | //necessary for 'swipe_right' div in past messages to have no chevron if 'show swipes for all messages' is turned on | 7505 | //necessary for 'swipe_right' div in past messages to have no chevron if 'show swipes for all messages' is turned on |
| 7515 | swipeRight.css('opacity', '0.7'); | 7506 | swipeRight.css('opacity', '0.7'); |
| 7516 | swipeCounter.css('opacity', '0.7'); | 7507 | swipeCounter.css('opacity', '0.7'); |
| 7517 | } | 7508 | } |
| 7518 | //console.log(swipesCounterHTML); | ||
| 7519 | 7509 | ||
| 7520 | //allows for writing individual swipe counters for past messages | 7510 | //allows for writing individual swipe counters for past messages |
| 7521 | const lastSwipeCounter = $('.last_mes .swipes-counter'); | 7511 | const lastSwipeCounter = $('.last_mes .swipes-counter'); |
| 7522 | lastSwipeCounter.text(swipeCounterText).show(); | 7512 | lastSwipeCounter.text(swipeCounterText).show(); |
| 7523 | 7513 | ||
| 7524 | //console.log(swipeId); | ||
| 7525 | //console.log(chat[chat.length - 1].swipes.length); | ||
| 7526 | |||
| 7527 | switchSwipeNumAllMessages(); | 7514 | switchSwipeNumAllMessages(); |
| 7528 | } | 7515 | } |
| 7529 | 7516 | ||
| 7530 | export function hideSwipeButtons() { | 7517 | export function hideSwipeButtons() { |
| 7531 | // console.error('hideswipebuttons entered'); | ||
| 7532 | $('#chat').find('.swipe_right').hide(); | 7518 | $('#chat').find('.swipe_right').hide(); |
| 7533 | $('#chat').find('.last_mes .swipes-counter').hide(); | 7519 | $('#chat').find('.last_mes .swipes-counter').hide(); |
| 7534 | $('#chat').find('.swipe_left').hide(); | 7520 | $('#chat').find('.swipe_left').hide(); |