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) {
8752 * @param {object} params Additional parameters.8752 * @param {object} params Additional parameters.
8753 * @param {string} [params.source] The source of the swipe event.8753 * @param {string} [params.source] The source of the swipe event.
8754 * @param {boolean} [params.repeated] Is the swipe event repeated.8754 * @param {boolean} [params.repeated] Is the swipe event repeated.
8755 * @returns
8756 */8755 */
8757function swipe_left(_event, { source, repeated } = {}) { // when we swipe left..but no generation.8756function swipe_left(_event, { source, repeated } = {}) { // when we swipe left..but no generation.
8758 if (chat.length - 1 === Number(this_edit_mes_id)) {8757 if (chat.length - 1 === Number(this_edit_mes_id)) {
@@ -8765,8 +8764,8 @@ function swipe_left(_event, { source, repeated } = {}) { // when we swipe l
8765 // Make sure ad-hoc changes to extras are saved before swiping away8764 // Make sure ad-hoc changes to extras are saved before swiping away
8766 syncMesToSwipe();8765 syncMesToSwipe();
87678766
8768 if (source === 'keyboard' && repeated && chat[chat.length - 1].swipe_id === 0) {
8769 // If the user is holding down the key and we're at the first swipe, don't do anything8767 // 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) {
8770 return;8769 return;
8771 }8770 }
87728771
@@ -8895,8 +8894,14 @@ function swipe_left(_event, { source, repeated } = {}) { // when we swipe l
8895 }8894 }
8896}8895}
88978896
8898// when we click swipe right button8897/**
8899const 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 */
8904function swipe_right(_event, { source, repeated } = {}) {
8900 if (chat.length - 1 === Number(this_edit_mes_id)) {8905 if (chat.length - 1 === Number(this_edit_mes_id)) {
8901 closeMessageEditor();8906 closeMessageEditor();
8902 }8907 }
@@ -8929,6 +8934,10 @@ const swipe_right = () => {
8929 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 around8934 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
8930 chat[0]['swipe_id'] = 0;8935 chat[0]['swipe_id'] = 0;
8931 } else {8936 } 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 }
8932 chat[chat.length - 1]['swipe_id']++; // make new slot in array8941 chat[chat.length - 1]['swipe_id']++; // make new slot in array
8933 }8942 }
8934 if (chat[chat.length - 1].extra) {8943 if (chat[chat.length - 1].extra) {
@@ -9077,7 +9086,7 @@ const swipe_right = () => {
9077 },9086 },
9078 });9087 });
9079 }9088 }
9080};9089}
90819090
9082export const CONNECT_API_MAP = {9091export const CONNECT_API_MAP = {
9083 // Default APIs not contined inside text gen / chat gen9092 // Default APIs not contined inside text gen / chat gen
public/scripts/RossAscends-mods.js+1 -1
@@ -1156,7 +1156,7 @@ export function initRossMods() {
1156 $('#shadow_select_chat_popup').css('display') === 'none' &&1156 $('#shadow_select_chat_popup').css('display') === 'none' &&
1157 !isInputElementInFocus()1157 !isInputElementInFocus()
1158 ) {1158 ) {
1159 $('.swipe_right:last').click();1159 $('.swipe_right:last').trigger('click', { source: 'keyboard', repeated: event.repeat });
1160 return;1160 return;
1161 }1161 }
1162 }1162 }