Merge pull request #2788 from SillyTavern/charlistgrid-load Less horrible charListGrid load

d5c26032aa58ef8698648507043e02b5b38d211e

Cohee <18619528+Cohee1207@users.noreply.github.com>

Signed
2 files changed, +5 -15Ignore whitespace
public/script.js+2 -3
@@ -8879,9 +8879,8 @@ const isPwaMode = window.navigator.standalone;
88798879if (isPwaMode) { $('body').addClass('PWA'); }
88808880
88818881function doCharListDisplaySwitch() {
8882- console.debug('toggling body charListGrid state');
8882+ power_user.charListGrid = !power_user.charListGrid;
88838883 $('document.body').toggleClassclassList.toggle('charListGrid', power_user.charListGrid);
8884- power_user.charListGrid = $('body').hasClass('charListGrid') ? true : false;
88858884 saveSettingsDebounced();
88868885}
88878886
public/scripts/power-user.js+3 -12
@@ -106,6 +106,7 @@ export const persona_description_positions = {
106106};
107107
108108let power_user = {
109+ charListGrid: false,
109110 tokenizer: tokenizers.BEST_MATCH,
110111 token_padding: 64,
111112 collapse_newlines: false,
@@ -1602,18 +1603,8 @@ async function loadPowerUserSettings(settings, data) {
16021603 loadCharListState();
16031604}
16041605
16051606async function loadCharListState() {
1606- if (document.querySelector('.character_select') !== null) {
1607+ document.body.classList.toggle('charListGrid', power_user.charListGrid);
1607- console.debug('setting charlist state to...');
1608- if (power_user.charListGrid === true) {
1609- console.debug('..to grid');
1610- $('#charListGridToggle').trigger('click');
1611- } else { console.debug('..to list'); }
1612- } else {
1613- console.debug('charlist not ready yet');
1614- await delay(100);
1615- loadCharListState();
1616- }
16171608}
16181609
16191610function loadMovingUIState() {