import { DmarcRecord } from "./records/DmarcRecord.js";
const records = {
"/dmarc-creator": DmarcRecord,
};
const Record = records[location.pathname];
addFields(document.getElementById("form"), Record.fields.filter(field => !field.categoryName));
const categories = Record.fields.map(field => field.categoryName).filter(isUnique).filter(val => val);
for (const category of categories) {
const details = document.createElement("details");
details.innerHTML = `
${field.description ?? ""}
${field.getInputHtml()} `; } } document.getElementById("form").onchange = () => generate(); generate(); function generate() { const record = new Record(); document.getElementById("record").value = record.fieldsToString(); } document.getElementById("record").onclick = (e) => { e.target.select(); document.execCommand("copy"); } function isUnique(value, index, array) { return array.indexOf(value) === index; }