Compare commits

...

7 commits

3 changed files with 294 additions and 44 deletions

View file

@ -1,3 +1,13 @@
# band-plan-web # band-plan-web
Create a customizable band plan for amateur radio Create a customizable band plan for amateur radio
Demo of the latest git version on [dm5wk.de](https://dm5wk.de/band-plan/).
It is possible to
- use an own plan in yaml format
- toggle columns
- filter rows
- negate filter rows with "!"
- select rows with the mouse
- download the plan in pdf format

View file

@ -13,6 +13,9 @@
body>div { body>div {
padding-bottom: 1em; padding-bottom: 1em;
} }
div#togglebuttons>button {
margin: 0 0.1em;
}
</style> </style>
</head> </head>
@ -33,6 +36,12 @@ body>div {
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
update_plan(); update_plan();
document.getElementById("sel_plan").addEventListener("keydown", (event) => {
if (event.key === 'Enter') {
update_plan()
}
});
}); });
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
@ -55,8 +64,21 @@ body>div {
} }
} }
function display_error(e) {
let t = document.getElementById("data-table");
t.innerHTML = "";
t.removeAttribute("class");
console.log(e);
document.getElementById("error").innerText = e;
}
function update_plan() { function update_plan() {
fetch(document.getElementById('sel_plan').value).then((response) => { fetch(document.getElementById('sel_plan').value, {
mode: 'cors'
}).then((response) => {
if (!response.ok) {
throw new Error(response.status);
}
return response.text(); return response.text();
}).then((data) => { }).then((data) => {
try { try {
@ -99,45 +121,62 @@ body>div {
{title: "description", field: "description", headerFilter: "input", headerFilterFunc: filter_with_not}, {title: "description", field: "description", headerFilter: "input", headerFilterFunc: filter_with_not},
], ],
}); });
document.getElementById("print").addEventListener("click", () => {
document.getElementById("download").addEventListener("click", () => {
let download_range = "all"; let download_range = "all";
if (table.getSelectedRows().length > 0) { if (table.getSelectedRows().length > 0) {
download_range = "selected"; download_range = "selected";
} }
table.download("pdf", path.basename(document.getElementById('sel_plan').value, '.yml') + '.pdf', {}, download_range); table.download(
"pdf",
path.basename(document.getElementById('sel_plan').value, '.yml') + '.pdf',
{ orientation:"portrait" },
download_range);
}); });
//["band", "frequency", "bandwidth", "mode", "description"].forEach((col) => {
table.getColumns().forEach((col) => { table.on("tableBuilt", () => {
document.getElementById("toggle-" + col).addEventListener("click", () => { var div_togglebuttons = document.getElementById("togglebuttons");
table.toggleColumn(col); div_togglebuttons.innerHTML = "<span>Toggle column:</span>";
table.getColumns().forEach((col) => {
let col_name = col.getField();
let b = document.createElement("button");
b.innerText = col_name;
b.addEventListener("click", () => {
table.toggleColumn(col_name);
});
div_togglebuttons.appendChild(b);
});
}); });
}); document.getElementById("error").innerText = "";
document.getElementById("error").innerText = ""; } catch (e) {
} catch (e) { display_error(e);
console.log(e); }
document.getElementById("error").innerText = e; }).catch((e) => {
} display_error(e);
}); });
} }
// used in button
// eslint-disable-next-line no-unused-vars
function help() {
alert(
'Plan: use your own yml file for a band plan, URLs are possible, CORS needs to be allowed for the file\n'
+ 'Filter rows with text in column headings, use filter starting with "!" as exclusion\n'
+ 'Download list: saves .pdf of the current list\n'
+ 'Selection of rows with mouse possible'
);
}
</script> </script>
<div> <div>
<form name="selection"> <label>Plan:
<label>plan: <input name="plan" id="sel_plan" type="text" value="plan-de.yml">
<input name="plan" id="sel_plan" type="text" value="/plan-de.yml"> </label>
</label> <button onclick="update_plan()">Change plan</button>
<button onclick="update_plan()">Change plan</button>
<button id="print">Print plan</button>
</form>
</div>
<div>
<button id="toggle-band">Toggle band</button>
<button id="toggle-frequency">Toggle frequency</button>
<button id="toggle-bandwidth">Toggle bandwidth</button>
<button id="toggle-mode">Toggle mode</button>
<button id="toggle-description">Toggle description</button>
</div> </div>
<div id="togglebuttons"></div>
<div> <div>
Use filter with "!" as "not". <button id="download">Download list</button>
<button onclick="help()">Help</button>
</div> </div>
<div id="data-table"></div> <div id="data-table"></div>
<div id="error"></div> <div id="error"></div>

View file

