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) => {
313 }313 }
314});314});
315315
316showLoader();316//showLoader(); <-- must wait for poweruser (called from firstinit()), so moved it in there
317317
318// Configure toast library:318// Configure toast library:
319toastr.options.escapeHtml = true; // Prevent raw HTML inserts319toastr.options.escapeHtml = true; // Prevent raw HTML inserts
@@ -990,6 +990,7 @@ async function firstLoadInit() {
990 await initPresetManager();990 await initPresetManager();
991 await getSystemMessages();991 await getSystemMessages();
992 await getSettings();992 await getSettings();
993 showLoader();
993 initKeyboard();994 initKeyboard();
994 initDynamicStyles();995 initDynamicStyles();
995 initTags();996 initTags();
@@ -7595,8 +7596,6 @@ export async function getSettings() {
7595 // Apply theme toggles from power user settings7596 // Apply theme toggles from power user settings
7596 applyPowerUserSettings();7597 applyPowerUserSettings();
75977598
7598 toastr.options.positionClass = power_user.toastr_position; // Where to position the toast container
7599
7600 // Load character tags7599 // Load character tags
7601 loadTagsSettings(settings);7600 loadTagsSettings(settings);
76027601
public/scripts/popup.js+9 -2
@@ -718,7 +718,6 @@ export function getTopmostModalLayer() {
718 */718 */
719export function fixToastrForDialogs() {719export function fixToastrForDialogs() {
720 // Hacky way of getting toastr to actually display on top of the popup...720 // Hacky way of getting toastr to actually display on top of the popup...
721
722 const dlg = Array.from(document.querySelectorAll('dialog[open]:not([closing])')).pop();721 const dlg = Array.from(document.querySelectorAll('dialog[open]:not([closing])')).pop();
723722
724 let toastContainer = document.getElementById('toast-container');723 let toastContainer = document.getElementById('toast-container');
@@ -726,7 +725,15 @@ export function fixToastrForDialogs() {
726 if (!toastContainer) {725 if (!toastContainer) {
727 toastContainer = document.createElement('div');726 toastContainer = document.createElement('div');
728 toastContainer.setAttribute('id', 'toast-container');727 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);
730 }737 }
731738
732 // Check if toastr is already a child. If not, we need to move it inside this dialog.739 // Check if toastr is already a child. If not, we need to move it inside this dialog.