@trailstash/ultra
Version:
A web based tool for making MapLibre GL maps with data from sources such as Overpass, GeoJSON, GPX, KML, TCX, etc
19 lines (17 loc) • 569 B
JavaScript
const el = document.createElement("iframe");
el.setAttribute("style", document.currentScript.getAttribute("style"));
document.currentScript.style.display = "none";
const params = new URLSearchParams();
params.set("query", document.currentScript.text.trim());
el.src = new URL(
`/#map&${params.toString()}`,
document.currentScript.src,
).toString();
if (document.currentScript.nextSibling) {
document.currentScript.parentElement.insertBefore(
el,
document.currentScript.nextSibling,
);
} else {
document.currentScript.parentElement.appendChild(el);
}