@ -326,18 +326,219 @@
at: 18150 at: 18150
- description: Emergency Centre of Activity - description: Emergency Centre of Activity
at: 18160 at: 18160
#- band: 10 m - band: 15 m
# mode: SSBTest mode: CW
# bandwidth: 2700 bandwidth: 200
# start: 28320 start: 21000
# end: 29000 end: 21000
# parts: parts:
# - - description: QRS Centre of Activity
# description: Digital Voice at: 21055
# at: 28330 - description: QRP Centre of Activity
# - at: 21060
# description: QRP - start: 21000
# at: 28360 end: 21070
# - - band: 15 m
# description: Image Centre of Activity mode: Narrow band modes
# at: 28680 bandwidth: 500
start: 21070
end: 21110
parts:
- description: Digimodes
start: 21070
end: 21090
- description: Digimodes, automatically controlled data stations (unattended)
start: 21090
end: 21110
- band: 15 m
mode: All modes
bandwidth: 2700
start: 21110
end: 21120
parts:
- description: Digimodes, automatically controlled data stations (unattended), (not SSB)
start: 21110
end: 21120
- band: 15 m
mode: Narrow band modes
bandwidth: 500
start: 21120
end: 21149
parts:
- description: Narrow band modes
start: 21120
end: 21149
- band: 15 m
mode: International Beacon Project
start: 21149
end: 21151
parts:
- description: Beacons exclusively
start: 21149
end: 21151
- band: 15 m
mode: All modes
bandwidth: 2700
start: 21151
end: 21450
parts:
- description: Digital Voice Centre of Activity
at: 21180
- description: SSB QRP Centre of Activity
at: 21285
- description: Image Centre of Activity
at: 21340
- description: Global Emergency Centre of Activity
at: 21360
- start: 21151
end: 21450
- band: 12 m
mode: CW
bandwidth: 200
start: 24890
end: 24915
parts:
- description: CW QRP Centre of Activity
at: 24906
- start: 24890
end: 24915
- band: 12 m
mode: Narrow band modes
bandwidth: 500
start: 24915
end: 24929
parts:
- description: Digimodes
start: 24915
end: 24925
- description: Digimodes, automatically controlled data stations (unattended)
start: 24925
end: 24929
- band: 12 m
mode: International Beacon Project
start: 24929
end: 24931
parts:
- description: Beacons exclusively
start: 24929
end: 24931
- band: 12 m
mode: All modes
bandwidth: 2700
start: 24931
end: 24990
parts:
- description: Digimodes, automatically controlled data stations (unattended)
start: 24931
end: 24940
- description: SSB QRP Centre of Activity
at: 24950
- description: Digital Voice Centre of Activity
at: 24960
- start: 24940
end: 24990
- band: 10 m
mode: CW
bandwidth: 200
start: 28000
end: 28070
parts:
- description: QRS Centre of Activity
at: 28055
- description: QRP Centre of Activity
at: 28060
- start: 28000
end: 28070
- band: 10 m
mode: Narrow band modes
bandwidth: 500
start: 28070
end: 28190
parts:
- description: Digimodes
start: 28070
end: 28120
- description: Digimodes, automatically controlled data stations (unattended)
start: 28120
end: 28150
- start: 28150
end: 28190
- band: 10 m
mode: International Beacon Project
start: 28190
end: 28225
parts:
- description: Regional time shared beacons, exclusively
start: 28190
end: 28199
- description: Worldwide time shared beacons, exclusively
start: 28199
end: 28201
- description: Continuous duty beacons, exclusively
start: 28201
end: 28225
- band: 10 m
mode: All modes
bandwidth: 2700
start: 28225
end: 29000
parts:
- description: Beacons
start: 28225
end: 28300
- description: Digimodes, automatically controlled data stations (unattended)
start: 28300
end: 28320
- description: Digital Voice Centre of Activity
at: 28330
- description: QRP Centre of Activity
at: 28360
- description: Image Centre of Activity
at: 28680
- start: 28320
end: 29000
- band: 10 m
mode: All modes
bandwidth: (unrestricted)
start: 29000
end: 29300
parts:
- start: 29000
end: 29100
- description: FM simplex - 10 kHz channels
start: 29100
end: 29200
- description: Digimodes, automatically controlled data stations (unattended)
start: 29200
end: 29300
- band: 10 m
mode: Satellite Links
bandwidth: (unrestricted)
start: 29300
end: 29510
parts:
- start: 29300
end: 29510
- band: 10 m
mode: Guard Channel
start: 29510
end: 29520
parts:
- start: 29510
end: 29520
- band: 10 m
mode: All modes
bandwidth: 6000
start: 29520
end: 29700
parts:
- description: FM Repeater input (RH1-RH8)
start: 29520
end: 29590
- description: FM Calling channel
at: 29600
- description: FM Simplex Repeater (parrot, input + output)
at: 29610
- description: FM Repeater output (RH1-RH8)
start: 29620
end: 29700