diff --git a/band-plan.html b/band-plan.html index 3a6d421..59fcece 100644 --- a/band-plan.html +++ b/band-plan.html @@ -37,6 +37,28 @@ div>label { // eslint-disable-next-line no-undef const path = require('https://unpkg.com/path-browserify/index.js'); + function create_element_link(element, href) { + element.addEventListener("click", () => { + var lnk = document.createElement('a'); + + if (typeof href === "function") { + lnk.href = href(); + } else { + lnk.href = href; + } + + if (document.createEvent) { + let e = document.createEvent("MouseEvents"); + e.initMouseEvent("click", true, true, window, + 0, 0, 0, 0, 0, false, false, false, + false, 0, null); + lnk.dispatchEvent(e); + } else if (lnk.fireEvent) { + lnk.fireEvent("onclick"); + } + }); + } + document.addEventListener('DOMContentLoaded', () => { location.search.substr(1).split("&").forEach((param) => { let p = param.split("="); @@ -55,6 +77,12 @@ div>label { update_plan() } }); + + create_element_link(document.getElementById("create_link"), function() { + return window.location.href.split('?')[0] + '?' + + "base=" + document.getElementById("base_plan").value + + "&ext=" + document.getElementById("extension_plan").value; + }); }); // eslint-disable-next-line no-unused-vars @@ -291,6 +319,7 @@ div>label {
+