support for chrome69
Massimo Melina committed
Feb 2, 2024 at 23:03 UTC
fedf3591512eed98cde951a0551f677f7c31069a
6 files changed
+12
-5
frontend/index.html
+1
@@ -4,6 +4,7 @@
4
<meta charset="utf-8" />
5
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=0" />
6
<link href="/fontello.css" rel="stylesheet" />
7
+ <script src="//polyfill.io/v3/polyfill.min.js?features=es2022%2Ces2021%2Ces2020%2Ces2019%2Ces2018%2Ces2017"></script>
8
<script type="module" src="/src/index.ts"></script>
9
</head>
10
<body>
frontend/src/dialog.css
+2
-1
@@ -14,7 +14,8 @@
14
.dialog {
15
background: #fff; /*fallback*/
16
background: var(--bg);
17
- padding: max(0.5em, 1vw, 2vh);
17
+ padding: .5em; /* legacy */
18
+ padding: max(.5em, 1vw, 2vh);
19
padding-top: 0;
20
border-radius: 1em;
21
position: relative;
frontend/src/dialog.ts
+1
-1
@@ -48,7 +48,7 @@ export async function promptDialog(msg: string, { def, type, helperText, trim=tr
48
name: 'input',
49
style: {
50
width: def ? (def.length / 2) + 'em' : 'auto',
51
- minWidth: '100%', maxWidth: '100%',
51
+ minWidth: '100%', maxWidth: '100%', boxSizing: 'border-box',
52
...textarea && { width: '30em', maxHeight: '70vh' },
53
},
54
autoFocus: true,
frontend/vite.config.ts
+1
-1
@@ -5,7 +5,7 @@ export default defineConfig({
5
build: {
6
outDir: '../dist/frontend',
7
emptyOutDir: true,
8
- target: "es2015",
8
+ target: "chrome69",
9
},
10
server: {
11
port: 3005,
shared/index.ts
+6
-1
@@ -127,4 +127,9 @@ export function createDurationFormatter({ locale=undefined, unitDisplay='narrow'
127
}
128
return fmtList.format(a)
129
}
130
-}
\ No newline at end of file
130
+}
131
+
132
+Element.prototype.replaceChildren ||= function(this:Element, addNodes) { // polyfill
133
+ while (this.lastChild) this.removeChild(this.lastChild);
134
+ if (addNodes !== undefined) this.append(addNodes);
135
+}
src/serveGuiFiles.ts
+1
-1
@@ -84,7 +84,7 @@ async function treatIndex(ctx: Koa.Context, filesUri: string, body: string) {
84
})))
85
const lang = await getLangData(ctx)
86
let ret = body
87
- .replace(/((?:src|href) *= *['"])\/?(?![a-z]+:\/\/)/g, '$1' + ctx.state.revProxyPath + filesUri)
87
+ .replace(/((?:src|href) *= *['"])\/?(?!([a-z]+:\/)?\/)/g, '$1' + ctx.state.revProxyPath + filesUri)
88
.replace('<body>', () => `<body>
89
${!isFrontend ? '' : `
90
<title>${title.get()}</title>