more toasty edge case fixes
| @@ -313,7 +313,7 @@ await new Promise((resolve) => { | |||
| 313 | } | 313 | } |
| 314 | }); | 314 | }); |
| 315 | 315 | ||
| 316 | showLoader(); | 316 | //showLoader(); <-- must wait for poweruser (called from firstinit()), so moved it in there |
| 317 | 317 | ||
| 318 | // Configure toast library: | 318 | // Configure toast library: |
| 319 | toastr.options.escapeHtml = true; // Prevent raw HTML inserts | 319 | toastr.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 settings | 7596 | // Apply theme toggles from power user settings |
| 7596 | applyPowerUserSettings(); | 7597 | applyPowerUserSettings(); |
| 7597 | 7598 | ||
| 7598 | toastr.options.positionClass = power_user.toastr_position; // Where to position the toast container | ||
| 7599 | |||
| 7600 | // Load character tags | 7599 | // Load character tags |
| 7601 | loadTagsSettings(settings); | 7600 | loadTagsSettings(settings); |
| 7602 | 7601 | ||
| @@ -718,7 +718,6 @@ export function getTopmostModalLayer() { | |||
| 718 | */ | 718 | */ |
| 719 | export function fixToastrForDialogs() { | 719 | export 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(); |
| 723 | 722 | ||
| 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 | } |
| 731 | 738 | ||
| 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. |