Merge pull request #3688 from Erquint/staging No swiping hotkeys when modifiers are held.

dc4612a0e2338b3bbf13e562037ccb2f1c9faf45

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

Signed
2 files changed, +13 -3Showing whitespace changes
public/scripts/RossAscends-mods.js+12 -2
@@ -1018,6 +1018,14 @@ export function initRossMods() {
10181018 return false;
10191019 }
10201020
1021+ function isModifiedKeyboardEvent(event) {
1022+ return (event instanceof KeyboardEvent &&
1023+ event.shiftKey ||
1024+ event.ctrlKey ||
1025+ event.altKey ||
1026+ event.metaKey);
1027+ }
1028+
10211029 $(document).on('keydown', async function (event) {
10221030 await processHotkeys(event.originalEvent);
10231031 });
@@ -1141,7 +1149,8 @@ export function initRossMods() {
11411149 $('#send_textarea').val() === '' &&
11421150 $('#character_popup').css('display') === 'none' &&
11431151 $('#shadow_select_chat_popup').css('display') === 'none' &&
11441152 !isInputElementInFocus() &&
1153+ !isModifiedKeyboardEvent(event)
11451154 ) {
11461155 $('.swipe_left:last').trigger('click', { source: 'keyboard', repeated: event.repeat });
11471156 return;
@@ -1154,7 +1163,8 @@ export function initRossMods() {
11541163 $('#send_textarea').val() === '' &&
11551164 $('#character_popup').css('display') === 'none' &&
11561165 $('#shadow_select_chat_popup').css('display') === 'none' &&
11571166 !isInputElementInFocus() &&
1167+ !isModifiedKeyboardEvent(event)
11581168 ) {
11591169 $('.swipe_right:last').trigger('click', { source: 'keyboard', repeated: event.repeat });
11601170 return;
public/scripts/templates/hotkeys.html+1 -1
@@ -5,7 +5,7 @@
55 <li><kbd data-i18n="help_hotkeys_1">Up</kbd> = <span data-i18n="help_hotkeys_2">Edit last message in chat</span></li>
66 <li><kbd data-i18n="help_hotkeys_3">Ctrl+Up</kbd> = <span data-i18n="help_hotkeys_4">Edit last USER message in chat</span></li>
77 <li><kbd data-i18n="help_hotkeys_5">Left</kbd> = <span data-i18n="help_hotkeys_6">swipe left</span></li>
88 <li><kbd data-i18n="help_hotkeys_7">Right</kbd> = <span data-i18n="help_hotkeys_8">swipe right (NOTE: swipe hotkeys only apply without modifiers and are disabled when chatbar has something typed into it)</span></li>
99 <li><kbd data-i18n="help_hotkeys_9">Enter</kbd> <span data-i18n="help_hotkeys_10">(with chat bar selected)</span> = <span data-i18n="help_hotkeys_10_1">send your message to AI</span></li>
1010 <li><kbd data-i18n="help_hotkeys_11">Ctrl+Enter</kbd> = <span data-i18n="help_hotkeys_12">Regenerate the last AI response</span></li>
1111 <li><kbd data-i18n="help_hotkeys_13">Alt+Enter</kbd> = <span data-i18n="help_hotkeys_14">Continue the last AI response</span></li>