Allow fetching from multiple sources

This commit is contained in:
metacryst
2026-04-16 18:27:24 -05:00
parent 0bb544e96c
commit 142d4a3fc3
7 changed files with 55 additions and 153 deletions

View File

@@ -10,9 +10,10 @@
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<link rel="manifest" href="./manifest.json" />
<link rel="stylesheet" href="./_/code/shared.css" />
<link rel="stylesheet" href="" />
<script>window.config = { UI: 'https://frm.so', SERVER: 'https://frm.so' }</script>
<script type="module">
await import('./util.js')
await import('./mobileutil.js')
function appendScript(src, isModule = false) {
return new Promise((resolve, reject) => {
@@ -26,9 +27,24 @@
})
}
function appendStylesheet(href, { replaceExisting = false } = {}) {
return new Promise((resolve, reject) => {
if (replaceExisting) {
document.querySelector('link[rel="stylesheet"]')?.remove();
}
const link = document.createElement('link');
link.rel = 'stylesheet';
link.href = href;
link.onload = resolve;
link.onerror = reject;
document.head.appendChild(link);
});
}
try {
await appendScript(window.util.HOST + '/_/code/quill.js')
await appendScript(window.util.HOST + '/83947261/index.js', true)
await appendStylesheet(`${window.config.UI}/_/code/shared.css`, { replaceExisting: true });
await appendScript(window.config.UI + '/_/code/quill.js')
await appendScript(window.config.UI + '/83947261/index.js', true)
} catch (e) {
document.body.innerHTML = `
<style>