This commit is contained in:
Dmitry Vasilev
2022-11-24 16:52:59 +08:00
parent c7f5cb231c
commit 77c1df54d4
2 changed files with 24 additions and 13 deletions

View File

@@ -376,14 +376,21 @@
</style>
<script type='module'>
// TODO remove
// Shortcut for log(...) instead of console.log(...)
window.log = console.log
import {init} from './src/index.js'
window.addEventListener('load', () => {
init(document.getElementById('app'))
})
if(new URLSearchParams(window.location.search).get('leporello') == null) {
const {init} = await import('./src/index.js');
(
document.readyState == 'complete'
? Promise.resolve()
: new Promise(resolve =>
window.addEventListener('load', resolve)
)
).then(() => {
init(document.getElementById('app'))
})
}
</script>
</head>

View File

@@ -195,14 +195,18 @@ export class UI {
click: e => e.stopPropagation(),
change: this.change_entrypoint,
},
Object.keys(state.files).sort().map(f =>
el('option',
state.entrypoint == f
? { value: f, selected: true }
: { value: f},
f == '' ? "*scratch*" : f
Object
.keys(state.files)
.sort()
.filter(f => f == '' || f.endsWith('.js') || f.endsWith('.mjs'))
.map(f =>
el('option',
state.entrypoint == f
? { value: f, selected: true }
: { value: f},
f == '' ? "*scratch*" : f
)
)
)
)
)
}