Merge pull request #2706 from d-ber/saveMoreSettings Save more settings

06ef515b2f1e709c7a7d48a20acb1d21058b2a3b

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

Signed
2 files changed, +40 -188Ignore whitespace
public/script.js+3 -0
@@ -84,6 +84,7 @@ import {
8484 context_presets,
8585 resetMovableStyles,
8686 forceCharacterEditorTokenize,
87+ applyPowerUserSettings,
8788} from './scripts/power-user.js';
8889
8990import {
@@ -6459,6 +6460,8 @@ export async function getSettings() {
64596460 // Load power user settings
64606461 await loadPowerUserSettings(settings, data);
64616462
6463+ applyPowerUserSettings();
6464+
64626465 // Load character tags
64636466 loadTagsSettings(settings);
64646467
public/scripts/power-user.js+37 -188
@@ -60,6 +60,7 @@ export {
6060 power_user,
6161 send_on_enter_options,
6262 getContextSettings,
63+ applyPowerUserSettings,
6364};
6465
6566export const MAX_CONTEXT_DEFAULT = 8192;
@@ -301,43 +302,6 @@ let movingUIPresets = [];
301302export let context_presets = [];
302303
303304const storage_keys = {
304- fast_ui_mode: 'TavernAI_fast_ui_mode',
305- avatar_style: 'TavernAI_avatar_style',
306- chat_display: 'TavernAI_chat_display',
307- chat_width: 'chat_width',
308- font_scale: 'TavernAI_font_scale',
309-
310- main_text_color: 'TavernAI_main_text_color',
311- italics_text_color: 'TavernAI_italics_text_color',
312- underline_text_color: 'TavernAI_underline_text_color',
313- quote_text_color: 'TavernAI_quote_text_color',
314- blur_tint_color: 'TavernAI_blur_tint_color',
315- chat_tint_color: 'TavernAI_chat_tint_color',
316- user_mes_blur_tint_color: 'TavernAI_user_mes_blur_tint_color',
317- bot_mes_blur_tint_color: 'TavernAI_bot_mes_blur_tint_color',
318- blur_strength: 'TavernAI_blur_strength',
319- shadow_color: 'TavernAI_shadow_color',
320- shadow_width: 'TavernAI_shadow_width',
321- border_color: 'TavernAI_border_color',
322-
323- custom_css: 'TavernAI_custom_css',
324-
325- waifuMode: 'TavernAI_waifuMode',
326- movingUI: 'TavernAI_movingUI',
327- noShadows: 'TavernAI_noShadows',
328-
329- hotswap_enabled: 'HotswapEnabled',
330- timer_enabled: 'TimerEnabled',
331- timestamps_enabled: 'TimestampsEnabled',
332- timestamp_model_icon: 'TimestampModelIcon',
333- mesIDDisplay_enabled: 'mesIDDisplayEnabled',
334- hideChatAvatars_enabled: 'hideChatAvatarsEnabled',
335- message_token_count_enabled: 'MessageTokenCountEnabled',
336- expand_message_actions: 'ExpandMessageActions',
337- enableZenSliders: 'enableZenSliders',
338- enableLabMode: 'enableLabMode',
339- reduced_motion: 'reduced_motion',
340- compact_input_area: 'compact_input_area',
341305 auto_connect_legacy: 'AutoConnectEnabled',
342306 auto_load_chat_legacy: 'AutoLoadChatEnabled',
343307
@@ -459,73 +423,47 @@ function fixMarkdown(text, forDisplay) {
459423}
460424
461425function switchHotswap() {
462- const value = localStorage.getItem(storage_keys.hotswap_enabled);
463- power_user.hotswap_enabled = value === null ? true : value == 'true';
464426 $('body').toggleClass('no-hotswap', !power_user.hotswap_enabled);
465427 $('#hotswapEnabled').prop('checked', power_user.hotswap_enabled);
466428}
467429
468430function switchTimer() {
469- const value = localStorage.getItem(storage_keys.timer_enabled);
470- power_user.timer_enabled = value === null ? true : value == 'true';
471431 $('body').toggleClass('no-timer', !power_user.timer_enabled);
472432 $('#messageTimerEnabled').prop('checked', power_user.timer_enabled);
473433}
474434
475435function switchTimestamps() {
476- const value = localStorage.getItem(storage_keys.timestamps_enabled);
477- power_user.timestamps_enabled = value === null ? true : value == 'true';
478436 $('body').toggleClass('no-timestamps', !power_user.timestamps_enabled);
479437 $('#messageTimestampsEnabled').prop('checked', power_user.timestamps_enabled);
480438}
481439
482440function switchIcons() {
483- const value = localStorage.getItem(storage_keys.timestamp_model_icon);
484- power_user.timestamp_model_icon = value === null ? true : value == 'true';
485441 $('body').toggleClass('no-modelIcons', !power_user.timestamp_model_icon);
486442 $('#messageModelIconEnabled').prop('checked', power_user.timestamp_model_icon);
487443}
488444
489445function switchTokenCount() {
490- const value = localStorage.getItem(storage_keys.message_token_count_enabled);
491- power_user.message_token_count_enabled = value === null ? false : value == 'true';
492446 $('body').toggleClass('no-tokenCount', !power_user.message_token_count_enabled);
493447 $('#messageTokensEnabled').prop('checked', power_user.message_token_count_enabled);
494448}
495449
496450function switchMesIDDisplay() {
497- const value = localStorage.getItem(storage_keys.mesIDDisplay_enabled);
498- power_user.mesIDDisplay_enabled = value === null ? true : value == 'true';
499- /* console.log(`
500- localstorage value:${value},
501- poweruser before:${before},
502- poweruser after:${power_user.mesIDDisplay_enabled}`) */
503451 $('body').toggleClass('no-mesIDDisplay', !power_user.mesIDDisplay_enabled);
504452 $('#mesIDDisplayEnabled').prop('checked', power_user.mesIDDisplay_enabled);
505453}
506454
507455function switchHideChatAvatars() {
508- const value = localStorage.getItem(storage_keys.hideChatAvatars_enabled);
509- power_user.hideChatAvatars_enabled = value === null ? false : value == 'true';
510- /*console.log(`
511- localstorage value:${value},
512- poweruser after:${power_user.hideChatAvatars_enabled}`)
513- */
514456 $('body').toggleClass('hideChatAvatars', power_user.hideChatAvatars_enabled);
515457 $('#hideChatAvatarsEnabled').prop('checked', power_user.hideChatAvatars_enabled);
516458}
517459
518460function switchMessageActions() {
519- const value = localStorage.getItem(storage_keys.expand_message_actions);
520- power_user.expand_message_actions = value === null ? false : value == 'true';
521461 $('body').toggleClass('expandMessageActions', power_user.expand_message_actions);
522462 $('#expandMessageActions').prop('checked', power_user.expand_message_actions);
523463 $('.extraMesButtons, .extraMesButtonsHint').removeAttr('style');
524464}
525465
526466function switchReducedMotion() {
527- const value = localStorage.getItem(storage_keys.reduced_motion);
528- power_user.reduced_motion = value === null ? false : value == 'true';
529467 jQuery.fx.off = power_user.reduced_motion;
530468 const overrideDuration = power_user.reduced_motion ? 0 : ANIMATION_DURATION_DEFAULT;
531469 setAnimationDuration(overrideDuration);
@@ -534,8 +472,6 @@ function switchReducedMotion() {
534472}
535473
536474function switchCompactInputArea() {
537- const value = localStorage.getItem(storage_keys.compact_input_area);
538- power_user.compact_input_area = value === null ? true : value == 'true';
539475 $('#send_form').toggleClass('compact', power_user.compact_input_area);
540476 $('#compact_input_area').prop('checked', power_user.compact_input_area);
541477}
@@ -551,8 +487,6 @@ async function switchLabMode() {
551487 }
552488 */
553489 await delay(100);
554- const value = localStorage.getItem(storage_keys.enableLabMode);
555- power_user.enableLabMode = value === null ? false : value == 'true';
556490 $('body').toggleClass('enableLabMode', power_user.enableLabMode);
557491 $('#enableLabMode').prop('checked', power_user.enableLabMode);
558492
@@ -599,8 +533,6 @@ async function switchLabMode() {
599533
600534async function switchZenSliders() {
601535 await delay(100);
602- const value = localStorage.getItem(storage_keys.enableZenSliders);
603- power_user.enableZenSliders = value === null ? false : value == 'true';
604536 $('body').toggleClass('enableZenSliders', power_user.enableZenSliders);
605537 $('#enableZenSliders').prop('checked', power_user.enableZenSliders);
606538
@@ -972,8 +904,6 @@ async function CreateZenSliders(elmnt) {
972904 }
973905}
974906function switchUiMode() {
975- const fastUi = localStorage.getItem(storage_keys.fast_ui_mode);
976- power_user.fast_ui_mode = fastUi === null ? true : fastUi == 'true';
977907 $('body').toggleClass('no-blur', power_user.fast_ui_mode);
978908 $('#fast_ui_mode').prop('checked', power_user.fast_ui_mode);
979909 if (power_user.fast_ui_mode) {
@@ -1023,8 +953,6 @@ function switchMovingUI() {
1023953 $('.drawer-content.maximized').each(function () {
1024954 $(this).find('.inline-drawer-maximize').trigger('click');
1025955 });
1026- const movingUI = localStorage.getItem(storage_keys.movingUI);
1027- power_user.movingUI = movingUI === null ? false : movingUI == 'true';
1028956 $('body').toggleClass('movingUI', power_user.movingUI);
1029957 if (power_user.movingUI === true) {
1030958 initMovingUI();
@@ -1040,9 +968,7 @@ function switchMovingUI() {
1040968 }
1041969}
1042970
1043971function noShadowsapplyNoShadows() {
1044- const noShadows = localStorage.getItem(storage_keys.noShadows);
1045- power_user.noShadows = noShadows === null ? false : noShadows == 'true';
1046972 $('body').toggleClass('noShadows', power_user.noShadows);
1047973 $('#noShadowsmode').prop('checked', power_user.noShadows);
1048974 if (power_user.noShadows) {
@@ -1056,12 +982,9 @@ function noShadows() {
1056982}
1057983
1058984function applyAvatarStyle() {
1059- power_user.avatar_style = Number(localStorage.getItem(storage_keys.avatar_style) ?? avatar_styles.ROUND);
1060985 $('body').toggleClass('big-avatars', power_user.avatar_style === avatar_styles.RECTANGULAR);
1061986 $('body').toggleClass('square-avatars', power_user.avatar_style === avatar_styles.SQUARE);
1062987 $('#avatar_style').val(power_user.avatar_style).prop('selected', true);
1063- //$(`input[name="avatar_style"][value="${power_user.avatar_style}"]`).prop("checked", true);
1064-
1065988}
1066989
1067990function applyChatDisplay() {
@@ -1096,8 +1019,6 @@ function applyChatDisplay() {
10961019}
10971020
10981021function applyChatWidth(type) {
1099- power_user.chat_width = Number(localStorage.getItem(storage_keys.chat_width) ?? 50);
1100-
11011022 if (type === 'forced') {
11021023 let r = document.documentElement;
11031024 r.style.setProperty('--sheldWidth', `${power_user.chat_width}vw`);
@@ -1159,8 +1080,6 @@ async function applyThemeColor(type) {
11591080}
11601081
11611082async function applyCustomCSS() {
1162- power_user.custom_css = String(localStorage.getItem(storage_keys.custom_css) ?? '');
1163-
11641083 $('#customCSS').val(power_user.custom_css);
11651084 var styleId = 'custom-style';
11661085 var style = document.getElementById(styleId);
@@ -1174,32 +1093,26 @@ async function applyCustomCSS() {
11741093}
11751094
11761095async function applyBlurStrength() {
1177- power_user.blur_strength = Number(localStorage.getItem(storage_keys.blur_strength) ?? 1);
1096+ document.documentElement.style.setProperty('--blurStrength', String(power_user.blur_strength));
1178- document.documentElement.style.setProperty('--blurStrength', power_user.blur_strength);
11791097 $('#blur_strength_counter').val(power_user.blur_strength);
11801098 $('#blur_strength').val(power_user.blur_strength);
1181-
1182-
11831099}
11841100
11851101async function applyShadowWidth() {
1186- power_user.shadow_width = Number(localStorage.getItem(storage_keys.shadow_width) ?? 2);
1102+ document.documentElement.style.setProperty('--shadowWidth', String(power_user.shadow_width));
1187- document.documentElement.style.setProperty('--shadowWidth', power_user.shadow_width);
11881103 $('#shadow_width_counter').val(power_user.shadow_width);
11891104 $('#shadow_width').val(power_user.shadow_width);
11901105
11911106}
11921107
11931108async function applyFontScale(type) {
1194-
1195- power_user.font_scale = Number(localStorage.getItem(storage_keys.font_scale) ?? 1);
11961109 //this is to allow forced setting on page load, theme swap, etc
11971110 if (type === 'forced') {
11981111 document.documentElement.style.setProperty('--fontScale', String(power_user.font_scale));
11991112 } else {
12001113 //this is to prevent the slider from updating page in real time
12011114 $('#font_scale').off('mouseup touchend').on('mouseup touchend', () => {
12021115 document.documentElement.style.setProperty('--fontScale', String(power_user.font_scale));
12031116 });
12041117 }
12051118
@@ -1228,64 +1141,55 @@ async function applyTheme(name) {
12281141 {
12291142 key: 'blur_strength',
12301143 action: async () => {
1231- localStorage.setItem(storage_keys.blur_strength, power_user.blur_strength);
12321144 await applyBlurStrength();
12331145 },
12341146 },
12351147 {
12361148 key: 'custom_css',
12371149 action: async () => {
1238- localStorage.setItem(storage_keys.custom_css, power_user.custom_css);
12391150 await applyCustomCSS();
12401151 },
12411152 },
12421153 {
12431154 key: 'shadow_width',
12441155 action: async () => {
1245- localStorage.setItem(storage_keys.shadow_width, power_user.shadow_width);
12461156 await applyShadowWidth();
12471157 },
12481158 },
12491159 {
12501160 key: 'font_scale',
12511161 action: async () => {
1252- localStorage.setItem(storage_keys.font_scale, power_user.font_scale);
12531162 await applyFontScale('forced');
12541163 },
12551164 },
12561165 {
12571166 key: 'fast_ui_mode',
12581167 action: async () => {
1259- localStorage.setItem(storage_keys.fast_ui_mode, power_user.fast_ui_mode);
12601168 switchUiMode();
12611169 },
12621170 },
12631171 {
12641172 key: 'waifuMode',
12651173 action: async () => {
1266- localStorage.setItem(storage_keys.waifuMode, power_user.waifuMode);
12671174 switchWaifuMode();
12681175 },
12691176 },
12701177 {
12711178 key: 'chat_display',
12721179 action: async () => {
1273- localStorage.setItem(storage_keys.chat_display, power_user.chat_display);
12741180 applyChatDisplay();
12751181 },
12761182 },
12771183 {
12781184 key: 'avatar_style',
12791185 action: async () => {
1280- localStorage.setItem(storage_keys.avatar_style, power_user.avatar_style);
12811186 applyAvatarStyle();
12821187 },
12831188 },
12841189 {
12851190 key: 'noShadows',
12861191 action: async () => {
1287- localStorage.setItem(storage_keys.noShadows, power_user.noShadows);
1192+ applyNoShadows();
1288- noShadows();
12891193 },
12901194 },
12911195 {
@@ -1295,78 +1199,66 @@ async function applyTheme(name) {
12951199 if (!power_user.chat_width) {
12961200 power_user.chat_width = 50;
12971201 }
1298-
1299- localStorage.setItem(storage_keys.chat_width, String(power_user.chat_width));
13001202 applyChatWidth('forced');
13011203 },
13021204 },
13031205 {
13041206 key: 'timer_enabled',
13051207 action: async () => {
1306- localStorage.setItem(storage_keys.timer_enabled, Boolean(power_user.timer_enabled));
13071208 switchTimer();
13081209 },
13091210 },
13101211 {
13111212 key: 'timestamps_enabled',
13121213 action: async () => {
1313- localStorage.setItem(storage_keys.timestamps_enabled, Boolean(power_user.timestamps_enabled));
13141214 switchTimestamps();
13151215 },
13161216 },
13171217 {
13181218 key: 'timestamp_model_icon',
13191219 action: async () => {
1320- localStorage.setItem(storage_keys.timestamp_model_icon, Boolean(power_user.timestamp_model_icon));
13211220 switchIcons();
13221221 },
13231222 },
13241223 {
13251224 key: 'message_token_count_enabled',
13261225 action: async () => {
1327- localStorage.setItem(storage_keys.message_token_count_enabled, Boolean(power_user.message_token_count_enabled));
13281226 switchTokenCount();
13291227 },
13301228 },
13311229 {
13321230 key: 'mesIDDisplay_enabled',
13331231 action: async () => {
1334- localStorage.setItem(storage_keys.mesIDDisplay_enabled, Boolean(power_user.mesIDDisplay_enabled));
13351232 switchMesIDDisplay();
13361233 },
13371234 },
13381235 {
13391236 key: 'hideChatAvatars_enabled',
13401237 action: async () => {
1341- localStorage.setItem(storage_keys.hideChatAvatars_enabled, Boolean(power_user.hideChatAvatars_enabled));
13421238 switchHideChatAvatars();
13431239 },
13441240 },
13451241 {
13461242 key: 'expand_message_actions',
13471243 action: async () => {
1348- localStorage.setItem(storage_keys.expand_message_actions, Boolean(power_user.expand_message_actions));
13491244 switchMessageActions();
13501245 },
13511246 },
13521247 {
13531248 key: 'enableZenSliders',
13541249 action: async () => {
1355- localStorage.setItem(storage_keys.enableZenSliders, Boolean(power_user.enableZenSliders));
13561250 switchMessageActions();
13571251 },
13581252 },
13591253 {
13601254 key: 'enableLabMode',
13611255 action: async () => {
1362- localStorage.setItem(storage_keys.enableLabMode, Boolean(power_user.enableLabMode));
13631256 switchMessageActions();
13641257 },
13651258 },
13661259 {
13671260 key: 'hotswap_enabled',
13681261 action: async () => {
1369- localStorage.setItem(storage_keys.hotswap_enabled, Boolean(power_user.hotswap_enabled));
13701262 switchHotswap();
13711263 },
13721264 },
@@ -1387,7 +1279,6 @@ async function applyTheme(name) {
13871279 {
13881280 key: 'reduced_motion',
13891281 action: async () => {
1390- localStorage.setItem(storage_keys.reduced_motion, String(power_user.reduced_motion));
13911282 $('#reduced_motion').prop('checked', power_user.reduced_motion);
13921283 switchReducedMotion();
13931284 },
@@ -1395,7 +1286,6 @@ async function applyTheme(name) {
13951286 {
13961287 key: 'compact_input_area',
13971288 action: async () => {
1398- localStorage.setItem(storage_keys.compact_input_area, String(power_user.compact_input_area));
13991289 $('#compact_input_area').prop('checked', power_user.compact_input_area);
14001290 switchCompactInputArea();
14011291 },
@@ -1450,24 +1340,26 @@ async function showDebugMenu() {
14501340 callGenericPopup(template, POPUP_TYPE.TEXT, '', { wide: true, large: true, allowVerticalScrolling: true });
14511341}
14521342
1453-switchUiMode();
1343+function applyPowerUserSettings() {
14541344applyFontScale switchUiMode('forced');
14551345applyThemeColor applyFontScale('forced');
14561346applyChatWidth applyThemeColor('forced');
14571347applyAvatarStyle applyChatWidth('forced');
14581348applyBlurStrength applyAvatarStyle();
14591349applyShadowWidth applyBlurStrength();
14601350applyCustomCSS applyShadowWidth();
14611351switchMovingUI applyCustomCSS();
14621352noShadows switchMovingUI();
14631353switchHotswap applyNoShadows();
14641354switchTimer switchHotswap();
14651355switchTimestamps switchTimer();
14661356switchIcons switchTimestamps();
14671357switchMesIDDisplay switchIcons();
14681358switchHideChatAvatars switchMesIDDisplay();
14691359switchTokenCount switchHideChatAvatars();
14701360switchMessageActions switchTokenCount();
1361+ switchMessageActions();
1362+}
14711363
14721364function getExampleMessagesBehavior() {
14731365 if (power_user.strip_examples) {
@@ -1531,17 +1423,6 @@ async function loadPowerUserSettings(settings, data) {
15311423 }
15321424
15331425 // These are still local storage
1534- const fastUi = localStorage.getItem(storage_keys.fast_ui_mode);
1535- const movingUI = localStorage.getItem(storage_keys.movingUI);
1536- const noShadows = localStorage.getItem(storage_keys.noShadows);
1537- const hotswap = localStorage.getItem(storage_keys.hotswap_enabled);
1538- const timer = localStorage.getItem(storage_keys.timer_enabled);
1539- const timestamps = localStorage.getItem(storage_keys.timestamps_enabled);
1540- const mesIDDisplay = localStorage.getItem(storage_keys.mesIDDisplay_enabled);
1541- const hideChatAvatars = localStorage.getItem(storage_keys.hideChatAvatars_enabled);
1542- const expandMessageActions = localStorage.getItem(storage_keys.expand_message_actions);
1543- const enableZenSliders = localStorage.getItem(storage_keys.enableZenSliders);
1544- const enableLabMode = localStorage.getItem(storage_keys.enableLabMode);
15451426 const autoLoadChat = localStorage.getItem(storage_keys.auto_load_chat_legacy);
15461427 const autoConnect = localStorage.getItem(storage_keys.auto_connect_legacy);
15471428
@@ -1555,23 +1436,6 @@ async function loadPowerUserSettings(settings, data) {
15551436 localStorage.removeItem(storage_keys.auto_connect_legacy);
15561437 }
15571438
1558- power_user.fast_ui_mode = fastUi === null ? true : fastUi == 'true';
1559- power_user.movingUI = movingUI === null ? false : movingUI == 'true';
1560- power_user.noShadows = noShadows === null ? false : noShadows == 'true';
1561- power_user.hotswap_enabled = hotswap === null ? true : hotswap == 'true';
1562- power_user.timer_enabled = timer === null ? true : timer == 'true';
1563- power_user.timestamps_enabled = timestamps === null ? true : timestamps == 'true';
1564- power_user.mesIDDisplay_enabled = mesIDDisplay === null ? true : mesIDDisplay == 'true';
1565- power_user.hideChatAvatars_enabled = hideChatAvatars === null ? true : hideChatAvatars == 'true';
1566- power_user.expand_message_actions = expandMessageActions === null ? true : expandMessageActions == 'true';
1567- power_user.enableZenSliders = enableZenSliders === null ? false : enableZenSliders == 'true';
1568- power_user.enableLabMode = enableLabMode === null ? false : enableLabMode == 'true';
1569- power_user.avatar_style = Number(localStorage.getItem(storage_keys.avatar_style) ?? avatar_styles.ROUND);
1570- //power_user.chat_display = Number(localStorage.getItem(storage_keys.chat_display) ?? chat_styles.DEFAULT);
1571- power_user.chat_width = Number(localStorage.getItem(storage_keys.chat_width) ?? 50);
1572- power_user.font_scale = Number(localStorage.getItem(storage_keys.font_scale) ?? 1);
1573- power_user.blur_strength = Number(localStorage.getItem(storage_keys.blur_strength) ?? 10);
1574-
15751439 if (power_user.chat_display === '') {
15761440 power_user.chat_display = chat_styles.DEFAULT;
15771441 }
@@ -3298,10 +3162,8 @@ $(document).ready(() => {
32983162 saveSettingsDebounced();
32993163 });
33003164
3301- // Settings that go to local storage
33023165 $('#fast_ui_mode').change(function () {
33033166 power_user.fast_ui_mode = $(this).prop('checked');
3304- localStorage.setItem(storage_keys.fast_ui_mode, power_user.fast_ui_mode);
33053167 switchUiMode();
33063168 saveSettingsDebounced();
33073169 });
@@ -3314,22 +3176,19 @@ $(document).ready(() => {
33143176
33153177 $('#customCSS').on('input', () => {
33163178 power_user.custom_css = String($('#customCSS').val());
3317- localStorage.setItem(storage_keys.custom_css, power_user.custom_css);
33183179 saveSettingsDebounced();
33193180 applyCustomCSS();
33203181 });
33213182
33223183 $('#movingUImode').change(function () {
33233184 power_user.movingUI = $(this).prop('checked');
3324- localStorage.setItem(storage_keys.movingUI, power_user.movingUI);
33253185 switchMovingUI();
33263186 saveSettingsDebounced();
33273187 });
33283188
33293189 $('#noShadowsmode').change(function () {
33303190 power_user.noShadows = $(this).prop('checked');
3331- localStorage.setItem(storage_keys.noShadows, power_user.noShadows);
3191+ applyNoShadows();
3332- noShadows();
33333192 saveSettingsDebounced();
33343193 });
33353194
@@ -3338,7 +3197,6 @@ $(document).ready(() => {
33383197 $('#avatar_style').on('change', function () {
33393198 const value = $(this).find(':selected').val();
33403199 power_user.avatar_style = Number(value);
3341- localStorage.setItem(storage_keys.avatar_style, power_user.avatar_style);
33423200 applyAvatarStyle();
33433201 saveSettingsDebounced();
33443202 });
@@ -3346,17 +3204,15 @@ $(document).ready(() => {
33463204 $('#chat_display').on('change', function () {
33473205 const value = $(this).find(':selected').val();
33483206 power_user.chat_display = Number(value);
3349- localStorage.setItem(storage_keys.chat_display, power_user.chat_display);
33503207 applyChatDisplay();
33513208 saveSettingsDebounced();
3352-
33533209 });
33543210
33553211 $('#chat_width_slider').on('input', function (e, data) {
33563212 const applyMode = data?.forced ? 'forced' : 'normal';
33573213 power_user.chat_width = Number(e.target.value);
3358- localStorage.setItem(storage_keys.chat_width, power_user.chat_width);
33593214 applyChatWidth(applyMode);
3215+ saveSettingsDebounced();
33603216 setHotswapsDebounced();
33613217 });
33623218
@@ -3386,7 +3242,6 @@ $(document).ready(() => {
33863242 const applyMode = data?.forced ? 'forced' : 'normal';
33873243 power_user.font_scale = Number(e.target.value);
33883244 $('#font_scale_counter').val(power_user.font_scale);
3389- localStorage.setItem(storage_keys.font_scale, power_user.font_scale);
33903245 await applyFontScale(applyMode);
33913246 saveSettingsDebounced();
33923247 });
@@ -3394,7 +3249,6 @@ $(document).ready(() => {
33943249 $('input[name="blur_strength"]').on('input', async function (e) {
33953250 power_user.blur_strength = Number(e.target.value);
33963251 $('#blur_strength_counter').val(power_user.blur_strength);
3397- localStorage.setItem(storage_keys.blur_strength, power_user.blur_strength);
33983252 await applyBlurStrength();
33993253 saveSettingsDebounced();
34003254 });
@@ -3402,7 +3256,6 @@ $(document).ready(() => {
34023256 $('input[name="shadow_width"]').on('input', async function (e) {
34033257 power_user.shadow_width = Number(e.target.value);
34043258 $('#shadow_width_counter').val(power_user.shadow_width);
3405- localStorage.setItem(storage_keys.shadow_width, power_user.shadow_width);
34063259 await applyShadowWidth();
34073260 saveSettingsDebounced();
34083261 });
@@ -3643,35 +3496,35 @@ $(document).ready(() => {
36433496 $('#messageTimerEnabled').on('input', function () {
36443497 const value = !!$(this).prop('checked');
36453498 power_user.timer_enabled = value;
3646- localStorage.setItem(storage_keys.timer_enabled, Boolean(power_user.timer_enabled));
3499+ saveSettingsDebounced();
36473500 switchTimer();
36483501 });
36493502
36503503 $('#messageTimestampsEnabled').on('input', function () {
36513504 const value = !!$(this).prop('checked');
36523505 power_user.timestamps_enabled = value;
3653- localStorage.setItem(storage_keys.timestamps_enabled, Boolean(power_user.timestamps_enabled));
3506+ saveSettingsDebounced();
36543507 switchTimestamps();
36553508 });
36563509
36573510 $('#messageModelIconEnabled').on('input', function () {
36583511 const value = !!$(this).prop('checked');
36593512 power_user.timestamp_model_icon = value;
3660- localStorage.setItem(storage_keys.timestamp_model_icon, Boolean(power_user.timestamp_model_icon));
3513+ saveSettingsDebounced();
36613514 switchIcons();
36623515 });
36633516
36643517 $('#messageTokensEnabled').on('input', function () {
36653518 const value = !!$(this).prop('checked');
36663519 power_user.message_token_count_enabled = value;
3667- localStorage.setItem(storage_keys.message_token_count_enabled, Boolean(power_user.message_token_count_enabled));
3520+ saveSettingsDebounced();
36683521 switchTokenCount();
36693522 });
36703523
36713524 $('#expandMessageActions').on('input', function () {
36723525 const value = !!$(this).prop('checked');
36733526 power_user.expand_message_actions = value;
3674- localStorage.setItem(storage_keys.expand_message_actions, Boolean(power_user.expand_message_actions));
3527+ saveSettingsDebounced();
36753528 switchMessageActions();
36763529 });
36773530
@@ -3684,7 +3537,6 @@ $(document).ready(() => {
36843537 return;
36853538 }
36863539 power_user.enableZenSliders = value;
3687- localStorage.setItem(storage_keys.enableZenSliders, Boolean(power_user.enableZenSliders));
36883540 saveSettingsDebounced();
36893541 switchZenSliders();
36903542 });
@@ -3699,7 +3551,6 @@ $(document).ready(() => {
36993551 }
37003552
37013553 power_user.enableLabMode = value;
3702- localStorage.setItem(storage_keys.enableLabMode, Boolean(power_user.enableLabMode));
37033554 saveSettingsDebounced();
37043555 switchLabMode();
37053556 });
@@ -3707,22 +3558,22 @@ $(document).ready(() => {
37073558 $('#mesIDDisplayEnabled').on('input', function () {
37083559 const value = !!$(this).prop('checked');
37093560 power_user.mesIDDisplay_enabled = value;
3710- localStorage.setItem(storage_keys.mesIDDisplay_enabled, Boolean(power_user.mesIDDisplay_enabled));
3561+ saveSettingsDebounced();
37113562 switchMesIDDisplay();
37123563 });
37133564
37143565 $('#hideChatAvatarsEnabled').on('input', function () {
37153566 const value = !!$(this).prop('checked');
37163567 power_user.hideChatAvatars_enabled = value;
3717- localStorage.setItem(storage_keys.hideChatAvatars_enabled, Boolean(power_user.hideChatAvatars_enabled));
3568+ saveSettingsDebounced();
37183569 switchHideChatAvatars();
37193570 });
37203571
37213572 $('#hotswapEnabled').on('input', function () {
37223573 const value = !!$(this).prop('checked');
37233574 power_user.hotswap_enabled = value;
3724- localStorage.setItem(storage_keys.hotswap_enabled, Boolean(power_user.hotswap_enabled));
37253575 switchHotswap();
3576+ saveSettingsDebounced();
37263577 });
37273578
37283579 $('#prefer_character_prompt').on('input', function () {
@@ -3935,14 +3786,12 @@ $(document).ready(() => {
39353786
39363787 $('#reduced_motion').on('input', function () {
39373788 power_user.reduced_motion = !!$(this).prop('checked');
3938- localStorage.setItem(storage_keys.reduced_motion, String(power_user.reduced_motion));
39393789 switchReducedMotion();
39403790 saveSettingsDebounced();
39413791 });
39423792
39433793 $('#compact_input_area').on('input', function () {
39443794 power_user.compact_input_area = !!$(this).prop('checked');
3945- localStorage.setItem(storage_keys.compact_input_area, String(power_user.compact_input_area));
39463795 switchCompactInputArea();
39473796 saveSettingsDebounced();
39483797 });