more toasty edge case fixes

da16c551f0810edaa4faca688680e4cd1f883126

RossAscends <124905043+RossAscends@users.noreply.github.com>

2 files changed, +11 -5Ignore whitespace
public/script.js+2 -3
@@ -313,7 +313,7 @@ await new Promise((resolve) => {
313313 }
314314});
315315
316-showLoader();
316+//showLoader(); <-- must wait for poweruser (called from firstinit()), so moved it in there
317317
318318// Configure toast library:
319319toastr.options.escapeHtml = true; // Prevent raw HTML inserts
@@ -990,6 +990,7 @@ async function firstLoadInit() {
990990 await initPresetManager();
991991 await getSystemMessages();
992992 await getSettings();
993+ showLoader();
993994 initKeyboard();
994995 initDynamicStyles();
995996 initTags();
@@ -7595,8 +7596,6 @@ export async function getSettings() {
75957596 // Apply theme toggles from power user settings
75967597 applyPowerUserSettings();
75977598
7598- toastr.options.positionClass = power_user.toastr_position; // Where to position the toast container
7599-
76007599 // Load character tags
76017600 loadTagsSettings(settings);
76027601
public/scripts/popup.js+9 -2
@@ -718,7 +718,6 @@ export function getTopmostModalLayer() {
718718 */
719719export function fixToastrForDialogs() {
720720 // Hacky way of getting toastr to actually display on top of the popup...
721-
722721 const dlg = Array.from(document.querySelectorAll('dialog[open]:not([closing])')).pop();
723722
724723 let toastContainer = document.getElementById('toast-container');
@@ -726,7 +725,15 @@ export function fixToastrForDialogs() {
726725 if (!toastContainer) {
727726 toastContainer = document.createElement('div');
728727 toastContainer.setAttribute('id', 'toast-container');
729- if (toastr.options.positionClass) toastContainer.classList.add(toastr.options.positionClass);
728+ if (power_user.toastr_position) {
729+ toastr.options.positionClass = (power_user.toastr_position);
730+ } else {
731+ console.warn('Did not find poweruser.toastr_position; defaulting to top center');
732+ power_user.toastr_position = 'toast-top-center';
733+ toastr.options.positionClass = (power_user.toastr_position);
734+ $(`#toastr_position option[value=${power_user.toastr_position}]`).attr('selected', true);
735+ }
736+ //if (toastr.options.positionClass) toastContainer.classList.add(toastr.options.positionClass);
730737 }
731738
732739 // Check if toastr is already a child. If not, we need to move it inside this dialog.