Handle groups correctly, save settings.

This commit is contained in:
city-unit 2023-07-29 20:05:12 -04:00
parent 6829f5308f
commit 0cc88c17c7
1 changed files with 3 additions and 3 deletions

View File

@ -346,11 +346,9 @@ async function RA_autoloadchat() {
if (document.getElementById('CharID0') !== null) {
// active character is the name, we should look it up in the character list and get the id
let active_character_id = Object.keys(characters).find(key => characters[key].avatar === active_character);
// active group is the name, we should look it up in the group list and get the id
let active_group_id = groups.find(x => x.name === active_group)?.id;
var charToAutoLoad = document.getElementById('CharID' + active_character_id);
let groupToAutoLoad = document.querySelector(`.group_select[grid="${active_group_id}"]`);
let groupToAutoLoad = document.querySelector(`.group_select[grid="${active_group}"]`);
if (charToAutoLoad != null) {
$(charToAutoLoad).click();
}
@ -924,11 +922,13 @@ $("document").ready(function () {
$(document).on("click", ".character_select", function () {
setActiveCharacter($(this).find('.avatar').attr('title'));
setActiveGroup(null);
saveSettingsDebounced();
});
$(document).on("click", ".group_select", function () {
setActiveCharacter(null);
setActiveGroup($(this).data('id'));
saveSettingsDebounced();
});