leaflet-extras / leaflet-providers

An extension to Leaflet that contains configurations for various free tile providers.
https://leaflet-extras.github.io/leaflet-providers/preview/
BSD 2-Clause "Simplified" License
2.11k stars 662 forks source link

preview in browser tabs #544

Open divinity76 opened 6 months ago

divinity76 commented 6 months ago

I wanted to preview everything in a dedicated browser tab, that wasn't easy to do, came up with

// run on https://leaflet-extras.github.io/leaflet-providers/preview/
// then scroll to bottom of page, hold down CTRL and click 100 times.
[...document.querySelectorAll("[name=leaflet-base-layers]")].map((ele) => ele.parentNode.textContent.trim()).forEach(function(filterString) {
    let a = document.createElement("a");
    a.href = "#filter=" + encodeURIComponent(filterString);
    a.textContent = filterString;
    a.appendChild(document.createElement("br"));
    a.target = "_blank";
    a.addEventListener("click", () => a.parentNode.removeChild(a));
    document.body.appendChild(a);
});
brunob commented 6 months ago

Do you mean preview all overlays ? What do you mean by "then scroll to bottom of page, hold down CTRL and click 100 times" ? Is it a rant, a call for help, a enhancement idea ?