Display loader earlier, init toast classes in power-user

This commit is contained in:
Cohee
2025-05-21 20:35:03 +03:00
parent c42cf748b3
commit 34490c9614
3 changed files with 21 additions and 47 deletions

View File

@@ -1,6 +1,6 @@
import dialogPolyfill from '../lib/dialog-polyfill.esm.js';
import { shouldSendOnEnter } from './RossAscends-mods.js';
import { power_user } from './power-user.js';
import { power_user, toastPositionClasses } from './power-user.js';
import { removeFromArray, runAfterAnimation, uuidv4 } from './utils.js';
/** @readonly */
@@ -725,15 +725,6 @@ export function fixToastrForDialogs() {
if (!toastContainer) {
toastContainer = document.createElement('div');
toastContainer.setAttribute('id', 'toast-container');
if (power_user.toastr_position) {
toastr.options.positionClass = (power_user.toastr_position);
} else {
console.warn('Did not find poweruser.toastr_position; defaulting to top center');
power_user.toastr_position = 'toast-top-center';
toastr.options.positionClass = (power_user.toastr_position);
$(`#toastr_position option[value=${power_user.toastr_position}]`).attr('selected', true);
}
//if (toastr.options.positionClass) toastContainer.classList.add(toastr.options.positionClass);
}
// Check if toastr is already a child. If not, we need to move it inside this dialog.
@@ -752,6 +743,7 @@ export function fixToastrForDialogs() {
toastContainer.remove();
} else {
document.body.appendChild(toastContainer);
toastContainer.classList.remove(...toastPositionClasses);
toastContainer.classList.add(toastr.options.positionClass);
}
}