import { DmarcTool } from "./tools/DmarcTool.js";
const tools = {
"/dmarc-creator": DmarcTool,
};
const Tool = tools[location.pathname];
addFields(document.getElementById("form"), Tool.fields.filter(field => !field.categoryName));
const categories = Tool.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 tool = new Tool(); document.getElementById("record").value = tool.fieldsToString(); } document.getElementById("record").onclick = (e) => { e.target.select(); document.execCommand("copy"); } function isUnique(value, index, array) { return array.indexOf(value) === index; }