Compare commits
No commits in common. "64d4f68eb3a6dd45ec8f5bb65a1efe5f23a9fdbc" and "3ae347bbfef9a4951a8bd32f03732284aa9e2877" have entirely different histories.
64d4f68eb3
...
3ae347bbfe
|
@ -8,7 +8,6 @@
|
|||
description: Description
|
||||
}
|
||||
frequency_unit: kHz
|
||||
frequency_fraction_digits: 0
|
||||
comments:
|
||||
- Source Base: '<a href="https://www.iaru-r1.org/wp-content/uploads/2021/06/hf_r1_bandplan.pdf">https://www.iaru-r1.org/wp-content/uploads/2021/06/hf_r1_bandplan.pdf</a>'
|
||||
- Source Base Date: "2021-06-09"
|
||||
|
|
102
band-plan.html
102
band-plan.html
|
@ -66,7 +66,7 @@ div>label {
|
|||
location.search.substr(1).split("&").forEach((param) => {
|
||||
let p = param.split("=");
|
||||
let key = p[0];
|
||||
["base", "regulation", "css"].forEach((id) => {
|
||||
["base", "extension", "css"].forEach((id) => {
|
||||
if (key === id) {
|
||||
document.getElementById(id + "_input").value = decodeURIComponent(p[1]);
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ div>label {
|
|||
});
|
||||
update_inputs();
|
||||
|
||||
["base", "regulation", "css"].forEach((id) => {
|
||||
["base", "extension", "css"].forEach((id) => {
|
||||
// download buttons
|
||||
create_element_link(document.getElementById("download_" + id), document.getElementById(id + "_input").value);
|
||||
// enter on input fields
|
||||
|
@ -88,7 +88,7 @@ div>label {
|
|||
create_element_link(document.getElementById("create_link"), function() {
|
||||
return window.location.href.split("?")[0] + "?"
|
||||
+ "base=" + document.getElementById("base_input").value
|
||||
+ "®ulation=" + document.getElementById("regulation_input").value
|
||||
+ "&extension=" + document.getElementById("extension_input").value
|
||||
+ "&css=" + document.getElementById("css_input").value;
|
||||
});
|
||||
});
|
||||
|
@ -125,27 +125,15 @@ div>label {
|
|||
return Number(number) >= Number(min) && Number(number) <= Number(max);
|
||||
}
|
||||
|
||||
function add_column(row, cols, header, minimum_fraction_digits = 0) {
|
||||
const formatter = new Intl.NumberFormat("en-US", {
|
||||
minimumFractionDigits: minimum_fraction_digits,
|
||||
maximumFractionDigits: 100,
|
||||
});
|
||||
function add_column(row, cols, header) {
|
||||
header.columns.forEach((col) => {
|
||||
if (header.columns.includes(col)) {
|
||||
if (typeof cols[col] === "object") {
|
||||
for (const [key, value] of Object.entries(cols[col])) {
|
||||
if ((key === "frequency") && (typeof value === "number")) {
|
||||
row[col + "_" + key] = formatter.format(value);
|
||||
} else {
|
||||
row[col + "_" + key] = value;
|
||||
}
|
||||
row[col + "_" + key] = value;
|
||||
}
|
||||
} else {
|
||||
if ((col === "frequency") && (typeof cols[col] === "number")) {
|
||||
row[col] = formatter.format(cols[col]);
|
||||
} else {
|
||||
row[col] = cols[col];
|
||||
}
|
||||
row[col] = cols[col];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -161,13 +149,11 @@ div>label {
|
|||
}
|
||||
});
|
||||
document.getElementById("comments_" + key).innerHTML = s;
|
||||
} else {
|
||||
document.getElementById("comments_" + key).innerHTML = "";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function update_table(bases, regulations) {
|
||||
function update_table(bases, extensions) {
|
||||
let tdata = [];
|
||||
let header = {};
|
||||
|
||||
|
@ -183,53 +169,53 @@ div>label {
|
|||
if ((typeof base.header === "undefined") || (base.header == false)) {
|
||||
let row = {};
|
||||
|
||||
// first, fill reg_header
|
||||
regulations.forEach((reg) => {
|
||||
if ((typeof reg.header !== "undefined") && reg.header) {
|
||||
header["regulation"] = structuredClone(reg);
|
||||
// first, fill ext_header
|
||||
extensions.forEach((ext) => {
|
||||
if ((typeof ext.header !== "undefined") && ext.header) {
|
||||
header["extension"] = structuredClone(ext);
|
||||
}
|
||||
});
|
||||
|
||||
fill_comments(header);
|
||||
|
||||
// then fill tdata
|
||||
regulations.forEach((reg) => {
|
||||
if ((typeof reg.header === "undefined") || (reg.header == false)) {
|
||||
add_column(row, base, header["base"], header["base"].frequency_fraction_digits);
|
||||
extensions.forEach((ext) => {
|
||||
if ((typeof ext.header === "undefined") || (ext.header == false)) {
|
||||
add_column(row, base, header["base"]);
|
||||
|
||||
let [reg_start, reg_end] = reg.frequency.split("-");
|
||||
reg_start = Qty(Number(reg_start), header["regulation"].frequency_unit).to(header["base"].frequency_unit).scalar;
|
||||
reg_end = Qty(Number(reg_end), header["regulation"].frequency_unit).to(header["base"].frequency_unit).scalar;
|
||||
let [ext_start, ext_end] = ext.frequency.split("-");
|
||||
ext_start = Qty(Number(ext_start), header["extension"].frequency_unit).to(header["base"].frequency_unit).scalar;
|
||||
ext_end = Qty(Number(ext_end), header["extension"].frequency_unit).to(header["base"].frequency_unit).scalar;
|
||||
if (typeof base.frequency === "number") {
|
||||
// at single frequency
|
||||
if (isInRange(base.frequency, reg_start, reg_end)) {
|
||||
add_column(row, reg, header["regulation"], header["base"].frequency_fraction_digits);
|
||||
if (isInRange(base.frequency, ext_start, ext_end)) {
|
||||
add_column(row, ext, header["extension"]);
|
||||
tdata.push(row);
|
||||
}
|
||||
} else {
|
||||
// frequeny range
|
||||
let [base_start, base_end] = base.frequency.split("-");
|
||||
if (isInRange(base_start, reg_start, reg_end) && isInRange(base_end, reg_start, reg_end)) {
|
||||
// base range is inside of reg range or the same
|
||||
add_column(row, reg, header["regulation"]);
|
||||
if (isInRange(base_start, ext_start, ext_end) && isInRange(base_end, ext_start, ext_end)) {
|
||||
// base range is inside of ext range or the same
|
||||
add_column(row, ext, header["extension"]);
|
||||
tdata.push(row);
|
||||
} else {
|
||||
// base range is split by reg range
|
||||
if ((base_end > reg_start) && isInRange(reg_start, base_start, base_end)) {
|
||||
// base range starts below reg range
|
||||
// base range is split by ext range
|
||||
if ((base_end > ext_start) && isInRange(ext_start, base_start, base_end)) {
|
||||
// base range starts below ext range
|
||||
let r = structuredClone(row);
|
||||
let start = reg_start;
|
||||
let end = base_end < reg_end ? base_end : reg_end;
|
||||
let start = ext_start;
|
||||
let end = base_end < ext_end ? base_end : ext_end;
|
||||
r["frequency"] = start + "-" + end;
|
||||
add_column(r, reg, header["regulation"]);
|
||||
add_column(r, ext, header["extension"]);
|
||||
tdata.push(r);
|
||||
} else if ((reg_end > base_start) && isInRange(reg_end, base_start, base_end)) {
|
||||
// reg range starts below base range
|
||||
} else if ((ext_end > base_start) && isInRange(ext_end, base_start, base_end)) {
|
||||
// ext range starts below base range
|
||||
let r = structuredClone(row);
|
||||
let start = base_start;
|
||||
let end = reg_end;
|
||||
let end = ext_end;
|
||||
r["frequency"] = start + "-" + end;
|
||||
add_column(r, reg, header["regulation"]);
|
||||
add_column(r, ext, header["extension"]);
|
||||
tdata.push(r);
|
||||
}
|
||||
}
|
||||
|
@ -307,8 +293,8 @@ div>label {
|
|||
if (typeof header["base"].titles[column.field] !== "undefined") {
|
||||
column.title = header["base"].titles[column.field];
|
||||
}
|
||||
if (typeof header["regulation"].titles[column.field] !== "undefined") {
|
||||
column.title = header["regulation"].titles[column.field];
|
||||
if (typeof header["extension"].titles[column.field] !== "undefined") {
|
||||
column.title = header["extension"].titles[column.field];
|
||||
}
|
||||
|
||||
// add css styles for formatting based on cell values
|
||||
|
@ -380,7 +366,7 @@ div>label {
|
|||
function update_inputs() {
|
||||
Promise.all([
|
||||
fetch(document.getElementById("base_input").value, { mode: "cors" }),
|
||||
fetch(document.getElementById("regulation_input").value, { mode: "cors" }),
|
||||
fetch(document.getElementById("extension_input").value, { mode: "cors" }),
|
||||
]).then((res) => {
|
||||
res.forEach((r) => {
|
||||
if (!r.ok) {
|
||||
|
@ -389,11 +375,7 @@ div>label {
|
|||
});
|
||||
Promise.all([res[0].text(), res[1].text()]).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);
|
||||
}
|
||||
|
@ -425,9 +407,7 @@ div>label {
|
|||
// eslint-disable-next-line no-unused-vars
|
||||
function help() {
|
||||
alert(
|
||||
"Base plan, regulation and css: use your own files for the band plan and css, URLs are possible, CORS needs to be allowed for the files, download standard files for examples\n"
|
||||
+ "When Regulation is empty, all frequencies from base plan will be included\n"
|
||||
+ "When CSS is empty or URL not available, colors, etc. will be gone\n"
|
||||
"Base plan, extension plan and css: use your own files for the band plan and css, URLs are possible, CORS needs to be allowed for the files, download standard files for examples\n"
|
||||
+ "Filter rows with text in column headings, use filter starting with \"!\" as exclusion\n"
|
||||
+ "Download list: saves .pdf of the current list (selection of rows apply)\n"
|
||||
+ "Selection of rows with mouse possible\n"
|
||||
|
@ -440,8 +420,8 @@ div>label {
|
|||
<label>Base Plan:
|
||||
<input id="base_input" type="text" value="band-plan-iaru_r1_hf.yml">
|
||||
</label>
|
||||
<label>Regulation:
|
||||
<input id="regulation_input" type="text" value="regulations-de.yml">
|
||||
<label>Extension:
|
||||
<input id="extension_input" type="text" value="band-plan-de.yml">
|
||||
</label>
|
||||
<label>CSS:
|
||||
<input id="css_input" type="text" value="standard.css">
|
||||
|
@ -452,7 +432,7 @@ div>label {
|
|||
<div>
|
||||
<button id="download">Download list</button>
|
||||
<button id="download_base">Download base plan</button>
|
||||
<button id="download_regulation">Download regulation</button>
|
||||
<button id="download_extension">Download extension plan</button>
|
||||
<button id="download_css">Download css file</button>
|
||||
<button id="create_link">Create link</button>
|
||||
<button onclick="help()">Help</button>
|
||||
|
@ -460,7 +440,7 @@ div>label {
|
|||
<div id="data-table"></div>
|
||||
<div id="error"></div>
|
||||
<div id="comments_base"></div>
|
||||
<div id="comments_regulation"></div>
|
||||
<div id="comments_extension"></div>
|
||||
<div>
|
||||
<p>This information is supplied without liability.</p>
|
||||
<p>Source is at <a href="https://src.dm5wk.de/dm5wk/band-plan-web/">https://src.dm5wk.de/dm5wk/band-plan-web/</a></p>
|
||||
|
|
Loading…
Reference in a new issue