diff --git a/band-plan.html b/band-plan.html
index 43d4a06..ae9b8c7 100644
--- a/band-plan.html
+++ b/band-plan.html
@@ -378,22 +378,30 @@ div>label {
}
function update_inputs() {
- Promise.all([
+ let urls = [
fetch(document.getElementById("base_input").value, { mode: "cors" }),
- fetch(document.getElementById("regulation_input").value, { mode: "cors" }),
- ]).then((res) => {
+ ];
+ let reg = document.getElementById("regulation_input").value;
+ if (reg !== "") {
+ urls.push(fetch(reg, { mode: "cors" }));
+ }
+
+ Promise.all(urls).then((res) => {
res.forEach((r) => {
if (!r.ok) {
throw new Error(r.status);
}
});
- Promise.all([res[0].text(), res[1].text()]).then((d) => {
+ let ymls = [res[0].text()];
+ if (reg !== "") {
+ ymls.push(res[1].text());
+ } else {
+ // make dummy yml file with one big frequency range
+ ymls.push("- header: true\n columns: []\n titles: []\n frequency_unit: GHz\n- frequency: 0-" + 9007199254740991);
+ }
+ Promise.all(ymls).then((d) => {
try {
- let reg = d[1];
- if (reg === "") {
- reg = "- header: true\n columns: []\n titles: []\n frequency_unit: GHz\n- frequency: 0-" + 9007199254740991;
- }
- update_table(yaml.load(d[0]), yaml.load(reg));
+ update_table(yaml.load(d[0]), yaml.load(d[1]));
} catch (e) {
display_error(e);
}