From 780deccae2a5e8cd2b9fe620b6533ce33cd23550 Mon Sep 17 00:00:00 2001 From: redphx <96280+redphx@users.noreply.github.com> Date: Sun, 14 Jan 2024 15:55:16 +0700 Subject: [PATCH] Optimize Safari's workaround --- better-xcloud.user.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/better-xcloud.user.js b/better-xcloud.user.js index ba8cc80..607595f 100644 --- a/better-xcloud.user.js +++ b/better-xcloud.user.js @@ -2689,7 +2689,6 @@ if (ENABLE_SAFARI_WORKAROUND && document.readyState !== 'loading') { window.stop(); // Show the reloading overlay - const $elm = createElement('div', {'class': 'bx-reload-overlay'}, __('safari-failed-message')); const css = ` .bx-reload-overlay { position: fixed; @@ -2705,8 +2704,11 @@ if (ENABLE_SAFARI_WORKAROUND && document.readyState !== 'loading') { font-size: 1.3rem; } `; - document.documentElement.appendChild(createElement('style', {}, css)); - document.documentElement.appendChild($elm); + const $fragment = document.createDocumentFragment(); + $fragment.appendChild(CE('style', {}, css)); + $fragment.appendChild(CE('div', {'class': 'bx-reload-overlay'}, __('safari-failed-message'))); + + document.documentElement.appendChild($fragment); // Reload the page window.location.reload(true);