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;
8879if (isPwaMode) { $('body').addClass('PWA'); }8879if (isPwaMode) { $('body').addClass('PWA'); }
88808880
8881function doCharListDisplaySwitch() {8881function doCharListDisplaySwitch() {
8882 console.debug('toggling body charListGrid state');8882 power_user.charListGrid = !power_user.charListGrid;
8883 $('body').toggleClass('charListGrid');8883 document.body.classList.toggle('charListGrid', power_user.charListGrid);
8884 power_user.charListGrid = $('body').hasClass('charListGrid') ? true : false;
8885 saveSettingsDebounced();8884 saveSettingsDebounced();
8886}8885}
88878886
public/scripts/power-user.js+3 -12
@@ -106,6 +106,7 @@ export const persona_description_positions = {
106};106};
107107
108let power_user = {108let power_user = {
109 charListGrid: false,
109 tokenizer: tokenizers.BEST_MATCH,110 tokenizer: tokenizers.BEST_MATCH,
110 token_padding: 64,111 token_padding: 64,
111 collapse_newlines: false,112 collapse_newlines: false,
@@ -1602,18 +1603,8 @@ async function loadPowerUserSettings(settings, data) {
1602 loadCharListState();1603 loadCharListState();
1603}1604}
16041605
1605async function loadCharListState() {1606function 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 }
1617}1608}
16181609
1619function loadMovingUIState() {1610function loadMovingUIState() {