Add schmoggle for auto select input

This commit is contained in:
Wolfsblvt 2024-08-18 03:38:07 +02:00
parent 321f0500e0
commit 484d2b59ac
3 changed files with 13 additions and 0 deletions

View File

@ -4098,6 +4098,10 @@
<input id="world_import_dialog" type="checkbox" /> <input id="world_import_dialog" type="checkbox" />
<small data-i18n="Lorebook Import Dialog">Lorebook Import Dialog</small> <small data-i18n="Lorebook Import Dialog">Lorebook Import Dialog</small>
</label> </label>
<label data-newbie-hidden class="checkbox_label" for="enable_auto_select_input" title="Enable auto-select of input text in some text fields when clicking/selecting them. Applies to popup input textboxes, and possible other custom input fields." data-i18n="[title]Enable auto-select of input text in some text fields when clicking/selecting them. Applies to popup input textboxes, and possible other custom input fields.">
<input id="enable_auto_select_input" type="checkbox" />
<small data-i18n="Auto-select Input Text">Auto-select Input Text</small>
</label>
<label class="checkbox_label" for="restore_user_input" title="Restore unsaved user input on page refresh." data-i18n="[title]Restore unsaved user input on page refresh"> <label class="checkbox_label" for="restore_user_input" title="Restore unsaved user input on page refresh." data-i18n="[title]Restore unsaved user input on page refresh">
<input id="restore_user_input" type="checkbox" /> <input id="restore_user_input" type="checkbox" />
<small data-i18n="Restore User Input">Restore User Input</small> <small data-i18n="Restore User Input">Restore User Input</small>

View File

@ -10658,6 +10658,7 @@ jQuery(async function () {
/* $('#set_character_world').on('click', openCharacterWorldPopup); */ /* $('#set_character_world').on('click', openCharacterWorldPopup); */
$(document).on('focus', 'input.auto-select, textarea.auto-select', function () { $(document).on('focus', 'input.auto-select, textarea.auto-select', function () {
if (!power_user.enable_auto_select_input) return;
const control = $(this)[0]; const control = $(this)[0];
if (control instanceof HTMLInputElement || control instanceof HTMLTextAreaElement) { if (control instanceof HTMLInputElement || control instanceof HTMLTextAreaElement) {
control.select(); control.select();

View File

@ -202,6 +202,7 @@ let power_user = {
trim_spaces: true, trim_spaces: true,
relaxed_api_urls: false, relaxed_api_urls: false,
world_import_dialog: true, world_import_dialog: true,
enable_auto_select_input: false,
tag_import_setting: tag_import_setting.ASK, tag_import_setting: tag_import_setting.ASK,
disable_group_trimming: false, disable_group_trimming: false,
single_line: false, single_line: false,
@ -1596,6 +1597,7 @@ async function loadPowerUserSettings(settings, data) {
$('#single_line').prop('checked', power_user.single_line); $('#single_line').prop('checked', power_user.single_line);
$('#relaxed_api_urls').prop('checked', power_user.relaxed_api_urls); $('#relaxed_api_urls').prop('checked', power_user.relaxed_api_urls);
$('#world_import_dialog').prop('checked', power_user.world_import_dialog); $('#world_import_dialog').prop('checked', power_user.world_import_dialog);
$('#enable_auto_select_input').prop('checked', power_user.enable_auto_select_input);
$('#trim_spaces').prop('checked', power_user.trim_spaces); $('#trim_spaces').prop('checked', power_user.trim_spaces);
$('#continue_on_send').prop('checked', power_user.continue_on_send); $('#continue_on_send').prop('checked', power_user.continue_on_send);
$('#quick_continue').prop('checked', power_user.quick_continue); $('#quick_continue').prop('checked', power_user.quick_continue);
@ -3773,6 +3775,12 @@ $(document).ready(() => {
saveSettingsDebounced(); saveSettingsDebounced();
}); });
$('#enable_auto_select_input').on('input', function () {
const value = !!$(this).prop('checked');
power_user.enable_auto_select_input = value;
saveSettingsDebounced();
});
$('#spoiler_free_mode').on('input', function () { $('#spoiler_free_mode').on('input', function () {
power_user.spoiler_free_mode = !!$(this).prop('checked'); power_user.spoiler_free_mode = !!$(this).prop('checked');
switchSpoilerMode(); switchSpoilerMode();