all quotes should be double quotes

This commit is contained in:
Wolfgang 2024-05-27 15:36:51 +02:00
parent 5af87fed5b
commit ca1f23bf9c

View file

@ -31,15 +31,15 @@ div>label {
<script>
// require in browser-cjs
// eslint-disable-next-line no-undef
const yaml = require('https://unpkg.com/js-yaml/dist/js-yaml.min.js');
const yaml = require("https://unpkg.com/js-yaml/dist/js-yaml.min.js");
// eslint-disable-next-line no-undef
const Measures = require('https://unpkg.com/measures/dist/measures.cjs.js');
const Measures = require("https://unpkg.com/measures/dist/measures.cjs.js");
// eslint-disable-next-line no-undef
const path = require('https://unpkg.com/path-browserify/index.js');
const path = require("https://unpkg.com/path-browserify/index.js");
function create_element_link(element, href) {
element.addEventListener("click", () => {
let lnk = document.createElement('a');
let lnk = document.createElement("a");
if (typeof href === "function") {
lnk.href = href();
@ -59,7 +59,7 @@ div>label {
});
}
document.addEventListener('DOMContentLoaded', () => {
document.addEventListener("DOMContentLoaded", () => {
location.search.substr(1).split("&").forEach((param) => {
let p = param.split("=");
let key = p[0];
@ -75,14 +75,14 @@ div>label {
["base", "extension"].forEach((id) => {
create_element_link(document.getElementById("download_" + id), document.getElementById(id + "_plan").value);
document.getElementById("download_" + id).addEventListener("keydown", (event) => {
if (event.key === 'Enter') {
if (event.key === "Enter") {
update_plan()
}
});
});
create_element_link(document.getElementById("create_link"), function() {
return window.location.href.split('?')[0] + '?'
return window.location.href.split("?")[0] + "?"
+ "base=" + document.getElementById("base_plan").value
+ "&ext=" + document.getElementById("extension_plan").value;
});
@ -90,7 +90,7 @@ div>label {
// eslint-disable-next-line no-unused-vars
function filter_with_not(headerValue, rowValue, rowData, filterParams){
if (headerValue.startsWith('!')) {
if (headerValue.startsWith("!")) {
// filter not
const str = headerValue.slice(1);
if ((str.length > 0) && (typeof rowValue !== "undefined")) {
@ -123,9 +123,9 @@ div>label {
function add_column(row, cols, header) {
header.columns.forEach((col) => {
if (header.columns.includes(col)) {
if (typeof cols[col] === 'object') {
if (typeof cols[col] === "object") {
for (const [key, value] of Object.entries(cols[col])) {
row[col + '_' + key] = value;
row[col + "_" + key] = value;
}
} else {
row[col] = cols[col];
@ -179,7 +179,7 @@ div>label {
if ((typeof ext.header === "undefined") || (ext.header == false)) {
add_column(row, base, header["base"]);
let [ext_start, ext_end] = ext.frequency.split('-');
let [ext_start, ext_end] = ext.frequency.split("-");
if (typeof base.frequency === "number") {
// at single frequency
if (isInRange(base.frequency, ext_start, ext_end)) {
@ -189,7 +189,7 @@ div>label {
}
} else {
// frequeny range
let [base_start, base_end] = base.frequency.split('-');
let [base_start, base_end] = base.frequency.split("-");
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"]);
@ -200,7 +200,7 @@ div>label {
let r = structuredClone(row);
let start = ext_start;
let end = base_end < ext_end ? base_end : ext_end;
r["frequency"] = start + '-' + end;
r["frequency"] = start + "-" + end;
add_column(r, ext, header["extension"]);
tdata.push(r);
already_added = true;
@ -209,7 +209,7 @@ div>label {
let r = structuredClone(row);
let start = base_start;
let end = ext_end;
r["frequency"] = start + '-' + end;
r["frequency"] = start + "-" + end;
add_column(r, ext, header["extension"]);
tdata.push(r);
already_added = true;
@ -241,7 +241,7 @@ div>label {
definitions.forEach((column) => {
if (column.field == "band") {
column.sorter = function(a, b) {
return parseFloat(new Measures().from(a).to('m')) - parseFloat(new Measures().from(b).to('m'));
return parseFloat(new Measures().from(a).to("m")) - parseFloat(new Measures().from(b).to("m"));
}
}
@ -270,7 +270,7 @@ div>label {
}
table.download(
"pdf",
path.basename(document.getElementById('base_plan').value, '.yml') + '.pdf',
path.basename(document.getElementById("base_plan").value, ".yml") + ".pdf",
{ orientation:"portrait" },
download_range);
});
@ -293,8 +293,8 @@ div>label {
function update_plan() {
Promise.all([
fetch(document.getElementById('base_plan').value, { mode: 'cors' }),
fetch(document.getElementById('extension_plan').value, { mode: 'cors' }),
fetch(document.getElementById("base_plan").value, { mode: "cors" }),
fetch(document.getElementById("extension_plan").value, { mode: "cors" }),
]).then((res) => {
res.forEach((r) => {
if (!r.ok) {
@ -319,12 +319,12 @@ div>label {
// eslint-disable-next-line no-unused-vars
function help() {
alert(
'Base plan and Extension plan: use your own yml file for a band plan, 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'
+ 'Download plans: get the yml plans\n'
+ 'Create link: get link for currently selected plans for bookmarking\n'
"Base plan and Extension plan: use your own yml file for a band plan, 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"
+ "Download plans: get the yml plans\n"
+ "Create link: get link for currently selected plans for bookmarking\n"
);
}
</script>