Ditto for right swipe

19b7deaed0e3ae1feb5dc4c5362fe0ffe5346300

Cohee <18619528+Cohee1207@users.noreply.github.com>

2 files changed, +15 -6Showing whitespace changes
public/script.js+14 -5
@@ -8752,7 +8752,6 @@ function formatSwipeCounter(current, total) {
87528752 * @param {object} params Additional parameters.
87538753 * @param {string} [params.source] The source of the swipe event.
87548754 * @param {boolean} [params.repeated] Is the swipe event repeated.
8755- * @returns
87568755 */
87578756function swipe_left(_event, { source, repeated } = {}) { // when we swipe left..but no generation.
87588757 if (chat.length - 1 === Number(this_edit_mes_id)) {
@@ -8765,8 +8764,8 @@ function swipe_left(_event, { source, repeated } = {}) { // when we swipe l
87658764 // Make sure ad-hoc changes to extras are saved before swiping away
87668765 syncMesToSwipe();
87678766
8768- if (source === 'keyboard' && repeated && chat[chat.length - 1].swipe_id === 0) {
87698767 // If the user is holding down the key and we're at the first swipe, don't do anything
8768+ if (source === 'keyboard' && repeated && chat[chat.length - 1].swipe_id === 0) {
87708769 return;
87718770 }
87728771
@@ -8895,8 +8894,14 @@ function swipe_left(_event, { source, repeated } = {}) { // when we swipe l
88958894 }
88968895}
88978896
8898-// when we click swipe right button
8897+/**
8899-const swipe_right = () => {
8898+ * Handles the swipe to the right event.
8899+ * @param {JQuery.Event} _event Event.
8900+ * @param {object} params Additional parameters.
8901+ * @param {string} [params.source] The source of the swipe event.
8902+ * @param {boolean} [params.repeated] Is the swipe event repeated.
8903+ */
8904+function swipe_right(_event, { source, repeated } = {}) {
89008905 if (chat.length - 1 === Number(this_edit_mes_id)) {
89018906 closeMessageEditor();
89028907 }
@@ -8929,6 +8934,10 @@ const swipe_right = () => {
89298934 if (chat.length === 1 && chat[0]['swipe_id'] !== undefined && chat[0]['swipe_id'] === chat[0]['swipes'].length - 1) { // if swipe_right is called on the last alternate greeting, loop back around
89308935 chat[0]['swipe_id'] = 0;
89318936 } else {
8937+ // If the user is holding down the key and we're at the last swipe, don't do anything
8938+ if (source === 'keyboard' && repeated && chat[chat.length - 1].swipe_id === chat[chat.length - 1].swipes.length - 1) {
8939+ return;
8940+ }
89328941 chat[chat.length - 1]['swipe_id']++; // make new slot in array
89338942 }
89348943 if (chat[chat.length - 1].extra) {
@@ -9077,7 +9086,7 @@ const swipe_right = () => {
90779086 },
90789087 });
90799088 }
90809089};
90819090
90829091export const CONNECT_API_MAP = {
90839092 // Default APIs not contined inside text gen / chat gen
public/scripts/RossAscends-mods.js+1 -1
@@ -1156,7 +1156,7 @@ export function initRossMods() {
11561156 $('#shadow_select_chat_popup').css('display') === 'none' &&
11571157 !isInputElementInFocus()
11581158 ) {
11591159 $('.swipe_right:last').clicktrigger('click', { source: 'keyboard', repeated: event.repeat });
11601160 return;
11611161 }
11621162 }