Optimize past swipe counters performance
| @@ -4183,7 +4183,7 @@ | ||
| 4183 | 4183 | </label> |
| 4184 | 4184 | <label for="show_swipe_num_all_messages" class="checkbox_label" title="Display swipe numbers for all messages, not just the last." data-i18n="[title]Display swipe numbers for all messages, not just the last."> |
| 4185 | 4185 | <input id="show_swipe_num_all_messages" type="checkbox" /> |
| 4186 | 4186 | <small data-i18n="Swipe # for All Messages">Swipe # for All Messages</small><i class="fa-solid fa-mobile-screen-button"></i> |
| 4187 | 4187 | </label> |
| 4188 | 4188 | <label for="hotswapEnabled" class="checkbox_label" title="In the Character Management panel, show quick selection buttons for favorited characters." data-i18n="[title]In the Character Management panel, show quick selection buttons for favorited characters"> |
| 4189 | 4189 | <input id="hotswapEnabled" type="checkbox" /> |
| @@ -98,7 +98,6 @@ import { | ||
| 98 | 98 | resetMovableStyles, |
| 99 | 99 | forceCharacterEditorTokenize, |
| 100 | 100 | applyPowerUserSettings, |
| 101 | - switchSwipeNumAllMessages, | |
| 102 | 101 | } from './scripts/power-user.js'; |
| 103 | 102 | |
| 104 | 103 | import { |
| @@ -7660,14 +7659,12 @@ export function showSwipeButtons() { | ||
| 7660 | 7659 | //allows for writing individual swipe counters for past messages |
| 7661 | 7660 | const lastSwipeCounter = $('.last_mes .swipes-counter'); |
| 7662 | 7661 | lastSwipeCounter.text(swipeCounterText).show(); |
| 7663 | - | |
| 7664 | - switchSwipeNumAllMessages(); | |
| 7665 | 7662 | } |
| 7666 | 7663 | |
| 7667 | 7664 | export function hideSwipeButtons() { |
| 7668 | 7665 | $('#chat')chatElement.find('.swipe_right').hide(); |
| 7669 | 7666 | $('#chat')chatElement.find('.last_mes .swipes-counter').hide(); |
| 7670 | 7667 | $('#chat')chatElement.find('.swipe_left').hide(); |
| 7671 | 7668 | } |
| 7672 | 7669 | |
| 7673 | 7670 | /** |
| @@ -8538,6 +8535,8 @@ const swipe_right = () => { | ||
| 8538 | 8535 | } |
| 8539 | 8536 | if (run_generate) { //hide swipe arrows while generating |
| 8540 | 8537 | this_div.css('display', 'none'); |
| 8538 | + const swipesCounter = currentMessage.find('.swipes-counter'); | |
| 8539 | + swipesCounter.hide(); | |
| 8541 | 8540 | } |
| 8542 | 8541 | // handles animated transitions when swipe right, specifically height transitions between messages |
| 8543 | 8542 | if (run_generate || run_swipe_right) { |
| @@ -472,9 +472,9 @@ function switchCompactInputArea() { | ||
| 472 | 472 | $('#compact_input_area').prop('checked', power_user.compact_input_area); |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | 475 | export function switchSwipeNumAllMessages() { |
| 476 | 476 | $('#show_swipe_num_all_messages').prop('checked', power_user.show_swipe_num_all_messages); |
| 477 | 477 | $('.mes:not(.last_mes) .swipes-counterbody').csstoggleClass('opacityswipeAllMessages', '').toggle(!!power_user.show_swipe_num_all_messages); |
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | var originalSliderValues = []; |
| @@ -1044,6 +1044,16 @@ body .panelControlBar { | ||
| 1044 | 1044 | opacity: 0.3; |
| 1045 | 1045 | } |
| 1046 | 1046 | |
| 1047 | +body:not(.swipeAllMessages) .mes:not(.last_mes) .swipes-counter { | |
| 1048 | + display: none; | |
| 1049 | +} | |
| 1050 | + | |
| 1051 | +body.swipeAllMessages .mes:not(.last_mes) .swipes-counter { | |
| 1052 | + /* Avoid expensive DOM queries */ | |
| 1053 | + opacity: 0.3 !important; | |
| 1054 | + display: flex !important; | |
| 1055 | +} | |
| 1056 | + | |
| 1047 | 1057 | .swipe_left { |
| 1048 | 1058 | right: auto; |
| 1049 | 1059 | left: 20px; |