Merge branch 'neo-server' into parser-v2

This commit is contained in:
LenAnderson
2024-04-18 16:08:19 -04:00
57 changed files with 2909 additions and 492 deletions

View File

@ -247,6 +247,7 @@ let power_user = {
encode_tags: false,
servers: [],
bogus_folders: false,
zoomed_avatar_magnification: false,
show_tag_filters: false,
aux_field: 'character_version',
stscript: {
@ -822,7 +823,7 @@ async function CreateZenSliders(elmnt) {
isManualInput = true;
//allow enter to trigger slider update
if (e.key === 'Enter') {
e.preventDefault;
e.preventDefault();
handle.trigger('blur');
}
})
@ -1307,6 +1308,13 @@ async function applyTheme(name) {
printCharactersDebounced();
},
},
{
key: 'zoomed_avatar_magnification',
action: async () => {
$('#zoomed_avatar_magnification').prop('checked', power_user.zoomed_avatar_magnification);
printCharactersDebounced();
},
},
{
key: 'reduced_motion',
action: async () => {
@ -1502,6 +1510,7 @@ function loadPowerUserSettings(settings, data) {
$('#auto_fix_generated_markdown').prop('checked', power_user.auto_fix_generated_markdown);
$('#auto_scroll_chat_to_bottom').prop('checked', power_user.auto_scroll_chat_to_bottom);
$('#bogus_folders').prop('checked', power_user.bogus_folders);
$('#zoomed_avatar_magnification').prop('checked', power_user.zoomed_avatar_magnification);
$(`#tokenizer option[value="${power_user.tokenizer}"]`).attr('selected', true);
$(`#send_on_enter option[value=${power_user.send_on_enter}]`).attr('selected', true);
$('#import_card_tags').prop('checked', power_user.import_card_tags);
@ -2154,6 +2163,7 @@ async function saveTheme(name = undefined) {
hotswap_enabled: power_user.hotswap_enabled,
custom_css: power_user.custom_css,
bogus_folders: power_user.bogus_folders,
zoomed_avatar_magnification: power_user.zoomed_avatar_magnification,
reduced_motion: power_user.reduced_motion,
compact_input_area: power_user.compact_input_area,
};
@ -2372,8 +2382,10 @@ async function doMesCut(_, text) {
let totalMesToCut = (range.end - range.start) + 1;
let mesIDToCut = range.start;
let cutText = '';
for (let i = 0; i < totalMesToCut; i++) {
cutText += (chat[mesIDToCut]?.mes || '') + '\n';
let done = false;
let mesToCut = $('#chat').find(`.mes[mesid=${mesIDToCut}]`);
@ -2394,6 +2406,8 @@ async function doMesCut(_, text) {
await delay(1);
}
}
return cutText;
}
async function doDelMode(_, text) {
@ -3416,8 +3430,13 @@ $(document).ready(() => {
});
$('#bogus_folders').on('input', function () {
const value = !!$(this).prop('checked');
power_user.bogus_folders = value;
power_user.bogus_folders = !!$(this).prop('checked');
printCharactersDebounced();
saveSettingsDebounced();
});
$('#zoomed_avatar_magnification').on('input', function () {
power_user.zoomed_avatar_magnification = !!$(this).prop('checked');
printCharactersDebounced();
saveSettingsDebounced();
});
@ -3523,7 +3542,7 @@ $(document).ready(() => {
registerSlashCommand('newchat', doNewChat, [], ' start a new chat with current character', true, true);
registerSlashCommand('random', doRandomChat, [], ' start a new chat with a random character', true, true);
registerSlashCommand('delmode', doDelMode, ['del'], '<span class="monospace">(optional number)</span> enter message deletion mode, and auto-deletes last N messages if numeric argument is provided', true, true);
registerSlashCommand('cut', doMesCut, [], '<span class="monospace">(number or range)</span> cuts the specified message or continuous chunk from the chat, e.g. <tt>/cut 0-10</tt>. Ranges are inclusive!', true, true);
registerSlashCommand('cut', doMesCut, [], '<span class="monospace">(number or range)</span> cuts the specified message or continuous chunk from the chat, e.g. <tt>/cut 0-10</tt>. Ranges are inclusive! Returns the text of cut messages separated by a newline.', true, true);
registerSlashCommand('resetpanels', doResetPanels, ['resetui'], ' resets UI panels to original state.', true, true);
registerSlashCommand('bgcol', setAvgBG, [], ' WIP test of auto-bg avg coloring', true, true);
registerSlashCommand('theme', setThemeCallback, [], '<span class="monospace">(name)</span> sets a UI theme by name', true, true);