mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add a separate button to update current UI theme
This commit is contained in:
@ -2776,9 +2776,12 @@
|
|||||||
<div class="flex-container flexnowrap alignitemscenter">
|
<div class="flex-container flexnowrap alignitemscenter">
|
||||||
<select id="themes" class="margin0">
|
<select id="themes" class="margin0">
|
||||||
</select>
|
</select>
|
||||||
<div id="ui-preset-save-button" title="Save changes to a new theme file" data-i18n="[title]Save changes to a new theme file" class="menu_button margin0">
|
<div id="ui-preset-update-button" title="Update a theme file" data-i18n="[title]Update a theme file" class="menu_button margin0">
|
||||||
<i class="fa-solid fa-save"></i>
|
<i class="fa-solid fa-save"></i>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="ui-preset-save-button" title="Save as a new theme" data-i18n="[title]Save as a new theme" class="menu_button margin0">
|
||||||
|
<i class="fa-solid fa-paste"></i>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div name="themeElements" data-newbie-hidden class="flex-container flexFlowColumn flexNoGap">
|
<div name="themeElements" data-newbie-hidden class="flex-container flexFlowColumn flexNoGap">
|
||||||
|
@ -1912,11 +1912,26 @@ function sortEntitiesList(entities) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function saveTheme() {
|
/**
|
||||||
const name = await callPopup('Enter a theme preset name:', 'input');
|
* Updates the current UI theme file.
|
||||||
|
*/
|
||||||
|
async function updateTheme() {
|
||||||
|
await saveTheme(power_user.theme);
|
||||||
|
toastr.success('Theme saved.');
|
||||||
|
}
|
||||||
|
|
||||||
if (!name) {
|
/**
|
||||||
return;
|
* Saves the current theme to the server.
|
||||||
|
* @param {string|undefined} name Theme name. If undefined, a popup will be shown to enter a name.
|
||||||
|
* @returns {Promise<void>} A promise that resolves when the theme is saved.
|
||||||
|
*/
|
||||||
|
async function saveTheme(name = undefined) {
|
||||||
|
if (typeof name !== 'string') {
|
||||||
|
name = await callPopup('Enter a theme preset name:', 'input', power_user.theme);
|
||||||
|
|
||||||
|
if (!name) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const theme = {
|
const theme = {
|
||||||
@ -2825,7 +2840,8 @@ $(document).ready(() => {
|
|||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#ui-preset-save-button').on('click', saveTheme);
|
$('#ui-preset-save-button').on('click', () => saveTheme());
|
||||||
|
$('#ui-preset-update-button').on('click', () => updateTheme());
|
||||||
$('#movingui-preset-save-button').on('click', saveMovingUI);
|
$('#movingui-preset-save-button').on('click', saveMovingUI);
|
||||||
|
|
||||||
$('#never_resize_avatars').on('input', function () {
|
$('#never_resize_avatars').on('input', function () {
|
||||||
|
Reference in New Issue
Block a user