| 7493 | const currentMessage = $('#chat').children().filter(`[mesid="${chat.length - 1}"]`); | 7493 | const currentMessage = $('#chat').children().filter(`[mesid="${chat.length - 1}"]`); |
| 7494 | const swipeId = chat[chat.length - 1].swipe_id; | 7494 | const swipeId = chat[chat.length - 1].swipe_id; |
| 7495 | const swipeCounterText = (`${(swipeId + 1)}\u200B/\u200b${(chat[chat.length - 1].swipes.length)}`); | 7495 | const swipeCounterText = (`${(swipeId + 1)}\u200B/\u200b${(chat[chat.length - 1].swipes.length)}`); |
| | 7496 | const swipeRight = currentMessage.find('.swipe_right'); |
| | 7497 | const swipeLeft = currentMessage.find('.swipe_left'); |
| | 7498 | const swipeCounter = currentMessage.find('.swipes-counter'); |
| 7496 | | 7499 | |
| 7497 | if (swipeId !== undefined && (chat[chat.length - 1].swipes.length > 1 || swipeId > 0)) { | 7500 | if (swipeId !== undefined && (chat[chat.length - 1].swipes.length > 1 || swipeId > 0)) { |
| 7498 | currentMessage.children('.swipe_left').css('display', 'flex'); | 7501 | swipeLeft.css('display', 'flex'); |
| 7499 | } | 7502 | } |
| 7500 | //only show right when generate is off, or when next right swipe would not make a generate happen | 7503 | //only show right when generate is off, or when next right swipe would not make a generate happen |
| 7501 | if (is_send_press === false || chat[chat.length - 1].swipes.length >= swipeId) { | 7504 | if (is_send_press === false || chat[chat.length - 1].swipes.length >= swipeId) { |
| 7502 | console.error('showingSwipeButtons: showing.'); | 7505 | // console.error('showingSwipeButtons: showing.'); |
| 7503 | currentMessage.find('.swipe_right').css('display', 'flex'); | 7506 | swipeRight.css('display', 'flex').css('opacity', '0.3'); |
| 7504 | currentMessage.find('.swipe_right').css('opacity', '0.3'); | 7507 | swipeCounter.css('opacity', '0.3'); |
| 7505 | } | 7508 | } |
| 7506 | //console.log((chat[chat.length - 1])); | 7509 | //console.log((chat[chat.length - 1])); |
| 7507 | if ((chat[chat.length - 1].swipes.length - swipeId) === 1) { | 7510 | if ((chat[chat.length - 1].swipes.length - swipeId) === 1) { |
| 7508 | console.error('highlighting R swipe'); | 7511 | // console.error('highlighting R swipe'); |
| 7509 | | 7512 | |
| 7510 | //chevron was moved out of hardcode in HTML to class toggle dependent on last_mes or not | 7513 | //chevron was moved out of hardcode in HTML to class toggle dependent on last_mes or not |
| 7511 | //necessary for 'swipe_right' div in past messages to have no chevron if 'show swipes for all messages' is turned on | 7514 | //necessary for 'swipe_right' div in past messages to have no chevron if 'show swipes for all messages' is turned on |
| 7512 | currentMessage.find('.swipe_right').css('opacity', '0.7'); | 7515 | swipeRight.css('opacity', '0.7'); |
| | 7516 | swipeCounter.css('opacity', '0.7'); |
| 7513 | } | 7517 | } |
| 7514 | //console.log(swipesCounterHTML); | 7518 | //console.log(swipesCounterHTML); |
| 7515 | | 7519 | |
| 7516 | //allows for writing individual swipe counters for past messages | 7520 | //allows for writing individual swipe counters for past messages |
| 7517 | $('.last_mes .swipes-counter').text(swipeCounterText); | 7521 | const lastSwipeCounter = $('.last_mes .swipes-counter'); |
| 7518 | $('.last_mes .swipes-counter').show(); | 7522 | lastSwipeCounter.text(swipeCounterText).show(); |
| 7519 | | 7523 | |
| 7520 | //console.log(swipeId); | 7524 | //console.log(swipeId); |
| 7521 | //console.log(chat[chat.length - 1].swipes.length); | 7525 | //console.log(chat[chat.length - 1].swipes.length); |