Merge branch 'dev' of https://github.com/BlipRanger/SillyTavern into feature/tags

This commit is contained in:
BlipRanger
2023-06-28 08:55:40 -04:00
8 changed files with 188 additions and 84 deletions

View File

@@ -15,10 +15,13 @@ import {
printCharacters,
name1,
name2,
replaceCurrentChat,
setCharacterId
} from "../script.js";
import { favsToHotswap, isMobile } from "./RossAscends-mods.js";
import { favsToHotswap, isMobile, initMovingUI } from "./RossAscends-mods.js";
import {
groups,
resetSelectedGroup,
selected_group,
} from "./group-chats.js";
@@ -308,7 +311,13 @@ function switchMovingUI() {
const movingUI = localStorage.getItem(storage_keys.movingUI);
power_user.movingUI = movingUI === null ? false : movingUI == "true";
$("body").toggleClass("movingUI", power_user.movingUI);
scrollChatToBottom();
if (power_user.movingUI === true) {
initMovingUI()
if (power_user.movingUIState) {
loadMovingUIState();
}
};
//scrollChatToBottom();
}
function noShadows() {
@@ -648,7 +657,10 @@ function loadPowerUserSettings(settings, data) {
}
function loadMovingUIState() {
if (isMobile() === false && power_user.movingUIState) {
if (isMobile() === false
&& power_user.movingUIState
&& power_user.movingUI === true) {
console.debug('loading movingUI state')
for (var elmntName of Object.keys(power_user.movingUIState)) {
var elmntState = power_user.movingUIState[elmntName];
try {
@@ -664,7 +676,7 @@ function loadMovingUIState() {
}
}
} else {
console.debug('skipping movingUI state load for mobile')
console.debug('skipping movingUI state load')
return
}
}
@@ -939,6 +951,22 @@ function resetMovablePanels() {
document.getElementById("right-nav-panel").style.width = '';
document.getElementById("right-nav-panel").style.margin = '';
document.getElementById("WorldInfo").style.top = '';
document.getElementById("WorldInfo").style.left = '';
document.getElementById("WorldInfo").style.right = '';
document.getElementById("WorldInfo").style.bottom = '';
document.getElementById("WorldInfo").style.height = '';
document.getElementById("WorldInfo").style.width = '';
document.getElementById("WorldInfo").style.margin = '';
document.getElementById("floatingPrompt").style.top = '';
document.getElementById("floatingPrompt").style.left = '';
document.getElementById("floatingPrompt").style.right = '';
document.getElementById("floatingPrompt").style.bottom = '';
document.getElementById("floatingPrompt").style.height = '';
document.getElementById("floatingPrompt").style.width = '';
document.getElementById("floatingPrompt").style.margin = '';
if ($("#expression-holder")) {
document.getElementById("expression-holder").style.top = '';
document.getElementById("expression-holder").style.left = '';
@@ -959,23 +987,6 @@ function resetMovablePanels() {
$(".zoomed_avatar").css('margin', '');
}
document.getElementById("WorldInfo").style.top = '';
document.getElementById("WorldInfo").style.left = '';
document.getElementById("WorldInfo").style.right = '';
document.getElementById("WorldInfo").style.bottom = '';
document.getElementById("WorldInfo").style.height = '';
document.getElementById("WorldInfo").style.width = '';
document.getElementById("WorldInfo").style.margin = '';
document.getElementById("floatingPrompt").style.top = '';
document.getElementById("floatingPrompt").style.left = '';
document.getElementById("floatingPrompt").style.right = '';
document.getElementById("floatingPrompt").style.bottom = '';
document.getElementById("floatingPrompt").style.height = '';
document.getElementById("floatingPrompt").style.width = '';
document.getElementById("floatingPrompt").style.margin = '';
$('*[data-dragged="true"]').removeAttr('data-dragged');
power_user.movingUIState = {}
saveSettingsDebounced();
@@ -992,6 +1003,15 @@ function doNewChat() {
}, 1);
}
function doRandomChat() {
resetSelectedGroup();
setCharacterId(Math.floor(Math.random() * characters.length));
setTimeout(() => {
replaceCurrentChat();
}, 1);
}
function doDelMode() {
setTimeout(() => {
$("#option_delete_mes").trigger('click')
@@ -1399,5 +1419,6 @@ $(document).ready(() => {
registerSlashCommand('vn', toggleWaifu, ['vn'], ' swaps Visual Novel Mode On/Off', false, true);
registerSlashCommand('newchat', doNewChat, ['newchat'], ' start a new chat with current character', true, true);
registerSlashCommand('random', doRandomChat, ['random'], ' start a new chat with a random character', true, true);
registerSlashCommand('delmode', doDelMode, ['delmode'], ' enter message deletion mode', true, true);
});