chore: isElectronContext
This commit is contained in:
+9
-5
@@ -160,15 +160,19 @@
|
|||||||
<!--
|
<!--
|
||||||
This HTML file is a template.
|
This HTML file is a template.
|
||||||
If you open it directly in the browser, you will see an empty page.
|
If you open it directly in the browser, you will see an empty page.
|
||||||
|
|
||||||
You can add webfonts, meta tags, or analytics to this file.
|
You can add webfonts, meta tags, or analytics to this file.
|
||||||
The build step will place the bundled scripts into the <body> tag.
|
The build step will place the bundled scripts into the <body> tag.
|
||||||
|
|
||||||
To begin the development, run `npm start` or `yarn start`.
|
To begin the development, run `npm start` or `yarn start`.
|
||||||
To create a production bundle, use `npm run build` or `yarn build`.
|
To create a production bundle, use `npm run build` or `yarn build`.
|
||||||
-->
|
-->
|
||||||
</body>
|
</body>
|
||||||
<script>
|
<script>
|
||||||
|
// electron
|
||||||
|
if (navigator.userAgent.indexOf("Electron/") > -1) {
|
||||||
|
document.body.classList.add("electron");
|
||||||
|
}
|
||||||
if (window.location !== window.parent.location) {
|
if (window.location !== window.parent.location) {
|
||||||
// The page is in an iframe
|
// The page is in an iframe
|
||||||
document.body.classList.add("iframe");
|
document.body.classList.add("iframe");
|
||||||
|
|||||||
+1
-5
@@ -18,13 +18,9 @@ import { register } from "./serviceWorkerRegistration";
|
|||||||
import "./i18n";
|
import "./i18n";
|
||||||
import "./libs/polyfills";
|
import "./libs/polyfills";
|
||||||
|
|
||||||
import { isDarkMode, isElectronContext } from "./utils";
|
import { isDarkMode } from "./utils";
|
||||||
|
|
||||||
const root = ReactDOM.createRoot(document.getElementById("root") as HTMLElement);
|
const root = ReactDOM.createRoot(document.getElementById("root") as HTMLElement);
|
||||||
// electron context
|
|
||||||
if (isElectronContext()) {
|
|
||||||
document.body.classList.add("electron");
|
|
||||||
}
|
|
||||||
// dark mode
|
// dark mode
|
||||||
if (isDarkMode()) {
|
if (isDarkMode()) {
|
||||||
document.documentElement.classList.add("dark");
|
document.documentElement.classList.add("dark");
|
||||||
|
|||||||
Reference in New Issue
Block a user