From d5b845345e2cb03fae086b446aad08eb484cb20e Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Tue, 1 Oct 2024 19:48:46 +0300 Subject: [PATCH] Better opacity handling. Remove debug logs --- public/script.js | 20 ++++++++++++-------- public/scripts/power-user.js | 2 +- public/style.css | 5 ++++- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/public/script.js b/public/script.js index e5cdb8d64..48ebbdc78 100644 --- a/public/script.js +++ b/public/script.js @@ -7493,29 +7493,33 @@ export function showSwipeButtons() { const currentMessage = $('#chat').children().filter(`[mesid="${chat.length - 1}"]`); const swipeId = chat[chat.length - 1].swipe_id; const swipeCounterText = (`${(swipeId + 1)}\u200B/\u200b${(chat[chat.length - 1].swipes.length)}`); + const swipeRight = currentMessage.find('.swipe_right'); + const swipeLeft = currentMessage.find('.swipe_left'); + const swipeCounter = currentMessage.find('.swipes-counter'); if (swipeId !== undefined && (chat[chat.length - 1].swipes.length > 1 || swipeId > 0)) { - currentMessage.children('.swipe_left').css('display', 'flex'); + swipeLeft.css('display', 'flex'); } //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) { - console.error('showingSwipeButtons: showing.'); - currentMessage.find('.swipe_right').css('display', 'flex'); - currentMessage.find('.swipe_right').css('opacity', '0.3'); + // console.error('showingSwipeButtons: showing.'); + swipeRight.css('display', 'flex').css('opacity', '0.3'); + swipeCounter.css('opacity', '0.3'); } //console.log((chat[chat.length - 1])); if ((chat[chat.length - 1].swipes.length - swipeId) === 1) { - console.error('highlighting R swipe'); + // console.error('highlighting R swipe'); //chevron was moved out of hardcode in HTML to class toggle dependent on last_mes or not //necessary for 'swipe_right' div in past messages to have no chevron if 'show swipes for all messages' is turned on - currentMessage.find('.swipe_right').css('opacity', '0.7'); + swipeRight.css('opacity', '0.7'); + swipeCounter.css('opacity', '0.7'); } //console.log(swipesCounterHTML); //allows for writing individual swipe counters for past messages - $('.last_mes .swipes-counter').text(swipeCounterText); - $('.last_mes .swipes-counter').show(); + const lastSwipeCounter = $('.last_mes .swipes-counter'); + lastSwipeCounter.text(swipeCounterText).show(); //console.log(swipeId); //console.log(chat[chat.length - 1].swipes.length); diff --git a/public/scripts/power-user.js b/public/scripts/power-user.js index 79c5eb724..bd618bad0 100644 --- a/public/scripts/power-user.js +++ b/public/scripts/power-user.js @@ -472,7 +472,7 @@ function switchCompactInputArea() { export function switchSwipeNumAllMessages() { $('#show_swipe_num_all_messages').prop('checked', power_user.show_swipe_num_all_messages); - $('.mes:not(.last_mes) .swipes-counter').toggle(power_user.show_swipe_num_all_messages); + $('.mes:not(.last_mes) .swipes-counter').css('opacity', '').toggle(power_user.show_swipe_num_all_messages); } var originalSliderValues = []; diff --git a/public/style.css b/public/style.css index e7cf90cc4..01a49ab9f 100644 --- a/public/style.css +++ b/public/style.css @@ -1010,11 +1010,14 @@ body .panelControlBar { min-width: 40px; display: flex; justify-content: center; - opacity: 0.7; margin-bottom: var(--swipeCounterMargin); height: var(--swipeCounterHeight); } +.mes:not(.last_mes) .swipes-counter { + opacity: 0.3; +} + .swipe_left { right: auto; left: 20px;