Merge pull request #2706 from d-ber/saveMoreSettings Save more settings
Signed| @@ -84,6 +84,7 @@ import { | |||
| 84 | context_presets, | 84 | context_presets, |
| 85 | resetMovableStyles, | 85 | resetMovableStyles, |
| 86 | forceCharacterEditorTokenize, | 86 | forceCharacterEditorTokenize, |
| 87 | applyPowerUserSettings, | ||
| 87 | } from './scripts/power-user.js'; | 88 | } from './scripts/power-user.js'; |
| 88 | 89 | ||
| 89 | import { | 90 | import { |
| @@ -6459,6 +6460,8 @@ export async function getSettings() { | |||
| 6459 | // Load power user settings | 6460 | // Load power user settings |
| 6460 | await loadPowerUserSettings(settings, data); | 6461 | await loadPowerUserSettings(settings, data); |
| 6461 | 6462 | ||
| 6463 | applyPowerUserSettings(); | ||
| 6464 | |||
| 6462 | // Load character tags | 6465 | // Load character tags |
| 6463 | loadTagsSettings(settings); | 6466 | loadTagsSettings(settings); |
| 6464 | 6467 | ||
| @@ -60,6 +60,7 @@ export { | |||
| 60 | power_user, | 60 | power_user, |
| 61 | send_on_enter_options, | 61 | send_on_enter_options, |
| 62 | getContextSettings, | 62 | getContextSettings, |
| 63 | applyPowerUserSettings, | ||
| 63 | }; | 64 | }; |
| 64 | 65 | ||
| 65 | export const MAX_CONTEXT_DEFAULT = 8192; | 66 | export const MAX_CONTEXT_DEFAULT = 8192; |
| @@ -301,43 +302,6 @@ let movingUIPresets = []; | |||
| 301 | export let context_presets = []; | 302 | export let context_presets = []; |
| 302 | 303 | ||
| 303 | const storage_keys = { | 304 | const 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', | ||
| 341 | auto_connect_legacy: 'AutoConnectEnabled', | 305 | auto_connect_legacy: 'AutoConnectEnabled', |
| 342 | auto_load_chat_legacy: 'AutoLoadChatEnabled', | 306 | auto_load_chat_legacy: 'AutoLoadChatEnabled', |
| 343 | 307 | ||
| @@ -459,73 +423,47 @@ function fixMarkdown(text, forDisplay) { | |||
| 459 | } | 423 | } |
| 460 | 424 | ||
| 461 | function switchHotswap() { | 425 | function switchHotswap() { |
| 462 | const value = localStorage.getItem(storage_keys.hotswap_enabled); | ||
| 463 | power_user.hotswap_enabled = value === null ? true : value == 'true'; | ||
| 464 | $('body').toggleClass('no-hotswap', !power_user.hotswap_enabled); | 426 | $('body').toggleClass('no-hotswap', !power_user.hotswap_enabled); |
| 465 | $('#hotswapEnabled').prop('checked', power_user.hotswap_enabled); | 427 | $('#hotswapEnabled').prop('checked', power_user.hotswap_enabled); |
| 466 | } | 428 | } |
| 467 | 429 | ||
| 468 | function switchTimer() { | 430 | function switchTimer() { |
| 469 | const value = localStorage.getItem(storage_keys.timer_enabled); | ||
| 470 | power_user.timer_enabled = value === null ? true : value == 'true'; | ||
| 471 | $('body').toggleClass('no-timer', !power_user.timer_enabled); | 431 | $('body').toggleClass('no-timer', !power_user.timer_enabled); |
| 472 | $('#messageTimerEnabled').prop('checked', power_user.timer_enabled); | 432 | $('#messageTimerEnabled').prop('checked', power_user.timer_enabled); |
| 473 | } | 433 | } |
| 474 | 434 | ||
| 475 | function switchTimestamps() { | 435 | function switchTimestamps() { |
| 476 | const value = localStorage.getItem(storage_keys.timestamps_enabled); | ||
| 477 | power_user.timestamps_enabled = value === null ? true : value == 'true'; | ||
| 478 | $('body').toggleClass('no-timestamps', !power_user.timestamps_enabled); | 436 | $('body').toggleClass('no-timestamps', !power_user.timestamps_enabled); |
| 479 | $('#messageTimestampsEnabled').prop('checked', power_user.timestamps_enabled); | 437 | $('#messageTimestampsEnabled').prop('checked', power_user.timestamps_enabled); |
| 480 | } | 438 | } |
| 481 | 439 | ||
| 482 | function switchIcons() { | 440 | function switchIcons() { |
| 483 | const value = localStorage.getItem(storage_keys.timestamp_model_icon); | ||
| 484 | power_user.timestamp_model_icon = value === null ? true : value == 'true'; | ||
| 485 | $('body').toggleClass('no-modelIcons', !power_user.timestamp_model_icon); | 441 | $('body').toggleClass('no-modelIcons', !power_user.timestamp_model_icon); |
| 486 | $('#messageModelIconEnabled').prop('checked', power_user.timestamp_model_icon); | 442 | $('#messageModelIconEnabled').prop('checked', power_user.timestamp_model_icon); |
| 487 | } | 443 | } |
| 488 | 444 | ||
| 489 | function switchTokenCount() { | 445 | function switchTokenCount() { |
| 490 | const value = localStorage.getItem(storage_keys.message_token_count_enabled); | ||
| 491 | power_user.message_token_count_enabled = value === null ? false : value == 'true'; | ||
| 492 | $('body').toggleClass('no-tokenCount', !power_user.message_token_count_enabled); | 446 | $('body').toggleClass('no-tokenCount', !power_user.message_token_count_enabled); |
| 493 | $('#messageTokensEnabled').prop('checked', power_user.message_token_count_enabled); | 447 | $('#messageTokensEnabled').prop('checked', power_user.message_token_count_enabled); |
| 494 | } | 448 | } |
| 495 | 449 | ||
| 496 | function switchMesIDDisplay() { | 450 | function 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}`) */ | ||
| 503 | $('body').toggleClass('no-mesIDDisplay', !power_user.mesIDDisplay_enabled); | 451 | $('body').toggleClass('no-mesIDDisplay', !power_user.mesIDDisplay_enabled); |
| 504 | $('#mesIDDisplayEnabled').prop('checked', power_user.mesIDDisplay_enabled); | 452 | $('#mesIDDisplayEnabled').prop('checked', power_user.mesIDDisplay_enabled); |
| 505 | } | 453 | } |
| 506 | 454 | ||
| 507 | function switchHideChatAvatars() { | 455 | function 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 | */ | ||
| 514 | $('body').toggleClass('hideChatAvatars', power_user.hideChatAvatars_enabled); | 456 | $('body').toggleClass('hideChatAvatars', power_user.hideChatAvatars_enabled); |
| 515 | $('#hideChatAvatarsEnabled').prop('checked', power_user.hideChatAvatars_enabled); | 457 | $('#hideChatAvatarsEnabled').prop('checked', power_user.hideChatAvatars_enabled); |
| 516 | } | 458 | } |
| 517 | 459 | ||
| 518 | function switchMessageActions() { | 460 | function switchMessageActions() { |
| 519 | const value = localStorage.getItem(storage_keys.expand_message_actions); | ||
| 520 | power_user.expand_message_actions = value === null ? false : value == 'true'; | ||
| 521 | $('body').toggleClass('expandMessageActions', power_user.expand_message_actions); | 461 | $('body').toggleClass('expandMessageActions', power_user.expand_message_actions); |
| 522 | $('#expandMessageActions').prop('checked', power_user.expand_message_actions); | 462 | $('#expandMessageActions').prop('checked', power_user.expand_message_actions); |
| 523 | $('.extraMesButtons, .extraMesButtonsHint').removeAttr('style'); | 463 | $('.extraMesButtons, .extraMesButtonsHint').removeAttr('style'); |
| 524 | } | 464 | } |
| 525 | 465 | ||
| 526 | function switchReducedMotion() { | 466 | function switchReducedMotion() { |
| 527 | const value = localStorage.getItem(storage_keys.reduced_motion); | ||
| 528 | power_user.reduced_motion = value === null ? false : value == 'true'; | ||
| 529 | jQuery.fx.off = power_user.reduced_motion; | 467 | jQuery.fx.off = power_user.reduced_motion; |
| 530 | const overrideDuration = power_user.reduced_motion ? 0 : ANIMATION_DURATION_DEFAULT; | 468 | const overrideDuration = power_user.reduced_motion ? 0 : ANIMATION_DURATION_DEFAULT; |
| 531 | setAnimationDuration(overrideDuration); | 469 | setAnimationDuration(overrideDuration); |
| @@ -534,8 +472,6 @@ function switchReducedMotion() { | |||
| 534 | } | 472 | } |
| 535 | 473 | ||
| 536 | function switchCompactInputArea() { | 474 | function switchCompactInputArea() { |
| 537 | const value = localStorage.getItem(storage_keys.compact_input_area); | ||
| 538 | power_user.compact_input_area = value === null ? true : value == 'true'; | ||
| 539 | $('#send_form').toggleClass('compact', power_user.compact_input_area); | 475 | $('#send_form').toggleClass('compact', power_user.compact_input_area); |
| 540 | $('#compact_input_area').prop('checked', power_user.compact_input_area); | 476 | $('#compact_input_area').prop('checked', power_user.compact_input_area); |
| 541 | } | 477 | } |
| @@ -551,8 +487,6 @@ async function switchLabMode() { | |||
| 551 | } | 487 | } |
| 552 | */ | 488 | */ |
| 553 | await delay(100); | 489 | await delay(100); |
| 554 | const value = localStorage.getItem(storage_keys.enableLabMode); | ||
| 555 | power_user.enableLabMode = value === null ? false : value == 'true'; | ||
| 556 | $('body').toggleClass('enableLabMode', power_user.enableLabMode); | 490 | $('body').toggleClass('enableLabMode', power_user.enableLabMode); |
| 557 | $('#enableLabMode').prop('checked', power_user.enableLabMode); | 491 | $('#enableLabMode').prop('checked', power_user.enableLabMode); |
| 558 | 492 | ||
| @@ -599,8 +533,6 @@ async function switchLabMode() { | |||
| 599 | 533 | ||
| 600 | async function switchZenSliders() { | 534 | async function switchZenSliders() { |
| 601 | await delay(100); | 535 | await delay(100); |
| 602 | const value = localStorage.getItem(storage_keys.enableZenSliders); | ||
| 603 | power_user.enableZenSliders = value === null ? false : value == 'true'; | ||
| 604 | $('body').toggleClass('enableZenSliders', power_user.enableZenSliders); | 536 | $('body').toggleClass('enableZenSliders', power_user.enableZenSliders); |
| 605 | $('#enableZenSliders').prop('checked', power_user.enableZenSliders); | 537 | $('#enableZenSliders').prop('checked', power_user.enableZenSliders); |
| 606 | 538 | ||
| @@ -972,8 +904,6 @@ async function CreateZenSliders(elmnt) { | |||
| 972 | } | 904 | } |
| 973 | } | 905 | } |
| 974 | function switchUiMode() { | 906 | function switchUiMode() { |
| 975 | const fastUi = localStorage.getItem(storage_keys.fast_ui_mode); | ||
| 976 | power_user.fast_ui_mode = fastUi === null ? true : fastUi == 'true'; | ||
| 977 | $('body').toggleClass('no-blur', power_user.fast_ui_mode); | 907 | $('body').toggleClass('no-blur', power_user.fast_ui_mode); |
| 978 | $('#fast_ui_mode').prop('checked', power_user.fast_ui_mode); | 908 | $('#fast_ui_mode').prop('checked', power_user.fast_ui_mode); |
| 979 | if (power_user.fast_ui_mode) { | 909 | if (power_user.fast_ui_mode) { |
| @@ -1023,8 +953,6 @@ function switchMovingUI() { | |||
| 1023 | $('.drawer-content.maximized').each(function () { | 953 | $('.drawer-content.maximized').each(function () { |
| 1024 | $(this).find('.inline-drawer-maximize').trigger('click'); | 954 | $(this).find('.inline-drawer-maximize').trigger('click'); |
| 1025 | }); | 955 | }); |
| 1026 | const movingUI = localStorage.getItem(storage_keys.movingUI); | ||
| 1027 | power_user.movingUI = movingUI === null ? false : movingUI == 'true'; | ||
| 1028 | $('body').toggleClass('movingUI', power_user.movingUI); | 956 | $('body').toggleClass('movingUI', power_user.movingUI); |
| 1029 | if (power_user.movingUI === true) { | 957 | if (power_user.movingUI === true) { |
| 1030 | initMovingUI(); | 958 | initMovingUI(); |
| @@ -1040,9 +968,7 @@ function switchMovingUI() { | |||
| 1040 | } | 968 | } |
| 1041 | } | 969 | } |
| 1042 | 970 | ||
| 1043 | function noShadows() { | 971 | function applyNoShadows() { |
| 1044 | const noShadows = localStorage.getItem(storage_keys.noShadows); | ||
| 1045 | power_user.noShadows = noShadows === null ? false : noShadows == 'true'; | ||
| 1046 | $('body').toggleClass('noShadows', power_user.noShadows); | 972 | $('body').toggleClass('noShadows', power_user.noShadows); |
| 1047 | $('#noShadowsmode').prop('checked', power_user.noShadows); | 973 | $('#noShadowsmode').prop('checked', power_user.noShadows); |
| 1048 | if (power_user.noShadows) { | 974 | if (power_user.noShadows) { |
| @@ -1056,12 +982,9 @@ function noShadows() { | |||
| 1056 | } | 982 | } |
| 1057 | 983 | ||
| 1058 | function applyAvatarStyle() { | 984 | function applyAvatarStyle() { |
| 1059 | power_user.avatar_style = Number(localStorage.getItem(storage_keys.avatar_style) ?? avatar_styles.ROUND); | ||
| 1060 | $('body').toggleClass('big-avatars', power_user.avatar_style === avatar_styles.RECTANGULAR); | 985 | $('body').toggleClass('big-avatars', power_user.avatar_style === avatar_styles.RECTANGULAR); |
| 1061 | $('body').toggleClass('square-avatars', power_user.avatar_style === avatar_styles.SQUARE); | 986 | $('body').toggleClass('square-avatars', power_user.avatar_style === avatar_styles.SQUARE); |
| 1062 | $('#avatar_style').val(power_user.avatar_style).prop('selected', true); | 987 | $('#avatar_style').val(power_user.avatar_style).prop('selected', true); |
| 1063 | //$(`input[name="avatar_style"][value="${power_user.avatar_style}"]`).prop("checked", true); | ||
| 1064 | |||
| 1065 | } | 988 | } |
| 1066 | 989 | ||
| 1067 | function applyChatDisplay() { | 990 | function applyChatDisplay() { |
| @@ -1096,8 +1019,6 @@ function applyChatDisplay() { | |||
| 1096 | } | 1019 | } |
| 1097 | 1020 | ||
| 1098 | function applyChatWidth(type) { | 1021 | function applyChatWidth(type) { |
| 1099 | power_user.chat_width = Number(localStorage.getItem(storage_keys.chat_width) ?? 50); | ||
| 1100 | |||
| 1101 | if (type === 'forced') { | 1022 | if (type === 'forced') { |
| 1102 | let r = document.documentElement; | 1023 | let r = document.documentElement; |
| 1103 | r.style.setProperty('--sheldWidth', `${power_user.chat_width}vw`); | 1024 | r.style.setProperty('--sheldWidth', `${power_user.chat_width}vw`); |
| @@ -1159,8 +1080,6 @@ async function applyThemeColor(type) { | |||
| 1159 | } | 1080 | } |
| 1160 | 1081 | ||
| 1161 | async function applyCustomCSS() { | 1082 | async function applyCustomCSS() { |
| 1162 | power_user.custom_css = String(localStorage.getItem(storage_keys.custom_css) ?? ''); | ||
| 1163 | |||
| 1164 | $('#customCSS').val(power_user.custom_css); | 1083 | $('#customCSS').val(power_user.custom_css); |
| 1165 | var styleId = 'custom-style'; | 1084 | var styleId = 'custom-style'; |
| 1166 | var style = document.getElementById(styleId); | 1085 | var style = document.getElementById(styleId); |
| @@ -1174,32 +1093,26 @@ async function applyCustomCSS() { | |||
| 1174 | } | 1093 | } |
| 1175 | 1094 | ||
| 1176 | async function applyBlurStrength() { | 1095 | async 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); | ||
| 1179 | $('#blur_strength_counter').val(power_user.blur_strength); | 1097 | $('#blur_strength_counter').val(power_user.blur_strength); |
| 1180 | $('#blur_strength').val(power_user.blur_strength); | 1098 | $('#blur_strength').val(power_user.blur_strength); |
| 1181 | |||
| 1182 | |||
| 1183 | } | 1099 | } |
| 1184 | 1100 | ||
| 1185 | async function applyShadowWidth() { | 1101 | async 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); | ||
| 1188 | $('#shadow_width_counter').val(power_user.shadow_width); | 1103 | $('#shadow_width_counter').val(power_user.shadow_width); |
| 1189 | $('#shadow_width').val(power_user.shadow_width); | 1104 | $('#shadow_width').val(power_user.shadow_width); |
| 1190 | 1105 | ||
| 1191 | } | 1106 | } |
| 1192 | 1107 | ||
| 1193 | async function applyFontScale(type) { | 1108 | async function applyFontScale(type) { |
| 1194 | |||
| 1195 | power_user.font_scale = Number(localStorage.getItem(storage_keys.font_scale) ?? 1); | ||
| 1196 | //this is to allow forced setting on page load, theme swap, etc | 1109 | //this is to allow forced setting on page load, theme swap, etc |
| 1197 | if (type === 'forced') { | 1110 | if (type === 'forced') { |
| 1198 | document.documentElement.style.setProperty('--fontScale', power_user.font_scale); | 1111 | document.documentElement.style.setProperty('--fontScale', String(power_user.font_scale)); |
| 1199 | } else { | 1112 | } else { |
| 1200 | //this is to prevent the slider from updating page in real time | 1113 | //this is to prevent the slider from updating page in real time |
| 1201 | $('#font_scale').off('mouseup touchend').on('mouseup touchend', () => { | 1114 | $('#font_scale').off('mouseup touchend').on('mouseup touchend', () => { |
| 1202 | document.documentElement.style.setProperty('--fontScale', power_user.font_scale); | 1115 | document.documentElement.style.setProperty('--fontScale', String(power_user.font_scale)); |
| 1203 | }); | 1116 | }); |
| 1204 | } | 1117 | } |
| 1205 | 1118 | ||
| @@ -1228,64 +1141,55 @@ async function applyTheme(name) { | |||
| 1228 | { | 1141 | { |
| 1229 | key: 'blur_strength', | 1142 | key: 'blur_strength', |
| 1230 | action: async () => { | 1143 | action: async () => { |
| 1231 | localStorage.setItem(storage_keys.blur_strength, power_user.blur_strength); | ||
| 1232 | await applyBlurStrength(); | 1144 | await applyBlurStrength(); |
| 1233 | }, | 1145 | }, |
| 1234 | }, | 1146 | }, |
| 1235 | { | 1147 | { |
| 1236 | key: 'custom_css', | 1148 | key: 'custom_css', |
| 1237 | action: async () => { | 1149 | action: async () => { |
| 1238 | localStorage.setItem(storage_keys.custom_css, power_user.custom_css); | ||
| 1239 | await applyCustomCSS(); | 1150 | await applyCustomCSS(); |
| 1240 | }, | 1151 | }, |
| 1241 | }, | 1152 | }, |
| 1242 | { | 1153 | { |
| 1243 | key: 'shadow_width', | 1154 | key: 'shadow_width', |
| 1244 | action: async () => { | 1155 | action: async () => { |
| 1245 | localStorage.setItem(storage_keys.shadow_width, power_user.shadow_width); | ||
| 1246 | await applyShadowWidth(); | 1156 | await applyShadowWidth(); |
| 1247 | }, | 1157 | }, |
| 1248 | }, | 1158 | }, |
| 1249 | { | 1159 | { |
| 1250 | key: 'font_scale', | 1160 | key: 'font_scale', |
| 1251 | action: async () => { | 1161 | action: async () => { |
| 1252 | localStorage.setItem(storage_keys.font_scale, power_user.font_scale); | ||
| 1253 | await applyFontScale('forced'); | 1162 | await applyFontScale('forced'); |
| 1254 | }, | 1163 | }, |
| 1255 | }, | 1164 | }, |
| 1256 | { | 1165 | { |
| 1257 | key: 'fast_ui_mode', | 1166 | key: 'fast_ui_mode', |
| 1258 | action: async () => { | 1167 | action: async () => { |
| 1259 | localStorage.setItem(storage_keys.fast_ui_mode, power_user.fast_ui_mode); | ||
| 1260 | switchUiMode(); | 1168 | switchUiMode(); |
| 1261 | }, | 1169 | }, |
| 1262 | }, | 1170 | }, |
| 1263 | { | 1171 | { |
| 1264 | key: 'waifuMode', | 1172 | key: 'waifuMode', |
| 1265 | action: async () => { | 1173 | action: async () => { |
| 1266 | localStorage.setItem(storage_keys.waifuMode, power_user.waifuMode); | ||
| 1267 | switchWaifuMode(); | 1174 | switchWaifuMode(); |
| 1268 | }, | 1175 | }, |
| 1269 | }, | 1176 | }, |
| 1270 | { | 1177 | { |
| 1271 | key: 'chat_display', | 1178 | key: 'chat_display', |
| 1272 | action: async () => { | 1179 | action: async () => { |
| 1273 | localStorage.setItem(storage_keys.chat_display, power_user.chat_display); | ||
| 1274 | applyChatDisplay(); | 1180 | applyChatDisplay(); |
| 1275 | }, | 1181 | }, |
| 1276 | }, | 1182 | }, |
| 1277 | { | 1183 | { |
| 1278 | key: 'avatar_style', | 1184 | key: 'avatar_style', |
| 1279 | action: async () => { | 1185 | action: async () => { |
| 1280 | localStorage.setItem(storage_keys.avatar_style, power_user.avatar_style); | ||
| 1281 | applyAvatarStyle(); | 1186 | applyAvatarStyle(); |
| 1282 | }, | 1187 | }, |
| 1283 | }, | 1188 | }, |
| 1284 | { | 1189 | { |
| 1285 | key: 'noShadows', | 1190 | key: 'noShadows', |
| 1286 | action: async () => { | 1191 | action: async () => { |
| 1287 | localStorage.setItem(storage_keys.noShadows, power_user.noShadows); | 1192 | applyNoShadows(); |
| 1288 | noShadows(); | ||
| 1289 | }, | 1193 | }, |
| 1290 | }, | 1194 | }, |
| 1291 | { | 1195 | { |
| @@ -1295,78 +1199,66 @@ async function applyTheme(name) { | |||
| 1295 | if (!power_user.chat_width) { | 1199 | if (!power_user.chat_width) { |
| 1296 | power_user.chat_width = 50; | 1200 | power_user.chat_width = 50; |
| 1297 | } | 1201 | } |
| 1298 | |||
| 1299 | localStorage.setItem(storage_keys.chat_width, String(power_user.chat_width)); | ||
| 1300 | applyChatWidth('forced'); | 1202 | applyChatWidth('forced'); |
| 1301 | }, | 1203 | }, |
| 1302 | }, | 1204 | }, |
| 1303 | { | 1205 | { |
| 1304 | key: 'timer_enabled', | 1206 | key: 'timer_enabled', |
| 1305 | action: async () => { | 1207 | action: async () => { |
| 1306 | localStorage.setItem(storage_keys.timer_enabled, Boolean(power_user.timer_enabled)); | ||
| 1307 | switchTimer(); | 1208 | switchTimer(); |
| 1308 | }, | 1209 | }, |
| 1309 | }, | 1210 | }, |
| 1310 | { | 1211 | { |
| 1311 | key: 'timestamps_enabled', | 1212 | key: 'timestamps_enabled', |
| 1312 | action: async () => { | 1213 | action: async () => { |
| 1313 | localStorage.setItem(storage_keys.timestamps_enabled, Boolean(power_user.timestamps_enabled)); | ||
| 1314 | switchTimestamps(); | 1214 | switchTimestamps(); |
| 1315 | }, | 1215 | }, |
| 1316 | }, | 1216 | }, |
| 1317 | { | 1217 | { |
| 1318 | key: 'timestamp_model_icon', | 1218 | key: 'timestamp_model_icon', |
| 1319 | action: async () => { | 1219 | action: async () => { |
| 1320 | localStorage.setItem(storage_keys.timestamp_model_icon, Boolean(power_user.timestamp_model_icon)); | ||
| 1321 | switchIcons(); | 1220 | switchIcons(); |
| 1322 | }, | 1221 | }, |
| 1323 | }, | 1222 | }, |
| 1324 | { | 1223 | { |
| 1325 | key: 'message_token_count_enabled', | 1224 | key: 'message_token_count_enabled', |
| 1326 | action: async () => { | 1225 | action: async () => { |
| 1327 | localStorage.setItem(storage_keys.message_token_count_enabled, Boolean(power_user.message_token_count_enabled)); | ||
| 1328 | switchTokenCount(); | 1226 | switchTokenCount(); |
| 1329 | }, | 1227 | }, |
| 1330 | }, | 1228 | }, |
| 1331 | { | 1229 | { |
| 1332 | key: 'mesIDDisplay_enabled', | 1230 | key: 'mesIDDisplay_enabled', |
| 1333 | action: async () => { | 1231 | action: async () => { |
| 1334 | localStorage.setItem(storage_keys.mesIDDisplay_enabled, Boolean(power_user.mesIDDisplay_enabled)); | ||
| 1335 | switchMesIDDisplay(); | 1232 | switchMesIDDisplay(); |
| 1336 | }, | 1233 | }, |
| 1337 | }, | 1234 | }, |
| 1338 | { | 1235 | { |
| 1339 | key: 'hideChatAvatars_enabled', | 1236 | key: 'hideChatAvatars_enabled', |
| 1340 | action: async () => { | 1237 | action: async () => { |
| 1341 | localStorage.setItem(storage_keys.hideChatAvatars_enabled, Boolean(power_user.hideChatAvatars_enabled)); | ||
| 1342 | switchHideChatAvatars(); | 1238 | switchHideChatAvatars(); |
| 1343 | }, | 1239 | }, |
| 1344 | }, | 1240 | }, |
| 1345 | { | 1241 | { |
| 1346 | key: 'expand_message_actions', | 1242 | key: 'expand_message_actions', |
| 1347 | action: async () => { | 1243 | action: async () => { |
| 1348 | localStorage.setItem(storage_keys.expand_message_actions, Boolean(power_user.expand_message_actions)); | ||
| 1349 | switchMessageActions(); | 1244 | switchMessageActions(); |
| 1350 | }, | 1245 | }, |
| 1351 | }, | 1246 | }, |
| 1352 | { | 1247 | { |
| 1353 | key: 'enableZenSliders', | 1248 | key: 'enableZenSliders', |
| 1354 | action: async () => { | 1249 | action: async () => { |
| 1355 | localStorage.setItem(storage_keys.enableZenSliders, Boolean(power_user.enableZenSliders)); | ||
| 1356 | switchMessageActions(); | 1250 | switchMessageActions(); |
| 1357 | }, | 1251 | }, |
| 1358 | }, | 1252 | }, |
| 1359 | { | 1253 | { |
| 1360 | key: 'enableLabMode', | 1254 | key: 'enableLabMode', |
| 1361 | action: async () => { | 1255 | action: async () => { |
| 1362 | localStorage.setItem(storage_keys.enableLabMode, Boolean(power_user.enableLabMode)); | ||
| 1363 | switchMessageActions(); | 1256 | switchMessageActions(); |
| 1364 | }, | 1257 | }, |
| 1365 | }, | 1258 | }, |
| 1366 | { | 1259 | { |
| 1367 | key: 'hotswap_enabled', | 1260 | key: 'hotswap_enabled', |
| 1368 | action: async () => { | 1261 | action: async () => { |
| 1369 | localStorage.setItem(storage_keys.hotswap_enabled, Boolean(power_user.hotswap_enabled)); | ||
| 1370 | switchHotswap(); | 1262 | switchHotswap(); |
| 1371 | }, | 1263 | }, |
| 1372 | }, | 1264 | }, |
| @@ -1387,7 +1279,6 @@ async function applyTheme(name) { | |||
| 1387 | { | 1279 | { |
| 1388 | key: 'reduced_motion', | 1280 | key: 'reduced_motion', |
| 1389 | action: async () => { | 1281 | action: async () => { |
| 1390 | localStorage.setItem(storage_keys.reduced_motion, String(power_user.reduced_motion)); | ||
| 1391 | $('#reduced_motion').prop('checked', power_user.reduced_motion); | 1282 | $('#reduced_motion').prop('checked', power_user.reduced_motion); |
| 1392 | switchReducedMotion(); | 1283 | switchReducedMotion(); |
| 1393 | }, | 1284 | }, |
| @@ -1395,7 +1286,6 @@ async function applyTheme(name) { | |||
| 1395 | { | 1286 | { |
| 1396 | key: 'compact_input_area', | 1287 | key: 'compact_input_area', |
| 1397 | action: async () => { | 1288 | action: async () => { |
| 1398 | localStorage.setItem(storage_keys.compact_input_area, String(power_user.compact_input_area)); | ||
| 1399 | $('#compact_input_area').prop('checked', power_user.compact_input_area); | 1289 | $('#compact_input_area').prop('checked', power_user.compact_input_area); |
| 1400 | switchCompactInputArea(); | 1290 | switchCompactInputArea(); |
| 1401 | }, | 1291 | }, |
| @@ -1450,24 +1340,26 @@ async function showDebugMenu() { | |||
| 1450 | callGenericPopup(template, POPUP_TYPE.TEXT, '', { wide: true, large: true, allowVerticalScrolling: true }); | 1340 | callGenericPopup(template, POPUP_TYPE.TEXT, '', { wide: true, large: true, allowVerticalScrolling: true }); |
| 1451 | } | 1341 | } |
| 1452 | 1342 | ||
| 1453 | switchUiMode(); | 1343 | function applyPowerUserSettings() { |
| 1454 | applyFontScale('forced'); | 1344 | switchUiMode(); |
| 1455 | applyThemeColor(); | 1345 | applyFontScale('forced'); |
| 1456 | applyChatWidth('forced'); | 1346 | applyThemeColor(); |
| 1457 | applyAvatarStyle(); | 1347 | applyChatWidth('forced'); |
| 1458 | applyBlurStrength(); | 1348 | applyAvatarStyle(); |
| 1459 | applyShadowWidth(); | 1349 | applyBlurStrength(); |
| 1460 | applyCustomCSS(); | 1350 | applyShadowWidth(); |
| 1461 | switchMovingUI(); | 1351 | applyCustomCSS(); |
| 1462 | noShadows(); | 1352 | switchMovingUI(); |
| 1463 | switchHotswap(); | 1353 | applyNoShadows(); |
| 1464 | switchTimer(); | 1354 | switchHotswap(); |
| 1465 | switchTimestamps(); | 1355 | switchTimer(); |
| 1466 | switchIcons(); | 1356 | switchTimestamps(); |
| 1467 | switchMesIDDisplay(); | 1357 | switchIcons(); |
| 1468 | switchHideChatAvatars(); | 1358 | switchMesIDDisplay(); |
| 1469 | switchTokenCount(); | 1359 | switchHideChatAvatars(); |
| 1470 | switchMessageActions(); | 1360 | switchTokenCount(); |
| 1361 | switchMessageActions(); | ||
| 1362 | } | ||
| 1471 | 1363 | ||
| 1472 | function getExampleMessagesBehavior() { | 1364 | function getExampleMessagesBehavior() { |
| 1473 | if (power_user.strip_examples) { | 1365 | if (power_user.strip_examples) { |
| @@ -1531,17 +1423,6 @@ async function loadPowerUserSettings(settings, data) { | |||
| 1531 | } | 1423 | } |
| 1532 | 1424 | ||
| 1533 | // These are still local storage | 1425 | // 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); | ||
| 1545 | const autoLoadChat = localStorage.getItem(storage_keys.auto_load_chat_legacy); | 1426 | const autoLoadChat = localStorage.getItem(storage_keys.auto_load_chat_legacy); |
| 1546 | const autoConnect = localStorage.getItem(storage_keys.auto_connect_legacy); | 1427 | const autoConnect = localStorage.getItem(storage_keys.auto_connect_legacy); |
| 1547 | 1428 | ||
| @@ -1555,23 +1436,6 @@ async function loadPowerUserSettings(settings, data) { | |||
| 1555 | localStorage.removeItem(storage_keys.auto_connect_legacy); | 1436 | localStorage.removeItem(storage_keys.auto_connect_legacy); |
| 1556 | } | 1437 | } |
| 1557 | 1438 | ||
| 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 | |||
| 1575 | if (power_user.chat_display === '') { | 1439 | if (power_user.chat_display === '') { |
| 1576 | power_user.chat_display = chat_styles.DEFAULT; | 1440 | power_user.chat_display = chat_styles.DEFAULT; |
| 1577 | } | 1441 | } |
| @@ -3298,10 +3162,8 @@ $(document).ready(() => { | |||
| 3298 | saveSettingsDebounced(); | 3162 | saveSettingsDebounced(); |
| 3299 | }); | 3163 | }); |
| 3300 | 3164 | ||
| 3301 | // Settings that go to local storage | ||
| 3302 | $('#fast_ui_mode').change(function () { | 3165 | $('#fast_ui_mode').change(function () { |
| 3303 | power_user.fast_ui_mode = $(this).prop('checked'); | 3166 | power_user.fast_ui_mode = $(this).prop('checked'); |
| 3304 | localStorage.setItem(storage_keys.fast_ui_mode, power_user.fast_ui_mode); | ||
| 3305 | switchUiMode(); | 3167 | switchUiMode(); |
| 3306 | saveSettingsDebounced(); | 3168 | saveSettingsDebounced(); |
| 3307 | }); | 3169 | }); |
| @@ -3314,22 +3176,19 @@ $(document).ready(() => { | |||
| 3314 | 3176 | ||
| 3315 | $('#customCSS').on('input', () => { | 3177 | $('#customCSS').on('input', () => { |
| 3316 | power_user.custom_css = String($('#customCSS').val()); | 3178 | power_user.custom_css = String($('#customCSS').val()); |
| 3317 | localStorage.setItem(storage_keys.custom_css, power_user.custom_css); | ||
| 3318 | saveSettingsDebounced(); | 3179 | saveSettingsDebounced(); |
| 3319 | applyCustomCSS(); | 3180 | applyCustomCSS(); |
| 3320 | }); | 3181 | }); |
| 3321 | 3182 | ||
| 3322 | $('#movingUImode').change(function () { | 3183 | $('#movingUImode').change(function () { |
| 3323 | power_user.movingUI = $(this).prop('checked'); | 3184 | power_user.movingUI = $(this).prop('checked'); |
| 3324 | localStorage.setItem(storage_keys.movingUI, power_user.movingUI); | ||
| 3325 | switchMovingUI(); | 3185 | switchMovingUI(); |
| 3326 | saveSettingsDebounced(); | 3186 | saveSettingsDebounced(); |
| 3327 | }); | 3187 | }); |
| 3328 | 3188 | ||
| 3329 | $('#noShadowsmode').change(function () { | 3189 | $('#noShadowsmode').change(function () { |
| 3330 | power_user.noShadows = $(this).prop('checked'); | 3190 | power_user.noShadows = $(this).prop('checked'); |
| 3331 | localStorage.setItem(storage_keys.noShadows, power_user.noShadows); | 3191 | applyNoShadows(); |
| 3332 | noShadows(); | ||
| 3333 | saveSettingsDebounced(); | 3192 | saveSettingsDebounced(); |
| 3334 | }); | 3193 | }); |
| 3335 | 3194 | ||
| @@ -3338,7 +3197,6 @@ $(document).ready(() => { | |||
| 3338 | $('#avatar_style').on('change', function () { | 3197 | $('#avatar_style').on('change', function () { |
| 3339 | const value = $(this).find(':selected').val(); | 3198 | const value = $(this).find(':selected').val(); |
| 3340 | power_user.avatar_style = Number(value); | 3199 | power_user.avatar_style = Number(value); |
| 3341 | localStorage.setItem(storage_keys.avatar_style, power_user.avatar_style); | ||
| 3342 | applyAvatarStyle(); | 3200 | applyAvatarStyle(); |
| 3343 | saveSettingsDebounced(); | 3201 | saveSettingsDebounced(); |
| 3344 | }); | 3202 | }); |
| @@ -3346,17 +3204,15 @@ $(document).ready(() => { | |||
| 3346 | $('#chat_display').on('change', function () { | 3204 | $('#chat_display').on('change', function () { |
| 3347 | const value = $(this).find(':selected').val(); | 3205 | const value = $(this).find(':selected').val(); |
| 3348 | power_user.chat_display = Number(value); | 3206 | power_user.chat_display = Number(value); |
| 3349 | localStorage.setItem(storage_keys.chat_display, power_user.chat_display); | ||
| 3350 | applyChatDisplay(); | 3207 | applyChatDisplay(); |
| 3351 | saveSettingsDebounced(); | 3208 | saveSettingsDebounced(); |
| 3352 | |||
| 3353 | }); | 3209 | }); |
| 3354 | 3210 | ||
| 3355 | $('#chat_width_slider').on('input', function (e, data) { | 3211 | $('#chat_width_slider').on('input', function (e, data) { |
| 3356 | const applyMode = data?.forced ? 'forced' : 'normal'; | 3212 | const applyMode = data?.forced ? 'forced' : 'normal'; |
| 3357 | power_user.chat_width = Number(e.target.value); | 3213 | power_user.chat_width = Number(e.target.value); |
| 3358 | localStorage.setItem(storage_keys.chat_width, power_user.chat_width); | ||
| 3359 | applyChatWidth(applyMode); | 3214 | applyChatWidth(applyMode); |
| 3215 | saveSettingsDebounced(); | ||
| 3360 | setHotswapsDebounced(); | 3216 | setHotswapsDebounced(); |
| 3361 | }); | 3217 | }); |
| 3362 | 3218 | ||
| @@ -3386,7 +3242,6 @@ $(document).ready(() => { | |||
| 3386 | const applyMode = data?.forced ? 'forced' : 'normal'; | 3242 | const applyMode = data?.forced ? 'forced' : 'normal'; |
| 3387 | power_user.font_scale = Number(e.target.value); | 3243 | power_user.font_scale = Number(e.target.value); |
| 3388 | $('#font_scale_counter').val(power_user.font_scale); | 3244 | $('#font_scale_counter').val(power_user.font_scale); |
| 3389 | localStorage.setItem(storage_keys.font_scale, power_user.font_scale); | ||
| 3390 | await applyFontScale(applyMode); | 3245 | await applyFontScale(applyMode); |
| 3391 | saveSettingsDebounced(); | 3246 | saveSettingsDebounced(); |
| 3392 | }); | 3247 | }); |
| @@ -3394,7 +3249,6 @@ $(document).ready(() => { | |||
| 3394 | $('input[name="blur_strength"]').on('input', async function (e) { | 3249 | $('input[name="blur_strength"]').on('input', async function (e) { |
| 3395 | power_user.blur_strength = Number(e.target.value); | 3250 | power_user.blur_strength = Number(e.target.value); |
| 3396 | $('#blur_strength_counter').val(power_user.blur_strength); | 3251 | $('#blur_strength_counter').val(power_user.blur_strength); |
| 3397 | localStorage.setItem(storage_keys.blur_strength, power_user.blur_strength); | ||
| 3398 | await applyBlurStrength(); | 3252 | await applyBlurStrength(); |
| 3399 | saveSettingsDebounced(); | 3253 | saveSettingsDebounced(); |
| 3400 | }); | 3254 | }); |
| @@ -3402,7 +3256,6 @@ $(document).ready(() => { | |||
| 3402 | $('input[name="shadow_width"]').on('input', async function (e) { | 3256 | $('input[name="shadow_width"]').on('input', async function (e) { |
| 3403 | power_user.shadow_width = Number(e.target.value); | 3257 | power_user.shadow_width = Number(e.target.value); |
| 3404 | $('#shadow_width_counter').val(power_user.shadow_width); | 3258 | $('#shadow_width_counter').val(power_user.shadow_width); |
| 3405 | localStorage.setItem(storage_keys.shadow_width, power_user.shadow_width); | ||
| 3406 | await applyShadowWidth(); | 3259 | await applyShadowWidth(); |
| 3407 | saveSettingsDebounced(); | 3260 | saveSettingsDebounced(); |
| 3408 | }); | 3261 | }); |
| @@ -3643,35 +3496,35 @@ $(document).ready(() => { | |||
| 3643 | $('#messageTimerEnabled').on('input', function () { | 3496 | $('#messageTimerEnabled').on('input', function () { |
| 3644 | const value = !!$(this).prop('checked'); | 3497 | const value = !!$(this).prop('checked'); |
| 3645 | power_user.timer_enabled = value; | 3498 | power_user.timer_enabled = value; |
| 3646 | localStorage.setItem(storage_keys.timer_enabled, Boolean(power_user.timer_enabled)); | 3499 | saveSettingsDebounced(); |
| 3647 | switchTimer(); | 3500 | switchTimer(); |
| 3648 | }); | 3501 | }); |
| 3649 | 3502 | ||
| 3650 | $('#messageTimestampsEnabled').on('input', function () { | 3503 | $('#messageTimestampsEnabled').on('input', function () { |
| 3651 | const value = !!$(this).prop('checked'); | 3504 | const value = !!$(this).prop('checked'); |
| 3652 | power_user.timestamps_enabled = value; | 3505 | power_user.timestamps_enabled = value; |
| 3653 | localStorage.setItem(storage_keys.timestamps_enabled, Boolean(power_user.timestamps_enabled)); | 3506 | saveSettingsDebounced(); |
| 3654 | switchTimestamps(); | 3507 | switchTimestamps(); |
| 3655 | }); | 3508 | }); |
| 3656 | 3509 | ||
| 3657 | $('#messageModelIconEnabled').on('input', function () { | 3510 | $('#messageModelIconEnabled').on('input', function () { |
| 3658 | const value = !!$(this).prop('checked'); | 3511 | const value = !!$(this).prop('checked'); |
| 3659 | power_user.timestamp_model_icon = value; | 3512 | power_user.timestamp_model_icon = value; |
| 3660 | localStorage.setItem(storage_keys.timestamp_model_icon, Boolean(power_user.timestamp_model_icon)); | 3513 | saveSettingsDebounced(); |
| 3661 | switchIcons(); | 3514 | switchIcons(); |
| 3662 | }); | 3515 | }); |
| 3663 | 3516 | ||
| 3664 | $('#messageTokensEnabled').on('input', function () { | 3517 | $('#messageTokensEnabled').on('input', function () { |
| 3665 | const value = !!$(this).prop('checked'); | 3518 | const value = !!$(this).prop('checked'); |
| 3666 | power_user.message_token_count_enabled = value; | 3519 | 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(); |
| 3668 | switchTokenCount(); | 3521 | switchTokenCount(); |
| 3669 | }); | 3522 | }); |
| 3670 | 3523 | ||
| 3671 | $('#expandMessageActions').on('input', function () { | 3524 | $('#expandMessageActions').on('input', function () { |
| 3672 | const value = !!$(this).prop('checked'); | 3525 | const value = !!$(this).prop('checked'); |
| 3673 | power_user.expand_message_actions = value; | 3526 | power_user.expand_message_actions = value; |
| 3674 | localStorage.setItem(storage_keys.expand_message_actions, Boolean(power_user.expand_message_actions)); | 3527 | saveSettingsDebounced(); |
| 3675 | switchMessageActions(); | 3528 | switchMessageActions(); |
| 3676 | }); | 3529 | }); |
| 3677 | 3530 | ||
| @@ -3684,7 +3537,6 @@ $(document).ready(() => { | |||
| 3684 | return; | 3537 | return; |
| 3685 | } | 3538 | } |
| 3686 | power_user.enableZenSliders = value; | 3539 | power_user.enableZenSliders = value; |
| 3687 | localStorage.setItem(storage_keys.enableZenSliders, Boolean(power_user.enableZenSliders)); | ||
| 3688 | saveSettingsDebounced(); | 3540 | saveSettingsDebounced(); |
| 3689 | switchZenSliders(); | 3541 | switchZenSliders(); |
| 3690 | }); | 3542 | }); |
| @@ -3699,7 +3551,6 @@ $(document).ready(() => { | |||
| 3699 | } | 3551 | } |
| 3700 | 3552 | ||
| 3701 | power_user.enableLabMode = value; | 3553 | power_user.enableLabMode = value; |
| 3702 | localStorage.setItem(storage_keys.enableLabMode, Boolean(power_user.enableLabMode)); | ||
| 3703 | saveSettingsDebounced(); | 3554 | saveSettingsDebounced(); |
| 3704 | switchLabMode(); | 3555 | switchLabMode(); |
| 3705 | }); | 3556 | }); |
| @@ -3707,22 +3558,22 @@ $(document).ready(() => { | |||
| 3707 | $('#mesIDDisplayEnabled').on('input', function () { | 3558 | $('#mesIDDisplayEnabled').on('input', function () { |
| 3708 | const value = !!$(this).prop('checked'); | 3559 | const value = !!$(this).prop('checked'); |
| 3709 | power_user.mesIDDisplay_enabled = value; | 3560 | power_user.mesIDDisplay_enabled = value; |
| 3710 | localStorage.setItem(storage_keys.mesIDDisplay_enabled, Boolean(power_user.mesIDDisplay_enabled)); | 3561 | saveSettingsDebounced(); |
| 3711 | switchMesIDDisplay(); | 3562 | switchMesIDDisplay(); |
| 3712 | }); | 3563 | }); |
| 3713 | 3564 | ||
| 3714 | $('#hideChatAvatarsEnabled').on('input', function () { | 3565 | $('#hideChatAvatarsEnabled').on('input', function () { |
| 3715 | const value = !!$(this).prop('checked'); | 3566 | const value = !!$(this).prop('checked'); |
| 3716 | power_user.hideChatAvatars_enabled = value; | 3567 | power_user.hideChatAvatars_enabled = value; |
| 3717 | localStorage.setItem(storage_keys.hideChatAvatars_enabled, Boolean(power_user.hideChatAvatars_enabled)); | 3568 | saveSettingsDebounced(); |
| 3718 | switchHideChatAvatars(); | 3569 | switchHideChatAvatars(); |
| 3719 | }); | 3570 | }); |
| 3720 | 3571 | ||
| 3721 | $('#hotswapEnabled').on('input', function () { | 3572 | $('#hotswapEnabled').on('input', function () { |
| 3722 | const value = !!$(this).prop('checked'); | 3573 | const value = !!$(this).prop('checked'); |
| 3723 | power_user.hotswap_enabled = value; | 3574 | power_user.hotswap_enabled = value; |
| 3724 | localStorage.setItem(storage_keys.hotswap_enabled, Boolean(power_user.hotswap_enabled)); | ||
| 3725 | switchHotswap(); | 3575 | switchHotswap(); |
| 3576 | saveSettingsDebounced(); | ||
| 3726 | }); | 3577 | }); |
| 3727 | 3578 | ||
| 3728 | $('#prefer_character_prompt').on('input', function () { | 3579 | $('#prefer_character_prompt').on('input', function () { |
| @@ -3935,14 +3786,12 @@ $(document).ready(() => { | |||
| 3935 | 3786 | ||
| 3936 | $('#reduced_motion').on('input', function () { | 3787 | $('#reduced_motion').on('input', function () { |
| 3937 | power_user.reduced_motion = !!$(this).prop('checked'); | 3788 | power_user.reduced_motion = !!$(this).prop('checked'); |
| 3938 | localStorage.setItem(storage_keys.reduced_motion, String(power_user.reduced_motion)); | ||
| 3939 | switchReducedMotion(); | 3789 | switchReducedMotion(); |
| 3940 | saveSettingsDebounced(); | 3790 | saveSettingsDebounced(); |
| 3941 | }); | 3791 | }); |
| 3942 | 3792 | ||
| 3943 | $('#compact_input_area').on('input', function () { | 3793 | $('#compact_input_area').on('input', function () { |
| 3944 | power_user.compact_input_area = !!$(this).prop('checked'); | 3794 | power_user.compact_input_area = !!$(this).prop('checked'); |
| 3945 | localStorage.setItem(storage_keys.compact_input_area, String(power_user.compact_input_area)); | ||
| 3946 | switchCompactInputArea(); | 3795 | switchCompactInputArea(); |
| 3947 | saveSettingsDebounced(); | 3796 | saveSettingsDebounced(); |
| 3948 | }); | 3797 | }); |