improve ChatAutoLoad, better group panel styling

This commit is contained in:
RossAscends
2023-05-06 20:19:45 +09:00
parent b9fb937052
commit 8adbff122b
4 changed files with 39 additions and 51 deletions

View File

@ -1737,7 +1737,7 @@
</div> </div>
<div id="groupTagList" class="tags paddingTopBot5"></div> <div id="groupTagList" class="tags paddingTopBot5"></div>
</div> </div>
<div id="rm_group_top_bar"> <div id="rm_group_top_bar" class="flex-container spaceEvenly width100p">
<div name="GroupStragegyAndOrder" id="rm_group_buttons" class="fontsize80p flex-container paddingLeftRight5"> <div name="GroupStragegyAndOrder" id="rm_group_buttons" class="fontsize80p flex-container paddingLeftRight5">
<div class=""> <div class="">
<div class="flex-container flexnowrap width100p whitespacenowrap"> <div class="flex-container flexnowrap width100p whitespacenowrap">

View File

@ -3433,11 +3433,13 @@ function selectRightMenuWithAnimation(selectedMenuId) {
easing: animation_easing, easing: animation_easing,
complete: function () { }, complete: function () { },
}); });
}
/* if (selectedMenuId === "rm_group_chats_block") {
$("#groupCurrentMemberListToggle").click();
} */
// $(menu).find('#groupCurrentMemberListToggle').click();
}
}) })
} }
@ -5583,7 +5585,7 @@ $(document).ready(function () {
icon.toggleClass('openIcon closedIcon'); icon.toggleClass('openIcon closedIcon');
drawer.toggleClass('openDrawer closedDrawer'); drawer.toggleClass('openDrawer closedDrawer');
console.log(targetDrawerID); //console.log(targetDrawerID);
if (targetDrawerID === 'right-nav-panel') { if (targetDrawerID === 'right-nav-panel') {
$(this).closest('.drawer').find('.drawer-content').slideToggle({ $(this).closest('.drawer').find('.drawer-content').slideToggle({
duration: 200, duration: 200,

View File

@ -12,9 +12,17 @@ import {
is_send_press, is_send_press,
getTokenCount, getTokenCount,
menu_type, menu_type,
selectRightMenuWithAnimation,
select_selected_character,
setCharacterId,
} from "../script.js"; } from "../script.js";
import {
select_group_chats,
} from "./group-chats.js";
import { import {
power_user, power_user,
send_on_enter_options, send_on_enter_options,
@ -255,33 +263,13 @@ export function RA_CountCharTokens() {
//Auto Load Last Charcter -- (fires when active_character is defined and auto_load_chat is true) //Auto Load Last Charcter -- (fires when active_character is defined and auto_load_chat is true)
async function RA_autoloadchat() { async function RA_autoloadchat() {
if (document.getElementById('CharID0') !== null) { if (document.getElementById('CharID0') !== null) {
//console.log('char list loaded! clicking activeChar'); var charToAutoLoad = document.getElementById('CharID' + LoadLocal('ActiveChar'));
var CharToAutoLoad = document.getElementById('CharID' + LoadLocal('ActiveChar')); let groupToAutoLoad = document.querySelector(`.group_select[grid="${LoadLocal('ActiveGroup')}"]`);
//console.log(CharToAutoLoad); if (charToAutoLoad != null) { $(charToAutoLoad).click(); }
let autoLoadGroup = document.querySelector(`.group_select[grid="${LoadLocal('ActiveGroup')}"]`); else if (groupToAutoLoad != null) { $(groupToAutoLoad).click(); }
//console.log(autoLoadGroup);
if (CharToAutoLoad != null) {
// if the charcter list hadn't been loaded yet, try again.
// console.log('--ALC - clicking character'); } else { setTimeout(RA_autoloadchat, 100); }
CharToAutoLoad.click();
CharToAutoLoad.click();
}
else if (autoLoadGroup != null) {
//console.log('--ALC - clicking group');
autoLoadGroup.click();
autoLoadGroup.click();
}
else {
console.log(CharToAutoLoad + ' ActiveChar local var - not found: ' + LoadLocal('ActiveChar'));
}
RestoreNavTab();
} else {
//console.log('no char list yet..');
setTimeout(RA_autoloadchat, 100); // if the charcter list hadn't been loaded yet, try again.
}
} }
export async function favsToHotswap() { export async function favsToHotswap() {
@ -296,7 +284,7 @@ export async function favsToHotswap() {
if ($(this).hasClass('is_fav') && count < maxCount) { if ($(this).hasClass('is_fav') && count < maxCount) {
const isCharacter = $(this).hasClass('character_select'); const isCharacter = $(this).hasClass('character_select');
const isGroup = $(this).hasClass('group_select'); const isGroup = $(this).hasClass('group_select');
const grid = Number($(this).attr('grid')); const grid = Number($(this).attr('grid'));
const chid = Number($(this).attr('chid')); const chid = Number($(this).attr('chid'));
let thisHotSwapSlot = template.clone(); let thisHotSwapSlot = template.clone();
thisHotSwapSlot.toggleClass('character_select', isCharacter); thisHotSwapSlot.toggleClass('character_select', isCharacter);
@ -322,7 +310,7 @@ export async function favsToHotswap() {
} }
}); });
console.log('about to check for leftover selectors...') //console.log('about to check for leftover selectors...')
// there are 6 slots in total, // there are 6 slots in total,
if (count < maxCount) { //if any are left over if (count < maxCount) { //if any are left over
let leftOverSlots = maxCount - count; let leftOverSlots = maxCount - count;
@ -334,17 +322,15 @@ export async function favsToHotswap() {
} }
} }
/* function RestoreNavTab() {
if ($('#rm_button_selected_ch').children("h2").text() !== '') {
$(SelectedNavTab).click();
//only triggers when AutoLoadChat is enabled, consider adding this as an independent feature later.
function RestoreNavTab() {
if ($('#rm_button_selected_ch').children("h2").text() !== '') { //check for a change in the character edit tab name
//console.log('detected ALC char finished loaded, proceeding to restore tab.');
$(SelectedNavTab).click(); //click to restore saved tab when name has changed (signalling char load is done)
} else { } else {
setTimeout(RestoreNavTab, 100); //if not changed yet, check again after 100ms setTimeout(RestoreNavTab, 100);
} }
} } */
//changes input bar and send button display depending on connection status //changes input bar and send button display depending on connection status
function RA_checkOnlineStatus() { function RA_checkOnlineStatus() {
if (online_status == "no_connection") { if (online_status == "no_connection") {
@ -430,7 +416,7 @@ function isUrlOrAPIKey(string) {
function OpenNavPanels() { function OpenNavPanels() {
//auto-open R nav if locked and previously open //auto-open R nav if locked and previously open
if (LoadLocalBool("NavLockOn") == true && LoadLocalBool("NavOpened") == true) { if (LoadLocalBool("NavLockOn") == true && LoadLocalBool("NavOpened") == true) {
console.log("RA -- clicking right nav to open"); //console.log("RA -- clicking right nav to open");
$("#rightNavDrawerIcon").click(); $("#rightNavDrawerIcon").click();
} else { } else {
/* console.log('didnt see reason to open right nav on load: R-nav locked? ' + /* console.log('didnt see reason to open right nav on load: R-nav locked? ' +
@ -604,13 +590,16 @@ $("document").ready(function () {
// initial status check // initial status check
setTimeout(RA_checkOnlineStatus, 100); setTimeout(RA_checkOnlineStatus, 100);
//setTimeout(favsToHotswap, 500);
// read the state of AutoConnect and AutoLoadChat. // read the state of AutoConnect and AutoLoadChat.
$(AutoConnectCheckbox).prop("checked", LoadLocalBool("AutoConnectEnabled")); $(AutoConnectCheckbox).prop("checked", LoadLocalBool("AutoConnectEnabled"));
$(AutoLoadChatCheckbox).prop("checked", LoadLocalBool("AutoLoadChatEnabled")); $(AutoLoadChatCheckbox).prop("checked", LoadLocalBool("AutoLoadChatEnabled"));
if (LoadLocalBool('AutoLoadChatEnabled') == true) { RA_autoloadchat(); } setTimeout(function () {
if (LoadLocalBool('AutoLoadChatEnabled') == true) { RA_autoloadchat(); }
}, 200);
//Autoconnect on page load if enabled, or when api type is changed //Autoconnect on page load if enabled, or when api type is changed
if (LoadLocalBool("AutoConnectEnabled") == true) { RA_autoconnect(); } if (LoadLocalBool("AutoConnectEnabled") == true) { RA_autoconnect(); }
$("#main_api").change(function () { $("#main_api").change(function () {
@ -706,10 +695,7 @@ $("document").ready(function () {
$(AutoLoadChatCheckbox).on("change", function () { SaveLocal("AutoLoadChatEnabled", $(AutoLoadChatCheckbox).prop("checked")); }); $(AutoLoadChatCheckbox).on("change", function () { SaveLocal("AutoLoadChatEnabled", $(AutoLoadChatCheckbox).prop("checked")); });
$(SelectedCharacterTab).click(function () { SaveLocal('SelectedNavTab', 'rm_button_selected_ch'); }); $(SelectedCharacterTab).click(function () { SaveLocal('SelectedNavTab', 'rm_button_selected_ch'); });
$("#rm_button_characters").click(function () { //if char list is clicked, in addition to saving it... $("#rm_button_characters").click(function () { SaveLocal('SelectedNavTab', 'rm_button_characters'); });
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 // 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 () { $(document).on("click", ".character_select", function () {

View File

@ -2681,11 +2681,11 @@ body .ui-widget-content li:hover {
/* GROUP CHATS */ /* GROUP CHATS */
#rm_group_top_bar { #rm_group_top_bar {
display: flex; /* display: flex;
flex-direction: row; flex-direction: row;
width: 100%; width: 100%;
column-gap: 5px; column-gap: 5px;
justify-content: space-evenly; justify-content: space-evenly; */
} }
#rm_button_group_chats h2 { #rm_button_group_chats h2 {