Toggle for space trimming

This commit is contained in:
Cohee
2023-07-02 23:47:33 +03:00
parent 6e15f7474f
commit 0c3f3f952d
3 changed files with 32 additions and 5 deletions

View File

@ -163,6 +163,7 @@ let power_user = {
prefer_character_prompt: true,
prefer_character_jailbreak: true,
continue_on_send: false,
trim_spaces: true,
instruct: {
enabled: false,
@ -609,6 +610,7 @@ function loadPowerUserSettings(settings, data) {
power_user.font_scale = Number(localStorage.getItem(storage_keys.font_scale) ?? 1);
power_user.blur_strength = Number(localStorage.getItem(storage_keys.blur_strength) ?? 10);
$('#trim_spaces').prop("checked", power_user.trim_spaces);
$('#continue_on_send').prop("checked", power_user.continue_on_send);
$('#auto_swipe').prop("checked", power_user.auto_swipe);
$('#auto_swipe_minimum_length').val(power_user.auto_swipe_minimum_length);
@ -1515,6 +1517,12 @@ $(document).ready(() => {
saveSettingsDebounced();
});
$("#trim_spaces").on("input", function () {
const value = !!$(this).prop('checked');
power_user.trim_spaces = value;
saveSettingsDebounced();
});
$(window).on('focus', function () {
browser_has_focus = true;
});