-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathoptions.ts
More file actions
51 lines (41 loc) · 1.22 KB
/
options.ts
File metadata and controls
51 lines (41 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/// <reference path="../common/constants.d.ts" />
import { h, render } from 'preact';
import { Config } from '../common/config';
import { startBugsnag } from '../utils/bugsnag';
import {
isChromium,
isEdge,
isFenix,
isFirefox,
isSafari,
} from '../utils/ua-utils';
import { OptionsPage } from './OptionsPage';
import './options.css';
startBugsnag();
const config = new Config();
function completeForm() {
// UA-specific styles
// We only add the 'firefox' class on desktop Firefox since Fenix doesn't
// include browser styles.
if (isFirefox() && !isFenix()) {
document.documentElement.classList.add('firefox');
}
if (isChromium()) {
document.documentElement.classList.add('chromium');
}
if (isEdge()) {
document.documentElement.classList.add('edge');
}
if (isSafari()) {
document.documentElement.classList.add('safari');
}
const container = document.getElementById('container')!;
// We add the `options` class to prevent style clashes in React Cosmos:
// https://github.com/react-cosmos/react-cosmos/discussions/1638.
container.classList.add('options');
render(h(OptionsPage, { config }), container);
}
window.onload = async () => {
await config.ready;
completeForm();
};