Add schmoggle for auto select input
| @@ -4098,6 +4098,10 @@ | |||
| 4098 | <input id="world_import_dialog" type="checkbox" /> | 4098 | <input id="world_import_dialog" type="checkbox" /> |
| 4099 | <small data-i18n="Lorebook Import Dialog">Lorebook Import Dialog</small> | 4099 | <small data-i18n="Lorebook Import Dialog">Lorebook Import Dialog</small> |
| 4100 | </label> | 4100 | </label> |
| 4101 | <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."> | ||
| 4102 | <input id="enable_auto_select_input" type="checkbox" /> | ||
| 4103 | <small data-i18n="Auto-select Input Text">Auto-select Input Text</small> | ||
| 4104 | </label> | ||
| 4101 | <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"> | 4105 | <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"> |
| 4102 | <input id="restore_user_input" type="checkbox" /> | 4106 | <input id="restore_user_input" type="checkbox" /> |
| 4103 | <small data-i18n="Restore User Input">Restore User Input</small> | 4107 | <small data-i18n="Restore User Input">Restore User Input</small> |
| @@ -10658,6 +10658,7 @@ jQuery(async function () { | |||
| 10658 | /* $('#set_character_world').on('click', openCharacterWorldPopup); */ | 10658 | /* $('#set_character_world').on('click', openCharacterWorldPopup); */ |
| 10659 | 10659 | ||
| 10660 | $(document).on('focus', 'input.auto-select, textarea.auto-select', function () { | 10660 | $(document).on('focus', 'input.auto-select, textarea.auto-select', function () { |
| 10661 | if (!power_user.enable_auto_select_input) return; | ||
| 10661 | const control = $(this)[0]; | 10662 | const control = $(this)[0]; |
| 10662 | if (control instanceof HTMLInputElement || control instanceof HTMLTextAreaElement) { | 10663 | if (control instanceof HTMLInputElement || control instanceof HTMLTextAreaElement) { |
| 10663 | control.select(); | 10664 | control.select(); |
| @@ -202,6 +202,7 @@ let power_user = { | |||
| 202 | trim_spaces: true, | 202 | trim_spaces: true, |
| 203 | relaxed_api_urls: false, | 203 | relaxed_api_urls: false, |
| 204 | world_import_dialog: true, | 204 | world_import_dialog: true, |
| 205 | enable_auto_select_input: false, | ||
| 205 | tag_import_setting: tag_import_setting.ASK, | 206 | tag_import_setting: tag_import_setting.ASK, |
| 206 | disable_group_trimming: false, | 207 | disable_group_trimming: false, |
| 207 | single_line: false, | 208 | single_line: false, |
| @@ -1596,6 +1597,7 @@ async function loadPowerUserSettings(settings, data) { | |||
| 1596 | $('#single_line').prop('checked', power_user.single_line); | 1597 | $('#single_line').prop('checked', power_user.single_line); |
| 1597 | $('#relaxed_api_urls').prop('checked', power_user.relaxed_api_urls); | 1598 | $('#relaxed_api_urls').prop('checked', power_user.relaxed_api_urls); |
| 1598 | $('#world_import_dialog').prop('checked', power_user.world_import_dialog); | 1599 | $('#world_import_dialog').prop('checked', power_user.world_import_dialog); |
| 1600 | $('#enable_auto_select_input').prop('checked', power_user.enable_auto_select_input); | ||
| 1599 | $('#trim_spaces').prop('checked', power_user.trim_spaces); | 1601 | $('#trim_spaces').prop('checked', power_user.trim_spaces); |
| 1600 | $('#continue_on_send').prop('checked', power_user.continue_on_send); | 1602 | $('#continue_on_send').prop('checked', power_user.continue_on_send); |
| 1601 | $('#quick_continue').prop('checked', power_user.quick_continue); | 1603 | $('#quick_continue').prop('checked', power_user.quick_continue); |
| @@ -3773,6 +3775,12 @@ $(document).ready(() => { | |||
| 3773 | saveSettingsDebounced(); | 3775 | saveSettingsDebounced(); |
| 3774 | }); | 3776 | }); |
| 3775 | 3777 | ||
| 3778 | $('#enable_auto_select_input').on('input', function () { | ||
| 3779 | const value = !!$(this).prop('checked'); | ||
| 3780 | power_user.enable_auto_select_input = value; | ||
| 3781 | saveSettingsDebounced(); | ||
| 3782 | }); | ||
| 3783 | |||
| 3776 | $('#spoiler_free_mode').on('input', function () { | 3784 | $('#spoiler_free_mode').on('input', function () { |
| 3777 | power_user.spoiler_free_mode = !!$(this).prop('checked'); | 3785 | power_user.spoiler_free_mode = !!$(this).prop('checked'); |
| 3778 | switchSpoilerMode(); | 3786 | switchSpoilerMode(); |