From 4f76e9e10fd5a07e119af9e7c42c0098db3dd67c Mon Sep 17 00:00:00 2001 From: NearEDGE Date: Fri, 2 Aug 2024 08:17:29 -0400 Subject: [PATCH] Added quick Regenerate and Impersonate buttons Additional buttons mimic the behavior of the continue button. --- public/index.html | 14 ++++++++++++++ public/script.js | 16 ++++++++++++++-- public/scripts/RossAscends-mods.js | 4 ++++ public/scripts/power-user.js | 20 ++++++++++++++++++++ public/style.css | 8 ++++++++ 5 files changed, 60 insertions(+), 2 deletions(-) diff --git a/public/index.html b/public/index.html index f59c28e7e..88e68e9d2 100644 --- a/public/index.html +++ b/public/index.html @@ -4144,6 +4144,18 @@ Quick "Continue" button + +
diff --git a/public/script.js b/public/script.js index 2f3cc6e62..f55efe846 100644 --- a/public/script.js +++ b/public/script.js @@ -5610,6 +5610,8 @@ export function activateSendButtons() { is_send_press = false; $('#send_but').removeClass('displayNone'); $('#mes_continue').removeClass('displayNone'); + $('#mes_regenerate').removeClass('displayNone'); + $('#mes_impersonate').removeClass('displayNone'); $('.mes_buttons:last').show(); hideStopButton(); } @@ -5617,6 +5619,8 @@ export function activateSendButtons() { export function deactivateSendButtons() { $('#send_but').addClass('displayNone'); $('#mes_continue').addClass('displayNone'); + $('#mes_regenerate').addClass('displayNone'); + $('#mes_impersonate').addClass('displayNone'); showStopButton(); } @@ -9095,14 +9099,14 @@ jQuery(async function () { $('#send_textarea').on('focusin focus click', () => { S_TAPreviouslyFocused = true; }); - $('#send_but, #option_regenerate, #option_continue, #mes_continue').on('click', () => { + $('#send_but, #option_regenerate, #option_continue, #mes_continue, #mes_regenerate, #mes_impersonate').on('click', () => { if (S_TAPreviouslyFocused) { $('#send_textarea').focus(); } }); $(document).click(event => { if ($(':focus').attr('id') !== 'send_textarea') { - var validIDs = ['options_button', 'send_but', 'mes_continue', 'send_textarea', 'option_regenerate', 'option_continue']; + var validIDs = ['options_button', 'send_but', 'mes_regenerate', 'mes_impersonate', 'mes_continue', 'send_textarea', 'option_regenerate', 'option_continue']; if (!validIDs.includes($(event.target).attr('id'))) { S_TAPreviouslyFocused = false; } @@ -9139,6 +9143,14 @@ jQuery(async function () { }); + $('#mes_regenerate').on('click', function () { + $('#option_regenerate').trigger('click'); + }); + + $('#mes_impersonate').on('click', function () { + $('#option_impersonate').trigger('click'); + }); + $('#mes_continue').on('click', function () { $('#option_continue').trigger('click'); }); diff --git a/public/scripts/RossAscends-mods.js b/public/scripts/RossAscends-mods.js index 2cfeb1f6b..f7bc69a16 100644 --- a/public/scripts/RossAscends-mods.js +++ b/public/scripts/RossAscends-mods.js @@ -311,6 +311,8 @@ function RA_checkOnlineStatus() { $('#send_form').addClass('no-connection'); //entire input form area is red when not connected $('#send_but').addClass('displayNone'); //send button is hidden when not connected; $('#mes_continue').addClass('displayNone'); //continue button is hidden when not connected; + $('#mes_regenerate').addClass('displayNone'); //continue button is hidden when not connected; + $('#mes_impersonate').addClass('displayNone'); //continue button is hidden when not connected; $('#API-status-top').removeClass('fa-plug'); $('#API-status-top').addClass('fa-plug-circle-exclamation redOverlayGlow'); connection_made = false; @@ -327,6 +329,8 @@ function RA_checkOnlineStatus() { if (!is_send_press && !(selected_group && is_group_generating)) { $('#send_but').removeClass('displayNone'); //on connect, send button shows $('#mes_continue').removeClass('displayNone'); //continue button is shown when connected + $('#mes_regenerate').removeClass('displayNone'); //continue button is shown when connected + $('#mes_impersonate').removeClass('displayNone'); //continue button is shown when connected } } } diff --git a/public/scripts/power-user.js b/public/scripts/power-user.js index 36ed925b3..5f02cfb63 100644 --- a/public/scripts/power-user.js +++ b/public/scripts/power-user.js @@ -197,6 +197,8 @@ let power_user = { prefer_character_prompt: true, prefer_character_jailbreak: true, quick_continue: false, + quick_regenerate: false, + quick_impersonate: false, continue_on_send: false, trim_spaces: true, relaxed_api_urls: false, @@ -1586,7 +1588,11 @@ function loadPowerUserSettings(settings, data) { $('#trim_spaces').prop('checked', power_user.trim_spaces); $('#continue_on_send').prop('checked', power_user.continue_on_send); $('#quick_continue').prop('checked', power_user.quick_continue); + $('#quick_regenerate').prop('checked', power_user.quick_continue); + $('#quick_impersonate').prop('checked', power_user.quick_continue); $('#mes_continue').css('display', power_user.quick_continue ? '' : 'none'); + $('#mes_regenerate').css('display', power_user.quick_regenerate? '' : 'none'); + $('#mes_impersonate').css('display', power_user.quick_impersonate ? '' : 'none'); $('#gestures-checkbox').prop('checked', power_user.gestures); $('#auto_swipe').prop('checked', power_user.auto_swipe); $('#auto_swipe_minimum_length').val(power_user.auto_swipe_minimum_length); @@ -3732,6 +3738,20 @@ $(document).ready(() => { saveSettingsDebounced(); }); + $('#quick_regenerate').on('input', function () { + const value = !!$(this).prop('checked'); + power_user.quick_regenerate = value; + $('#mes_regenerate').css('display', value ? '' : 'none'); + saveSettingsDebounced(); + }); + + $('#quick_impersonate').on('input', function () { + const value = !!$(this).prop('checked'); + power_user.quick_impersonate = value; + $('#mes_impersonate').css('display', value ? '' : 'none'); + saveSettingsDebounced(); + }); + $('#trim_spaces').on('input', function () { const value = !!$(this).prop('checked'); power_user.trim_spaces = value; diff --git a/public/style.css b/public/style.css index 2e828234d..b16f46db1 100644 --- a/public/style.css +++ b/public/style.css @@ -716,6 +716,14 @@ body .panelControlBar { order: 1; } +#mes_regenerate { + order: 1; +} + +#mes_impersonate { + order: 1; +} + #send_form .mes_stop { display: none; order: 2;