Less horrible charListGrid load

This commit is contained in:
Cohee 2024-09-05 21:22:54 +03:00
parent 75c6bee350
commit 3e3597673b
2 changed files with 5 additions and 15 deletions

View File

@ -8879,9 +8879,8 @@ const isPwaMode = window.navigator.standalone;
if (isPwaMode) { $('body').addClass('PWA'); }
function doCharListDisplaySwitch() {
console.debug('toggling body charListGrid state');
$('body').toggleClass('charListGrid');
power_user.charListGrid = $('body').hasClass('charListGrid') ? true : false;
power_user.charListGrid = !power_user.charListGrid;
document.body.classList.toggle('charListGrid', power_user.charListGrid);
saveSettingsDebounced();
}

View File

@ -106,6 +106,7 @@ export const persona_description_positions = {
};
let power_user = {
charListGrid: false,
tokenizer: tokenizers.BEST_MATCH,
token_padding: 64,
collapse_newlines: false,
@ -1602,18 +1603,8 @@ async function loadPowerUserSettings(settings, data) {
loadCharListState();
}
async function loadCharListState() {
if (document.querySelector('.character_select') !== null) {
console.debug('setting charlist state to...');
if (power_user.charListGrid === true) {
console.debug('..to grid');
$('#charListGridToggle').trigger('click');
} else { console.debug('..to list'); }
} else {
console.debug('charlist not ready yet');
await delay(100);
loadCharListState();
}
function loadCharListState() {
document.body.classList.toggle('charListGrid', power_user.charListGrid);
}
function loadMovingUIState() {