Allow fetching from multiple sources
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user