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
+7 -3
View File
@@ -164,11 +164,15 @@
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</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");