Optimize Safari's workaround

This commit is contained in:
redphx 2024-01-14 15:55:16 +07:00
parent 6dbc0990cd
commit 780deccae2

View File

@ -2689,7 +2689,6 @@ if (ENABLE_SAFARI_WORKAROUND && document.readyState !== 'loading') {
window.stop(); window.stop();
// Show the reloading overlay // Show the reloading overlay
const $elm = createElement('div', {'class': 'bx-reload-overlay'}, __('safari-failed-message'));
const css = ` const css = `
.bx-reload-overlay { .bx-reload-overlay {
position: fixed; position: fixed;
@ -2705,8 +2704,11 @@ if (ENABLE_SAFARI_WORKAROUND && document.readyState !== 'loading') {
font-size: 1.3rem; font-size: 1.3rem;
} }
`; `;
document.documentElement.appendChild(createElement('style', {}, css)); const $fragment = document.createDocumentFragment();
document.documentElement.appendChild($elm); $fragment.appendChild(CE('style', {}, css));
$fragment.appendChild(CE('div', {'class': 'bx-reload-overlay'}, __('safari-failed-message')));
document.documentElement.appendChild($fragment);
// Reload the page // Reload the page
window.location.reload(true); window.location.reload(true);