mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Restore last active group
This commit is contained in:
@@ -170,9 +170,14 @@ async function RA_autoloadchat() {
|
||||
if (document.getElementById('CharID0') !== null) {
|
||||
//console.log('char list loaded! clicking activeChar');
|
||||
var CharToAutoLoad = document.getElementById('CharID' + LoadLocal('ActiveChar'));
|
||||
let autoLoadGroup = document.querySelector(`.group_select[grid="${LoadLocal('ActiveGroup')}"]`);
|
||||
if (CharToAutoLoad != null) {
|
||||
CharToAutoLoad.click();
|
||||
} else {
|
||||
}
|
||||
else if (autoLoadGroup != null) {
|
||||
autoLoadGroup.click();
|
||||
}
|
||||
else {
|
||||
console.log(CharToAutoLoad + ' ActiveChar local var - not found: ' + LoadLocal('ActiveChar'));
|
||||
}
|
||||
RestoreNavTab();
|
||||
@@ -201,7 +206,7 @@ function RA_checkOnlineStatus() {
|
||||
} else {
|
||||
if (online_status !== undefined && online_status !== "no_connection") {
|
||||
$("#send_textarea").attr("placeholder", "Type a message..."); //on connect, placeholder tells user to type message
|
||||
const formColor = fast_ui_mode ? "var(--black90a)": "var(--black60a)";
|
||||
const formColor = fast_ui_mode ? "var(--black90a)" : "var(--black60a)";
|
||||
$("#send_form").css("background-color", formColor); //on connect, form BG changes to transprent black
|
||||
$("#API-status-top").removeClass("redOverlayGlow");
|
||||
connection_made = true;
|
||||
@@ -334,8 +339,17 @@ $("document").ready(function () {
|
||||
SaveLocal('SelectedNavTab', 'rm_button_characters');
|
||||
characters.sort(Intl.Collator().compare); // we sort the list
|
||||
});
|
||||
|
||||
// when a char is selected from the list, save them as the auto-load character for next page load
|
||||
$(document).on("click", ".character_select", function () { SaveLocal('ActiveChar', $(this).attr('chid')); });
|
||||
$(document).on("click", ".character_select", function () {
|
||||
SaveLocal('ActiveChar', $(this).attr('chid'));
|
||||
SaveLocal('ActiveGroup', null);
|
||||
});
|
||||
|
||||
$(document).on("click", ".group_select", function () {
|
||||
SaveLocal('ActiveChar', null);
|
||||
SaveLocal('ActiveGroup', $(this).data('id'));
|
||||
});
|
||||
|
||||
//this makes the chat input text area resize vertically to match the text size (limited by CSS at 50% window height)
|
||||
$('#send_textarea').on('input', function () {
|
||||
|
@@ -180,6 +180,7 @@ function printGroups() {
|
||||
for (let group of groups) {
|
||||
const template = $("#group_list_template .group_select").clone();
|
||||
template.data("id", group.id);
|
||||
template.attr("grid", group.id);
|
||||
template.find(".ch_name").text(group.name);
|
||||
$("#rm_print_characters_block").prepend(template);
|
||||
updateGroupAvatar(group);
|
||||
|
Reference in New Issue
Block a user