'use strict' import { loadContents } from './js/loader.js' /** * Design choice; define this as a "global function" (on window) so that it can * easily be used anywhere without needing to import it, as it's a pretty * fundemental thing. */ window.showBigError = (type, friendlyType, message) => { console.error("Error " + type + ": ", err) var err = document.createElement("div") err.classList.add("error") err.innerHTML = "

Error " + friendlyType + "

" + message + "

OliveTin Documentation

"; document.getElementById('rootGroup').appendChild(err) } function onInitialLoad(res) { window.restBaseUrl = res.Rest; window.fetch(window.restBaseUrl + "GetButtons").then(res => { return res.json() }).then(res => { loadContents(res) }).catch(err => { showBigError("fetch-initial-buttons", "getting initial buttons", err, "blat") }); } window.fetch('webUiSettings.json').then(res => { return res.json() }).then(res => { onInitialLoad(res) }).catch(err => { showBigError("fetch-webui-settings", "getting webui settings", err); })