chore: isElectronContext

This commit is contained in:
Tristan Yang
2023-07-03 12:06:05 +08:00
parent 94e4f7c1e9
commit d2247b2fdd
2 changed files with 10 additions and 10 deletions
+4
View File
@@ -169,6 +169,10 @@
-->
</body>
<script>
// electron
if (navigator.userAgent.indexOf("Electron/") > -1) {
document.body.classList.add("electron");
}
if (window.location !== window.parent.location) {
// The page is in an iframe
document.body.classList.add("iframe");
+1 -5
View File
@@ -18,13 +18,9 @@ import { register } from "./serviceWorkerRegistration";
import "./i18n";
import "./libs/polyfills";
import { isDarkMode, isElectronContext } from "./utils";
import { isDarkMode } from "./utils";
const root = ReactDOM.createRoot(document.getElementById("root") as HTMLElement);
// electron context
if (isElectronContext()) {
document.body.classList.add("electron");
}
// dark mode
if (isDarkMode()) {
document.documentElement.classList.add("dark");