moved nocss warning update to its own file

update nocss warning to show bigger clear cache shortcut
This commit is contained in:
Miodec 2022-09-29 19:45:15 +02:00
parent ebf3c73709
commit 51db47e9d6
4 changed files with 150 additions and 19 deletions

View file

@ -0,0 +1,96 @@
import { CLIENT_VERSION } from "../version";
$("#nocss .requestedStylesheets").html(
"Requested stylesheets:<br>" +
(
[
...document.querySelectorAll("link[rel=stylesheet"),
] as HTMLAnchorElement[]
)
.map((l) => l.href)
.filter((l) => /\/css\/style/gi.test(l))
.join("<br>")
);
$("#nocss .requestedJs").html(
"Requested Javascript files:<br>" +
([...document.querySelectorAll("script")] as HTMLScriptElement[])
.map((l) => l.src)
.filter((l) => /(\/js\/mon|\/js\/vendor)/gi.test(l))
.join("<br>") +
"<br><br>Client version:<br>" +
CLIENT_VERSION
);
if (window.navigator.userAgent.toLowerCase().includes("mac")) {
$("#nocss .keys").html(`
<span
style="
padding: 1rem;
display: inline-block;
border-radius: 1rem;
background: #2c2e31;
margin-top: 1rem;
"
>
Cmd
</span>
+
<span
style="
padding: 1rem;
display: inline-block;
border-radius: 1rem;
background: #2c2e31;
"
>
Shift
</span>
+
<span
style="
padding: 1rem;
display: inline-block;
border-radius: 1rem;
background: #2c2e31;
"
>
R
</span>
`);
} else {
$("#nocss .keys").html(`
<span
style="
padding: 1rem;
display: inline-block;
border-radius: 1rem;
background: #2c2e31;
"
>
Ctrl
</span>
+
<span
style="
padding: 1rem;
display: inline-block;
border-radius: 1rem;
background: #2c2e31;
"
>
Shift
</span>
+
<span
style="
padding: 1rem;
display: inline-block;
border-radius: 1rem;
background: #2c2e31;
"
>
R
</span>
`);
}

View file

@ -32,6 +32,7 @@ import "./popups/google-sign-up-popup";
import * as Account from "./pages/account";
import "./elements/leaderboards";
import "./commandline/index";
import "./elements/no-css";
import { egVideoListener } from "./popups/video-ad-popup";
type ExtendedGlobal = typeof globalThis & MonkeyTypes.Global;

View file

@ -7,7 +7,6 @@ import * as Notifications from "./elements/notifications";
import * as Focus from "./test/focus";
import * as CookiePopup from "./popups/cookie-popup";
import * as PSA from "./elements/psa";
import { CLIENT_VERSION } from "./version";
ManualRestart.set();
UpdateConfig.loadFromLocalStorage();
@ -24,20 +23,6 @@ if (window.location.hostname === "localhost") {
});
}
$("#nocss .requestedStylesheets").html(
"Requested stylesheets:<br>" +
(
[
...document.querySelectorAll("link[rel=stylesheet"),
] as HTMLAnchorElement[]
)
.map((l) => l.href)
.filter((l) => /\/css\//gi.test(l))
.join("<br>") +
"<br><br>Client version:<br>" +
CLIENT_VERSION
);
Focus.set(true, true);
$(document).ready(() => {
CookiePopup.check();

View file

@ -66,16 +66,65 @@
>
<span style="font-size: 6rem; color: #e2b714">:(</span>
<span style="font-size: 2rem; color: #d1d0c5">
It seems like the CSS failed to load. Please try refreshing or clearing
your cache to redownload the styles. If that doesn't help contact support.
It seems like the CSS failed to load. Please try clearing your cache to
redownload the styles:
<br />
(jack@monkeytype.com or discord.gg/monkeytype)
<span class="keys">
<span
style="
padding: 1rem;
display: inline-block;
border-radius: 1rem;
background: #2c2e31;
margin-top: 1rem;
"
>
Ctrl
</span>
/
<span
style="
padding: 1rem;
display: inline-block;
border-radius: 1rem;
background: #2c2e31;
"
>
Cmd
</span>
+
<span
style="
padding: 1rem;
display: inline-block;
border-radius: 1rem;
background: #2c2e31;
"
>
Shift
</span>
+
<span
style="
padding: 1rem;
display: inline-block;
border-radius: 1rem;
background: #2c2e31;
"
>
R
</span>
</span>
</span>
<span>
If that doesn't help contact support (jack@monkeytype.com or
discord.gg/monkeytype)
</span>
<span>(ctrl/cmd + shift + r on Chromium browsers)</span>
<span class="requestedStylesheets">
If the website works for a bit but then this screen comes back, clear your
cache again and then on Monkeytype open the command line (esc) and search
for "Clear SW cache".
</span>
<span class="requestedJs"></span>
</div>
</div>