mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge branch 'staging' into pr/Cohee1207/2711
This commit is contained in:
@@ -60,6 +60,7 @@ export {
|
||||
power_user,
|
||||
send_on_enter_options,
|
||||
getContextSettings,
|
||||
applyPowerUserSettings,
|
||||
};
|
||||
|
||||
export const MAX_CONTEXT_DEFAULT = 8192;
|
||||
@@ -202,6 +203,7 @@ let power_user = {
|
||||
trim_spaces: true,
|
||||
relaxed_api_urls: false,
|
||||
world_import_dialog: true,
|
||||
enable_auto_select_input: false,
|
||||
tag_import_setting: tag_import_setting.ASK,
|
||||
disable_group_trimming: false,
|
||||
single_line: false,
|
||||
@@ -300,45 +302,9 @@ let movingUIPresets = [];
|
||||
export let context_presets = [];
|
||||
|
||||
const storage_keys = {
|
||||
fast_ui_mode: 'TavernAI_fast_ui_mode',
|
||||
avatar_style: 'TavernAI_avatar_style',
|
||||
chat_display: 'TavernAI_chat_display',
|
||||
chat_width: 'chat_width',
|
||||
font_scale: 'TavernAI_font_scale',
|
||||
|
||||
main_text_color: 'TavernAI_main_text_color',
|
||||
italics_text_color: 'TavernAI_italics_text_color',
|
||||
underline_text_color: 'TavernAI_underline_text_color',
|
||||
quote_text_color: 'TavernAI_quote_text_color',
|
||||
blur_tint_color: 'TavernAI_blur_tint_color',
|
||||
chat_tint_color: 'TavernAI_chat_tint_color',
|
||||
user_mes_blur_tint_color: 'TavernAI_user_mes_blur_tint_color',
|
||||
bot_mes_blur_tint_color: 'TavernAI_bot_mes_blur_tint_color',
|
||||
blur_strength: 'TavernAI_blur_strength',
|
||||
shadow_color: 'TavernAI_shadow_color',
|
||||
shadow_width: 'TavernAI_shadow_width',
|
||||
border_color: 'TavernAI_border_color',
|
||||
|
||||
custom_css: 'TavernAI_custom_css',
|
||||
|
||||
waifuMode: 'TavernAI_waifuMode',
|
||||
movingUI: 'TavernAI_movingUI',
|
||||
noShadows: 'TavernAI_noShadows',
|
||||
|
||||
hotswap_enabled: 'HotswapEnabled',
|
||||
timer_enabled: 'TimerEnabled',
|
||||
timestamps_enabled: 'TimestampsEnabled',
|
||||
timestamp_model_icon: 'TimestampModelIcon',
|
||||
mesIDDisplay_enabled: 'mesIDDisplayEnabled',
|
||||
hideChatAvatars_enabled: 'hideChatAvatarsEnabled',
|
||||
message_token_count_enabled: 'MessageTokenCountEnabled',
|
||||
expand_message_actions: 'ExpandMessageActions',
|
||||
enableZenSliders: 'enableZenSliders',
|
||||
enableLabMode: 'enableLabMode',
|
||||
reduced_motion: 'reduced_motion',
|
||||
compact_input_area: 'compact_input_area',
|
||||
auto_connect_legacy: 'AutoConnectEnabled',
|
||||
auto_load_chat_legacy: 'AutoLoadChatEnabled',
|
||||
hideChatAvatars_legacy: 'hideChatAvatarsEnabled',
|
||||
|
||||
storyStringValidationCache: 'StoryStringValidationCache',
|
||||
};
|
||||
@@ -458,73 +424,47 @@ function fixMarkdown(text, forDisplay) {
|
||||
}
|
||||
|
||||
function switchHotswap() {
|
||||
const value = localStorage.getItem(storage_keys.hotswap_enabled);
|
||||
power_user.hotswap_enabled = value === null ? true : value == 'true';
|
||||
$('body').toggleClass('no-hotswap', !power_user.hotswap_enabled);
|
||||
$('#hotswapEnabled').prop('checked', power_user.hotswap_enabled);
|
||||
}
|
||||
|
||||
function switchTimer() {
|
||||
const value = localStorage.getItem(storage_keys.timer_enabled);
|
||||
power_user.timer_enabled = value === null ? true : value == 'true';
|
||||
$('body').toggleClass('no-timer', !power_user.timer_enabled);
|
||||
$('#messageTimerEnabled').prop('checked', power_user.timer_enabled);
|
||||
}
|
||||
|
||||
function switchTimestamps() {
|
||||
const value = localStorage.getItem(storage_keys.timestamps_enabled);
|
||||
power_user.timestamps_enabled = value === null ? true : value == 'true';
|
||||
$('body').toggleClass('no-timestamps', !power_user.timestamps_enabled);
|
||||
$('#messageTimestampsEnabled').prop('checked', power_user.timestamps_enabled);
|
||||
}
|
||||
|
||||
function switchIcons() {
|
||||
const value = localStorage.getItem(storage_keys.timestamp_model_icon);
|
||||
power_user.timestamp_model_icon = value === null ? true : value == 'true';
|
||||
$('body').toggleClass('no-modelIcons', !power_user.timestamp_model_icon);
|
||||
$('#messageModelIconEnabled').prop('checked', power_user.timestamp_model_icon);
|
||||
}
|
||||
|
||||
function switchTokenCount() {
|
||||
const value = localStorage.getItem(storage_keys.message_token_count_enabled);
|
||||
power_user.message_token_count_enabled = value === null ? false : value == 'true';
|
||||
$('body').toggleClass('no-tokenCount', !power_user.message_token_count_enabled);
|
||||
$('#messageTokensEnabled').prop('checked', power_user.message_token_count_enabled);
|
||||
}
|
||||
|
||||
function switchMesIDDisplay() {
|
||||
const value = localStorage.getItem(storage_keys.mesIDDisplay_enabled);
|
||||
power_user.mesIDDisplay_enabled = value === null ? true : value == 'true';
|
||||
/* console.log(`
|
||||
localstorage value:${value},
|
||||
poweruser before:${before},
|
||||
poweruser after:${power_user.mesIDDisplay_enabled}`) */
|
||||
$('body').toggleClass('no-mesIDDisplay', !power_user.mesIDDisplay_enabled);
|
||||
$('#mesIDDisplayEnabled').prop('checked', power_user.mesIDDisplay_enabled);
|
||||
}
|
||||
|
||||
function switchHideChatAvatars() {
|
||||
const value = localStorage.getItem(storage_keys.hideChatAvatars_enabled);
|
||||
power_user.hideChatAvatars_enabled = value === null ? false : value == 'true';
|
||||
/*console.log(`
|
||||
localstorage value:${value},
|
||||
poweruser after:${power_user.hideChatAvatars_enabled}`)
|
||||
*/
|
||||
$('body').toggleClass('hideChatAvatars', power_user.hideChatAvatars_enabled);
|
||||
$('#hideChatAvatarsEnabled').prop('checked', power_user.hideChatAvatars_enabled);
|
||||
}
|
||||
|
||||
function switchMessageActions() {
|
||||
const value = localStorage.getItem(storage_keys.expand_message_actions);
|
||||
power_user.expand_message_actions = value === null ? false : value == 'true';
|
||||
$('body').toggleClass('expandMessageActions', power_user.expand_message_actions);
|
||||
$('#expandMessageActions').prop('checked', power_user.expand_message_actions);
|
||||
$('.extraMesButtons, .extraMesButtonsHint').removeAttr('style');
|
||||
}
|
||||
|
||||
function switchReducedMotion() {
|
||||
const value = localStorage.getItem(storage_keys.reduced_motion);
|
||||
power_user.reduced_motion = value === null ? false : value == 'true';
|
||||
jQuery.fx.off = power_user.reduced_motion;
|
||||
const overrideDuration = power_user.reduced_motion ? 0 : ANIMATION_DURATION_DEFAULT;
|
||||
setAnimationDuration(overrideDuration);
|
||||
@@ -533,8 +473,6 @@ function switchReducedMotion() {
|
||||
}
|
||||
|
||||
function switchCompactInputArea() {
|
||||
const value = localStorage.getItem(storage_keys.compact_input_area);
|
||||
power_user.compact_input_area = value === null ? true : value == 'true';
|
||||
$('#send_form').toggleClass('compact', power_user.compact_input_area);
|
||||
$('#compact_input_area').prop('checked', power_user.compact_input_area);
|
||||
}
|
||||
@@ -550,8 +488,6 @@ async function switchLabMode() {
|
||||
}
|
||||
*/
|
||||
await delay(100);
|
||||
const value = localStorage.getItem(storage_keys.enableLabMode);
|
||||
power_user.enableLabMode = value === null ? false : value == 'true';
|
||||
$('body').toggleClass('enableLabMode', power_user.enableLabMode);
|
||||
$('#enableLabMode').prop('checked', power_user.enableLabMode);
|
||||
|
||||
@@ -598,8 +534,6 @@ async function switchLabMode() {
|
||||
|
||||
async function switchZenSliders() {
|
||||
await delay(100);
|
||||
const value = localStorage.getItem(storage_keys.enableZenSliders);
|
||||
power_user.enableZenSliders = value === null ? false : value == 'true';
|
||||
$('body').toggleClass('enableZenSliders', power_user.enableZenSliders);
|
||||
$('#enableZenSliders').prop('checked', power_user.enableZenSliders);
|
||||
|
||||
@@ -971,8 +905,6 @@ async function CreateZenSliders(elmnt) {
|
||||
}
|
||||
}
|
||||
function switchUiMode() {
|
||||
const fastUi = localStorage.getItem(storage_keys.fast_ui_mode);
|
||||
power_user.fast_ui_mode = fastUi === null ? true : fastUi == 'true';
|
||||
$('body').toggleClass('no-blur', power_user.fast_ui_mode);
|
||||
$('#fast_ui_mode').prop('checked', power_user.fast_ui_mode);
|
||||
if (power_user.fast_ui_mode) {
|
||||
@@ -1022,8 +954,6 @@ function switchMovingUI() {
|
||||
$('.drawer-content.maximized').each(function () {
|
||||
$(this).find('.inline-drawer-maximize').trigger('click');
|
||||
});
|
||||
const movingUI = localStorage.getItem(storage_keys.movingUI);
|
||||
power_user.movingUI = movingUI === null ? false : movingUI == 'true';
|
||||
$('body').toggleClass('movingUI', power_user.movingUI);
|
||||
if (power_user.movingUI === true) {
|
||||
initMovingUI();
|
||||
@@ -1039,9 +969,7 @@ function switchMovingUI() {
|
||||
}
|
||||
}
|
||||
|
||||
function noShadows() {
|
||||
const noShadows = localStorage.getItem(storage_keys.noShadows);
|
||||
power_user.noShadows = noShadows === null ? false : noShadows == 'true';
|
||||
function applyNoShadows() {
|
||||
$('body').toggleClass('noShadows', power_user.noShadows);
|
||||
$('#noShadowsmode').prop('checked', power_user.noShadows);
|
||||
if (power_user.noShadows) {
|
||||
@@ -1055,12 +983,9 @@ function noShadows() {
|
||||
}
|
||||
|
||||
function applyAvatarStyle() {
|
||||
power_user.avatar_style = Number(localStorage.getItem(storage_keys.avatar_style) ?? avatar_styles.ROUND);
|
||||
$('body').toggleClass('big-avatars', power_user.avatar_style === avatar_styles.RECTANGULAR);
|
||||
$('body').toggleClass('square-avatars', power_user.avatar_style === avatar_styles.SQUARE);
|
||||
$('#avatar_style').val(power_user.avatar_style).prop('selected', true);
|
||||
//$(`input[name="avatar_style"][value="${power_user.avatar_style}"]`).prop("checked", true);
|
||||
|
||||
}
|
||||
|
||||
function applyChatDisplay() {
|
||||
@@ -1095,8 +1020,6 @@ function applyChatDisplay() {
|
||||
}
|
||||
|
||||
function applyChatWidth(type) {
|
||||
power_user.chat_width = Number(localStorage.getItem(storage_keys.chat_width) ?? 50);
|
||||
|
||||
if (type === 'forced') {
|
||||
let r = document.documentElement;
|
||||
r.style.setProperty('--sheldWidth', `${power_user.chat_width}vw`);
|
||||
@@ -1158,8 +1081,6 @@ async function applyThemeColor(type) {
|
||||
}
|
||||
|
||||
async function applyCustomCSS() {
|
||||
power_user.custom_css = String(localStorage.getItem(storage_keys.custom_css) ?? '');
|
||||
|
||||
$('#customCSS').val(power_user.custom_css);
|
||||
var styleId = 'custom-style';
|
||||
var style = document.getElementById(styleId);
|
||||
@@ -1173,32 +1094,26 @@ async function applyCustomCSS() {
|
||||
}
|
||||
|
||||
async function applyBlurStrength() {
|
||||
power_user.blur_strength = Number(localStorage.getItem(storage_keys.blur_strength) ?? 1);
|
||||
document.documentElement.style.setProperty('--blurStrength', power_user.blur_strength);
|
||||
document.documentElement.style.setProperty('--blurStrength', String(power_user.blur_strength));
|
||||
$('#blur_strength_counter').val(power_user.blur_strength);
|
||||
$('#blur_strength').val(power_user.blur_strength);
|
||||
|
||||
|
||||
}
|
||||
|
||||
async function applyShadowWidth() {
|
||||
power_user.shadow_width = Number(localStorage.getItem(storage_keys.shadow_width) ?? 2);
|
||||
document.documentElement.style.setProperty('--shadowWidth', power_user.shadow_width);
|
||||
document.documentElement.style.setProperty('--shadowWidth', String(power_user.shadow_width));
|
||||
$('#shadow_width_counter').val(power_user.shadow_width);
|
||||
$('#shadow_width').val(power_user.shadow_width);
|
||||
|
||||
}
|
||||
|
||||
async function applyFontScale(type) {
|
||||
|
||||
power_user.font_scale = Number(localStorage.getItem(storage_keys.font_scale) ?? 1);
|
||||
//this is to allow forced setting on page load, theme swap, etc
|
||||
if (type === 'forced') {
|
||||
document.documentElement.style.setProperty('--fontScale', power_user.font_scale);
|
||||
document.documentElement.style.setProperty('--fontScale', String(power_user.font_scale));
|
||||
} else {
|
||||
//this is to prevent the slider from updating page in real time
|
||||
$('#font_scale').off('mouseup touchend').on('mouseup touchend', () => {
|
||||
document.documentElement.style.setProperty('--fontScale', power_user.font_scale);
|
||||
document.documentElement.style.setProperty('--fontScale', String(power_user.font_scale));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1227,64 +1142,55 @@ async function applyTheme(name) {
|
||||
{
|
||||
key: 'blur_strength',
|
||||
action: async () => {
|
||||
localStorage.setItem(storage_keys.blur_strength, power_user.blur_strength);
|
||||
await applyBlurStrength();
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'custom_css',
|
||||
action: async () => {
|
||||
localStorage.setItem(storage_keys.custom_css, power_user.custom_css);
|
||||
await applyCustomCSS();
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'shadow_width',
|
||||
action: async () => {
|
||||
localStorage.setItem(storage_keys.shadow_width, power_user.shadow_width);
|
||||
await applyShadowWidth();
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'font_scale',
|
||||
action: async () => {
|
||||
localStorage.setItem(storage_keys.font_scale, power_user.font_scale);
|
||||
await applyFontScale('forced');
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'fast_ui_mode',
|
||||
action: async () => {
|
||||
localStorage.setItem(storage_keys.fast_ui_mode, power_user.fast_ui_mode);
|
||||
switchUiMode();
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'waifuMode',
|
||||
action: async () => {
|
||||
localStorage.setItem(storage_keys.waifuMode, power_user.waifuMode);
|
||||
switchWaifuMode();
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'chat_display',
|
||||
action: async () => {
|
||||
localStorage.setItem(storage_keys.chat_display, power_user.chat_display);
|
||||
applyChatDisplay();
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'avatar_style',
|
||||
action: async () => {
|
||||
localStorage.setItem(storage_keys.avatar_style, power_user.avatar_style);
|
||||
applyAvatarStyle();
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'noShadows',
|
||||
action: async () => {
|
||||
localStorage.setItem(storage_keys.noShadows, power_user.noShadows);
|
||||
noShadows();
|
||||
applyNoShadows();
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -1294,78 +1200,66 @@ async function applyTheme(name) {
|
||||
if (!power_user.chat_width) {
|
||||
power_user.chat_width = 50;
|
||||
}
|
||||
|
||||
localStorage.setItem(storage_keys.chat_width, String(power_user.chat_width));
|
||||
applyChatWidth('forced');
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'timer_enabled',
|
||||
action: async () => {
|
||||
localStorage.setItem(storage_keys.timer_enabled, Boolean(power_user.timer_enabled));
|
||||
switchTimer();
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'timestamps_enabled',
|
||||
action: async () => {
|
||||
localStorage.setItem(storage_keys.timestamps_enabled, Boolean(power_user.timestamps_enabled));
|
||||
switchTimestamps();
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'timestamp_model_icon',
|
||||
action: async () => {
|
||||
localStorage.setItem(storage_keys.timestamp_model_icon, Boolean(power_user.timestamp_model_icon));
|
||||
switchIcons();
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'message_token_count_enabled',
|
||||
action: async () => {
|
||||
localStorage.setItem(storage_keys.message_token_count_enabled, Boolean(power_user.message_token_count_enabled));
|
||||
switchTokenCount();
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'mesIDDisplay_enabled',
|
||||
action: async () => {
|
||||
localStorage.setItem(storage_keys.mesIDDisplay_enabled, Boolean(power_user.mesIDDisplay_enabled));
|
||||
switchMesIDDisplay();
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'hideChatAvatars_enabled',
|
||||
action: async () => {
|
||||
localStorage.setItem(storage_keys.hideChatAvatars_enabled, Boolean(power_user.hideChatAvatars_enabled));
|
||||
switchHideChatAvatars();
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'expand_message_actions',
|
||||
action: async () => {
|
||||
localStorage.setItem(storage_keys.expand_message_actions, Boolean(power_user.expand_message_actions));
|
||||
switchMessageActions();
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'enableZenSliders',
|
||||
action: async () => {
|
||||
localStorage.setItem(storage_keys.enableZenSliders, Boolean(power_user.enableZenSliders));
|
||||
switchMessageActions();
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'enableLabMode',
|
||||
action: async () => {
|
||||
localStorage.setItem(storage_keys.enableLabMode, Boolean(power_user.enableLabMode));
|
||||
switchMessageActions();
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'hotswap_enabled',
|
||||
action: async () => {
|
||||
localStorage.setItem(storage_keys.hotswap_enabled, Boolean(power_user.hotswap_enabled));
|
||||
switchHotswap();
|
||||
},
|
||||
},
|
||||
@@ -1386,7 +1280,6 @@ async function applyTheme(name) {
|
||||
{
|
||||
key: 'reduced_motion',
|
||||
action: async () => {
|
||||
localStorage.setItem(storage_keys.reduced_motion, String(power_user.reduced_motion));
|
||||
$('#reduced_motion').prop('checked', power_user.reduced_motion);
|
||||
switchReducedMotion();
|
||||
},
|
||||
@@ -1394,7 +1287,6 @@ async function applyTheme(name) {
|
||||
{
|
||||
key: 'compact_input_area',
|
||||
action: async () => {
|
||||
localStorage.setItem(storage_keys.compact_input_area, String(power_user.compact_input_area));
|
||||
$('#compact_input_area').prop('checked', power_user.compact_input_area);
|
||||
switchCompactInputArea();
|
||||
},
|
||||
@@ -1449,24 +1341,26 @@ async function showDebugMenu() {
|
||||
callGenericPopup(template, POPUP_TYPE.TEXT, '', { wide: true, large: true, allowVerticalScrolling: true });
|
||||
}
|
||||
|
||||
switchUiMode();
|
||||
applyFontScale('forced');
|
||||
applyThemeColor();
|
||||
applyChatWidth('forced');
|
||||
applyAvatarStyle();
|
||||
applyBlurStrength();
|
||||
applyShadowWidth();
|
||||
applyCustomCSS();
|
||||
switchMovingUI();
|
||||
noShadows();
|
||||
switchHotswap();
|
||||
switchTimer();
|
||||
switchTimestamps();
|
||||
switchIcons();
|
||||
switchMesIDDisplay();
|
||||
switchHideChatAvatars();
|
||||
switchTokenCount();
|
||||
switchMessageActions();
|
||||
function applyPowerUserSettings() {
|
||||
switchUiMode();
|
||||
applyFontScale('forced');
|
||||
applyThemeColor();
|
||||
applyChatWidth('forced');
|
||||
applyAvatarStyle();
|
||||
applyBlurStrength();
|
||||
applyShadowWidth();
|
||||
applyCustomCSS();
|
||||
switchMovingUI();
|
||||
applyNoShadows();
|
||||
switchHotswap();
|
||||
switchTimer();
|
||||
switchTimestamps();
|
||||
switchIcons();
|
||||
switchMesIDDisplay();
|
||||
switchHideChatAvatars();
|
||||
switchTokenCount();
|
||||
switchMessageActions();
|
||||
}
|
||||
|
||||
function getExampleMessagesBehavior() {
|
||||
if (power_user.strip_examples) {
|
||||
@@ -1529,20 +1423,10 @@ async function loadPowerUserSettings(settings, data) {
|
||||
context_presets = data.context;
|
||||
}
|
||||
|
||||
// These are still local storage
|
||||
const fastUi = localStorage.getItem(storage_keys.fast_ui_mode);
|
||||
const movingUI = localStorage.getItem(storage_keys.movingUI);
|
||||
const noShadows = localStorage.getItem(storage_keys.noShadows);
|
||||
const hotswap = localStorage.getItem(storage_keys.hotswap_enabled);
|
||||
const timer = localStorage.getItem(storage_keys.timer_enabled);
|
||||
const timestamps = localStorage.getItem(storage_keys.timestamps_enabled);
|
||||
const mesIDDisplay = localStorage.getItem(storage_keys.mesIDDisplay_enabled);
|
||||
const hideChatAvatars = localStorage.getItem(storage_keys.hideChatAvatars_enabled);
|
||||
const expandMessageActions = localStorage.getItem(storage_keys.expand_message_actions);
|
||||
const enableZenSliders = localStorage.getItem(storage_keys.enableZenSliders);
|
||||
const enableLabMode = localStorage.getItem(storage_keys.enableLabMode);
|
||||
// These are still local storage. Delete in 1.12.7
|
||||
const autoLoadChat = localStorage.getItem(storage_keys.auto_load_chat_legacy);
|
||||
const autoConnect = localStorage.getItem(storage_keys.auto_connect_legacy);
|
||||
const hideChatAvatars = localStorage.getItem(storage_keys.hideChatAvatars_legacy);
|
||||
|
||||
if (autoLoadChat) {
|
||||
power_user.auto_load_chat = autoLoadChat === 'true';
|
||||
@@ -1554,22 +1438,10 @@ async function loadPowerUserSettings(settings, data) {
|
||||
localStorage.removeItem(storage_keys.auto_connect_legacy);
|
||||
}
|
||||
|
||||
power_user.fast_ui_mode = fastUi === null ? true : fastUi == 'true';
|
||||
power_user.movingUI = movingUI === null ? false : movingUI == 'true';
|
||||
power_user.noShadows = noShadows === null ? false : noShadows == 'true';
|
||||
power_user.hotswap_enabled = hotswap === null ? true : hotswap == 'true';
|
||||
power_user.timer_enabled = timer === null ? true : timer == 'true';
|
||||
power_user.timestamps_enabled = timestamps === null ? true : timestamps == 'true';
|
||||
power_user.mesIDDisplay_enabled = mesIDDisplay === null ? true : mesIDDisplay == 'true';
|
||||
power_user.hideChatAvatars_enabled = hideChatAvatars === null ? true : hideChatAvatars == 'true';
|
||||
power_user.expand_message_actions = expandMessageActions === null ? true : expandMessageActions == 'true';
|
||||
power_user.enableZenSliders = enableZenSliders === null ? false : enableZenSliders == 'true';
|
||||
power_user.enableLabMode = enableLabMode === null ? false : enableLabMode == 'true';
|
||||
power_user.avatar_style = Number(localStorage.getItem(storage_keys.avatar_style) ?? avatar_styles.ROUND);
|
||||
//power_user.chat_display = Number(localStorage.getItem(storage_keys.chat_display) ?? chat_styles.DEFAULT);
|
||||
power_user.chat_width = Number(localStorage.getItem(storage_keys.chat_width) ?? 50);
|
||||
power_user.font_scale = Number(localStorage.getItem(storage_keys.font_scale) ?? 1);
|
||||
power_user.blur_strength = Number(localStorage.getItem(storage_keys.blur_strength) ?? 10);
|
||||
if (hideChatAvatars) {
|
||||
power_user.hideChatAvatars_enabled = hideChatAvatars === 'true';
|
||||
localStorage.removeItem(storage_keys.hideChatAvatars_legacy);
|
||||
}
|
||||
|
||||
if (power_user.chat_display === '') {
|
||||
power_user.chat_display = chat_styles.DEFAULT;
|
||||
@@ -1596,6 +1468,7 @@ async function loadPowerUserSettings(settings, data) {
|
||||
$('#single_line').prop('checked', power_user.single_line);
|
||||
$('#relaxed_api_urls').prop('checked', power_user.relaxed_api_urls);
|
||||
$('#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);
|
||||
$('#continue_on_send').prop('checked', power_user.continue_on_send);
|
||||
$('#quick_continue').prop('checked', power_user.quick_continue);
|
||||
@@ -1655,7 +1528,7 @@ async function loadPowerUserSettings(settings, data) {
|
||||
$('#messageTimestampsEnabled').prop('checked', power_user.timestamps_enabled);
|
||||
$('#messageModelIconEnabled').prop('checked', power_user.timestamp_model_icon);
|
||||
$('#mesIDDisplayEnabled').prop('checked', power_user.mesIDDisplay_enabled);
|
||||
$('#hideChatAvatarsEndabled').prop('checked', power_user.hideChatAvatars_enabled);
|
||||
$('#hideChatAvatarsEnabled').prop('checked', power_user.hideChatAvatars_enabled);
|
||||
$('#prefer_character_prompt').prop('checked', power_user.prefer_character_prompt);
|
||||
$('#prefer_character_jailbreak').prop('checked', power_user.prefer_character_jailbreak);
|
||||
$('#enableZenSliders').prop('checked', power_user.enableZenSliders).trigger('input');
|
||||
@@ -3298,10 +3171,8 @@ $(document).ready(() => {
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
// Settings that go to local storage
|
||||
$('#fast_ui_mode').change(function () {
|
||||
power_user.fast_ui_mode = $(this).prop('checked');
|
||||
localStorage.setItem(storage_keys.fast_ui_mode, power_user.fast_ui_mode);
|
||||
switchUiMode();
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
@@ -3312,24 +3183,21 @@ $(document).ready(() => {
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('#customCSS').on('change', () => {
|
||||
power_user.custom_css = $('#customCSS').val();
|
||||
localStorage.setItem(storage_keys.custom_css, power_user.custom_css);
|
||||
$('#customCSS').on('input', () => {
|
||||
power_user.custom_css = String($('#customCSS').val());
|
||||
saveSettingsDebounced();
|
||||
applyCustomCSS();
|
||||
});
|
||||
|
||||
$('#movingUImode').change(function () {
|
||||
power_user.movingUI = $(this).prop('checked');
|
||||
localStorage.setItem(storage_keys.movingUI, power_user.movingUI);
|
||||
switchMovingUI();
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('#noShadowsmode').change(function () {
|
||||
power_user.noShadows = $(this).prop('checked');
|
||||
localStorage.setItem(storage_keys.noShadows, power_user.noShadows);
|
||||
noShadows();
|
||||
applyNoShadows();
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
@@ -3338,7 +3206,6 @@ $(document).ready(() => {
|
||||
$('#avatar_style').on('change', function () {
|
||||
const value = $(this).find(':selected').val();
|
||||
power_user.avatar_style = Number(value);
|
||||
localStorage.setItem(storage_keys.avatar_style, power_user.avatar_style);
|
||||
applyAvatarStyle();
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
@@ -3346,17 +3213,15 @@ $(document).ready(() => {
|
||||
$('#chat_display').on('change', function () {
|
||||
const value = $(this).find(':selected').val();
|
||||
power_user.chat_display = Number(value);
|
||||
localStorage.setItem(storage_keys.chat_display, power_user.chat_display);
|
||||
applyChatDisplay();
|
||||
saveSettingsDebounced();
|
||||
|
||||
});
|
||||
|
||||
$('#chat_width_slider').on('input', function (e, data) {
|
||||
const applyMode = data?.forced ? 'forced' : 'normal';
|
||||
power_user.chat_width = Number(e.target.value);
|
||||
localStorage.setItem(storage_keys.chat_width, power_user.chat_width);
|
||||
applyChatWidth(applyMode);
|
||||
saveSettingsDebounced();
|
||||
setHotswapsDebounced();
|
||||
});
|
||||
|
||||
@@ -3386,7 +3251,6 @@ $(document).ready(() => {
|
||||
const applyMode = data?.forced ? 'forced' : 'normal';
|
||||
power_user.font_scale = Number(e.target.value);
|
||||
$('#font_scale_counter').val(power_user.font_scale);
|
||||
localStorage.setItem(storage_keys.font_scale, power_user.font_scale);
|
||||
await applyFontScale(applyMode);
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
@@ -3394,7 +3258,6 @@ $(document).ready(() => {
|
||||
$('input[name="blur_strength"]').on('input', async function (e) {
|
||||
power_user.blur_strength = Number(e.target.value);
|
||||
$('#blur_strength_counter').val(power_user.blur_strength);
|
||||
localStorage.setItem(storage_keys.blur_strength, power_user.blur_strength);
|
||||
await applyBlurStrength();
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
@@ -3402,7 +3265,6 @@ $(document).ready(() => {
|
||||
$('input[name="shadow_width"]').on('input', async function (e) {
|
||||
power_user.shadow_width = Number(e.target.value);
|
||||
$('#shadow_width_counter').val(power_user.shadow_width);
|
||||
localStorage.setItem(storage_keys.shadow_width, power_user.shadow_width);
|
||||
await applyShadowWidth();
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
@@ -3643,36 +3505,36 @@ $(document).ready(() => {
|
||||
$('#messageTimerEnabled').on('input', function () {
|
||||
const value = !!$(this).prop('checked');
|
||||
power_user.timer_enabled = value;
|
||||
localStorage.setItem(storage_keys.timer_enabled, Boolean(power_user.timer_enabled));
|
||||
switchTimer();
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('#messageTimestampsEnabled').on('input', function () {
|
||||
const value = !!$(this).prop('checked');
|
||||
power_user.timestamps_enabled = value;
|
||||
localStorage.setItem(storage_keys.timestamps_enabled, Boolean(power_user.timestamps_enabled));
|
||||
switchTimestamps();
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('#messageModelIconEnabled').on('input', function () {
|
||||
const value = !!$(this).prop('checked');
|
||||
power_user.timestamp_model_icon = value;
|
||||
localStorage.setItem(storage_keys.timestamp_model_icon, Boolean(power_user.timestamp_model_icon));
|
||||
switchIcons();
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('#messageTokensEnabled').on('input', function () {
|
||||
const value = !!$(this).prop('checked');
|
||||
power_user.message_token_count_enabled = value;
|
||||
localStorage.setItem(storage_keys.message_token_count_enabled, Boolean(power_user.message_token_count_enabled));
|
||||
switchTokenCount();
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('#expandMessageActions').on('input', function () {
|
||||
const value = !!$(this).prop('checked');
|
||||
power_user.expand_message_actions = value;
|
||||
localStorage.setItem(storage_keys.expand_message_actions, Boolean(power_user.expand_message_actions));
|
||||
switchMessageActions();
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('#enableZenSliders').on('input', function () {
|
||||
@@ -3684,9 +3546,8 @@ $(document).ready(() => {
|
||||
return;
|
||||
}
|
||||
power_user.enableZenSliders = value;
|
||||
localStorage.setItem(storage_keys.enableZenSliders, Boolean(power_user.enableZenSliders));
|
||||
saveSettingsDebounced();
|
||||
switchZenSliders();
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('#enableLabMode').on('input', function () {
|
||||
@@ -3699,30 +3560,29 @@ $(document).ready(() => {
|
||||
}
|
||||
|
||||
power_user.enableLabMode = value;
|
||||
localStorage.setItem(storage_keys.enableLabMode, Boolean(power_user.enableLabMode));
|
||||
saveSettingsDebounced();
|
||||
switchLabMode();
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('#mesIDDisplayEnabled').on('input', function () {
|
||||
const value = !!$(this).prop('checked');
|
||||
power_user.mesIDDisplay_enabled = value;
|
||||
localStorage.setItem(storage_keys.mesIDDisplay_enabled, Boolean(power_user.mesIDDisplay_enabled));
|
||||
switchMesIDDisplay();
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('#hideChatAvatarsEnabled').on('input', function () {
|
||||
const value = !!$(this).prop('checked');
|
||||
power_user.hideChatAvatars_enabled = value;
|
||||
localStorage.setItem(storage_keys.hideChatAvatars_enabled, Boolean(power_user.hideChatAvatars_enabled));
|
||||
switchHideChatAvatars();
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('#hotswapEnabled').on('input', function () {
|
||||
const value = !!$(this).prop('checked');
|
||||
power_user.hotswap_enabled = value;
|
||||
localStorage.setItem(storage_keys.hotswap_enabled, Boolean(power_user.hotswap_enabled));
|
||||
switchHotswap();
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('#prefer_character_prompt').on('input', function () {
|
||||
@@ -3775,6 +3635,12 @@ $(document).ready(() => {
|
||||
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 () {
|
||||
power_user.spoiler_free_mode = !!$(this).prop('checked');
|
||||
switchSpoilerMode();
|
||||
@@ -3824,8 +3690,8 @@ $(document).ready(() => {
|
||||
$('#ui_mode_select').on('change', function () {
|
||||
const value = $(this).find(':selected').val();
|
||||
power_user.ui_mode = Number(value);
|
||||
saveSettingsDebounced();
|
||||
switchSimpleMode();
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('#bogus_folders').on('input', function () {
|
||||
@@ -3929,14 +3795,12 @@ $(document).ready(() => {
|
||||
|
||||
$('#reduced_motion').on('input', function () {
|
||||
power_user.reduced_motion = !!$(this).prop('checked');
|
||||
localStorage.setItem(storage_keys.reduced_motion, String(power_user.reduced_motion));
|
||||
switchReducedMotion();
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('#compact_input_area').on('input', function () {
|
||||
power_user.compact_input_area = !!$(this).prop('checked');
|
||||
localStorage.setItem(storage_keys.compact_input_area, String(power_user.compact_input_area));
|
||||
switchCompactInputArea();
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
Reference in New Issue
Block a user