split counter from chevron, smarter toggling

885a278973253ecfb530f95fb92dd3dcfd94b24a

RossAscends <124905043+RossAscends@users.noreply.github.com>

4 files changed, +31 -41Showing whitespace changes
public/index.html+2 -1
@@ -5943,7 +5943,8 @@
5943 </div>5943 </div>
5944 <div class="mes_bias"></div>5944 <div class="mes_bias"></div>
5945 </div>5945 </div>
5946 <div class="swipe_right fa-solid" style="display: none;">5946 <div class="flex-container swipeRightBlock flexFlowColumn flexNoGap">
5947 <div class="swipe_right fa-solid fa-chevron-right" style="display: none;"></div>
5947 <div class="swipes-counter"></div>5948 <div class="swipes-counter"></div>
5948 </div>5949 </div>
5949 </div>5950 </div>
public/script.js+14 -14
@@ -83,7 +83,6 @@ import {
83 resetMovableStyles,83 resetMovableStyles,
84 forceCharacterEditorTokenize,84 forceCharacterEditorTokenize,
85 applyPowerUserSettings,85 applyPowerUserSettings,
86 switchSwipeNumAllMessages,
87} from './scripts/power-user.js';86} from './scripts/power-user.js';
8887
89import {88import {
@@ -2381,8 +2380,8 @@ export function addOneMessage(mes, { type = 'normal', insertAfter = null, scroll
23812380
2382 if (showSwipes) {2381 if (showSwipes) {
2383 $('#chat .mes').last().addClass('last_mes');2382 $('#chat .mes').last().addClass('last_mes');
2384 $('#chat .mes').eq(-2).removeClass('last_mes')2383 $('#chat .mes').eq(-2).removeClass('last_mes');
2385 .find('.swipe_right').removeClass('fa-chevron-right'); //otherwise it stays looking like it did when it was last_mes2384 //.find('.swipe_right').hide(); //otherwise it stays looking like it did when it was last_mes
2386 hideSwipeButtons();2385 hideSwipeButtons();
2387 showSwipeButtons();2386 showSwipeButtons();
2388 }2387 }
@@ -7495,16 +7494,17 @@ export function showSwipeButtons() {
7495 }7494 }
7496 //only show right when generate is off, or when next right swipe would not make a generate happen7495 //only show right when generate is off, or when next right swipe would not make a generate happen
7497 if (is_send_press === false || chat[chat.length - 1].swipes.length >= swipeId) {7496 if (is_send_press === false || chat[chat.length - 1].swipes.length >= swipeId) {
7498 currentMessage.children('.swipe_right').css('display', 'flex');7497 console.error('showingSwipeButtons: showing.');
7499 currentMessage.children('.swipe_right').css('opacity', '0.3');7498 currentMessage.find('.swipe_right').css('display', 'flex');
7499 currentMessage.find('.swipe_right').css('opacity', '0.3');
7500 }7500 }
7501 //console.log((chat[chat.length - 1]));7501 //console.log((chat[chat.length - 1]));
7502 if ((chat[chat.length - 1].swipes.length - swipeId) === 1) {7502 if ((chat[chat.length - 1].swipes.length - swipeId) === 1) {
7503 //console.log('highlighting R swipe');7503 console.error('highlighting R swipe');
75047504
7505 //chevron was moved out of hardcode in HTML to class toggle dependent on last_mes or not7505 //chevron was moved out of hardcode in HTML to class toggle dependent on last_mes or not
7506 //necessary for 'swipe_right' div in past messages to have no chevron if 'show swipes for all messages' is turned on7506 //necessary for 'swipe_right' div in past messages to have no chevron if 'show swipes for all messages' is turned on
7507 currentMessage.children('.swipe_right').addClass('fa-chevron-right').css('opacity', '0.7');7507 currentMessage.find('.swipe_right').css('opacity', '0.7');
7508 }7508 }
7509 //console.log(swipesCounterHTML);7509 //console.log(swipesCounterHTML);
75107510
@@ -7514,13 +7514,13 @@ export function showSwipeButtons() {
7514 //console.log(swipeId);7514 //console.log(swipeId);
7515 //console.log(chat[chat.length - 1].swipes.length);7515 //console.log(chat[chat.length - 1].swipes.length);
75167516
7517 switchSwipeNumAllMessages();7517 //switchSwipeNumAllMessages();
7518}7518}
75197519
7520export function hideSwipeButtons() {7520export function hideSwipeButtons() {
7521 //console.log('hideswipebuttons entered');7521 console.error('hideswipebuttons entered');
7522 $('#chat').find('.last_mes .swipe_right').css('display', 'none');7522 $('#chat').find('.swipe_right').hide();
7523 $('#chat').find('.swipe_left').css('display', 'none');7523 $('#chat').find('.swipe_left').hide();
7524}7524}
75257525
7526/**7526/**
@@ -8355,8 +8355,8 @@ const swipe_right = () => {
8355 }8355 }
83568356
8357 const currentMessage = $('#chat').children().filter(`[mesid="${chat.length - 1}"]`);8357 const currentMessage = $('#chat').children().filter(`[mesid="${chat.length - 1}"]`);
8358 let this_div = currentMessage.children('.swipe_right');8358 let this_div = currentMessage.find('.swipe_right');
8359 let this_mes_div = this_div.parent();8359 let this_mes_div = this_div.parent().parent();
83608360
8361 if (chat[chat.length - 1]['swipe_id'] > chat[chat.length - 1]['swipes'].length) { //if we swipe right while generating (the swipe ID is greater than what we are viewing now)8361 if (chat[chat.length - 1]['swipe_id'] > chat[chat.length - 1]['swipes'].length) { //if we swipe right while generating (the swipe ID is greater than what we are viewing now)
8362 chat[chat.length - 1]['swipe_id'] = chat[chat.length - 1]['swipes'].length; //show that message slot (will be '...' while generating)8362 chat[chat.length - 1]['swipe_id'] = chat[chat.length - 1]['swipes'].length; //show that message slot (will be '...' while generating)
@@ -8366,7 +8366,7 @@ const swipe_right = () => {
8366 }8366 }
8367 // handles animated transitions when swipe right, specifically height transitions between messages8367 // handles animated transitions when swipe right, specifically height transitions between messages
8368 if (run_generate || run_swipe_right) {8368 if (run_generate || run_swipe_right) {
8369 let this_mes_block = this_mes_div.children('.mes_block').children('.mes_text');8369 let this_mes_block = this_mes_div.find('.mes_block .mes_text');
8370 const this_mes_div_height = this_mes_div[0].scrollHeight;8370 const this_mes_div_height = this_mes_div[0].scrollHeight;
8371 const this_mes_block_height = this_mes_block[0].scrollHeight;8371 const this_mes_block_height = this_mes_block[0].scrollHeight;
83728372
public/scripts/power-user.js+1 -24
@@ -472,30 +472,7 @@ function switchCompactInputArea() {
472472
473export function switchSwipeNumAllMessages() {473export function switchSwipeNumAllMessages() {
474 $('#show_swipe_num_all_messages').prop('checked', power_user.show_swipe_num_all_messages);474 $('#show_swipe_num_all_messages').prop('checked', power_user.show_swipe_num_all_messages);
475475 $('.mes:not(.last_mes) .swipes-counter').toggle(power_user.show_swipe_num_all_messages);
476 if (power_user.show_swipe_num_all_messages) {
477
478 $('.mes').each(function () {
479 //if the div also has the .lst_mes class, skip the loop for that item
480 if ($(this).hasClass('last_mes')) {
481 return;
482 }
483 //add the cloned button to every .mes .swipe_right EXCLUDING .mes.last_mes
484 $(this).find('.swipe_right').css('display', 'flex');
485 });
486
487 } else if (!power_user.show_swipe_num_all_messages) {
488 $('.mes:not(.last_mes)').each(function () {
489 if ($(this).hasClass('last_mes')) {
490 return;
491 }
492 //add the cloned button back to its original spot
493 $(this).find('.swipe_right').css('display', 'none');
494 });
495
496 }
497
498
499}476}
500477
501var originalSliderValues = [];478var originalSliderValues = [];
public/style.css+14 -2
@@ -978,13 +978,21 @@ body .panelControlBar {
978 justify-content: center;978 justify-content: center;
979 z-index: 9999;979 z-index: 9999;
980 grid-row-start: 2;980 grid-row-start: 2;
981 grid-column-start: 4;
982 flex-flow: column;
983 font-size: 30px;981 font-size: 30px;
984 cursor: pointer;982 cursor: pointer;
985 align-self: center;983 align-self: center;
984
985}
986.swipe_left{
986position: absolute;987position: absolute;
987bottom: 15px;988bottom: 15px;
989flex-flow: column;
990}
991
992.swipeRightBlock {
993 position: absolute;
994 right: 0;
995 bottom: 0;
988}996}
989997
990.swipes-counter {998.swipes-counter {
@@ -994,6 +1002,9 @@ body .panelControlBar {
994 font-family: var(--mainFontFamily);1002 font-family: var(--mainFontFamily);
995 font-weight: 400;1003 font-weight: 400;
996 align-self: center;1004 align-self: center;
1005 min-width: 40px;
1006 display: flex;
1007 justify-content: center;
997}1008}
9981009
999.swipe_left {1010.swipe_left {
@@ -1003,6 +1014,7 @@ body .panelControlBar {
10031014
1004.swipe_right {1015.swipe_right {
1005 right: 5px;1016 right: 5px;
1017 align-self:end;
1006}1018}
10071019
1008.ui-settings {1020.ui-settings {