fix: update instanceof check

web-rdp-cloud-fixes
Parkreiner 10 months ago
parent 5ec1b207d1
commit c7a4fced4c

@ -359,41 +359,41 @@ function setupAlwaysOnStyles() {
function hideFormForInitialSubmission() { function hideFormForInitialSubmission() {
const styleId = "coder-patch--styles-initial-submission"; const styleId = "coder-patch--styles-initial-submission";
const existingContainer = document.querySelector("#" + styleId);
if (existingContainer) {
return;
}
const styleContainer = document.createElement("style"); /** @type {HTMLStyleElement | null} */
styleContainer.id = styleId; let styleContainer = document.querySelector("#" + styleId);
styleContainer.innerHTML = ` if (!styleContainer) {
/* styleContainer = document.createElement("style");
Have to use opacity instead of visibility, because the element still styleContainer.id = styleId;
needs to be interactive via the script so that it can be auto-filled. styleContainer.innerHTML = `
*/
:root {
/* /*
Can be 0 or 1. Start off invisible to avoid risks of UI flickering, but Have to use opacity instead of visibility, because the element still
the rest of the function should be in charge of making the form needs to be interactive via the script so that it can be auto-filled.
container visible again if something goes wrong during setup.
*/ */
--coder-opacity-multiplier: 1; :root {
} /*
Can be 0 or 1. Start off invisible to avoid risks of UI flickering,
but the rest of the function should be in charge of making the form
container visible again if something goes wrong during setup.
*/
--coder-opacity-multiplier: 1;
}
/* web-client-form is the container for the main session form */ /* web-client-form is the container for the main session form */
web-client-form { web-client-form {
opacity: calc(100% * var(--coder-opacity-multiplier)) !important; opacity: calc(100% * var(--coder-opacity-multiplier)) !important;
} }
`; `;
document.head.appendChild(styleContainer); document.head.appendChild(styleContainer);
}
// The root node being undefined should be physically impossible (if it's // The root node being undefined should be physically impossible (if it's
// undefined, the browser itself is busted), but we need to do a type check // undefined, the browser itself is busted), but we need to do a type check
// here so that the rest of the function doesn't need to do type checks over // here so that the rest of the function doesn't need to do type checks over
// and over. // and over.
const rootNode = document.querySelector(":root"); const rootNode = document.querySelector(":root");
if (!(rootNode instanceof HTMLElement)) { if (!(rootNode instanceof HTMLHtmlElement)) {
styleContainer.innerHTML = ""; styleContainer.innerHTML = "";
return; return;
} }

Loading…
Cancel
Save