FacilMap OSM Analysis Tools

Adds links to FacilMap OSM Analysis Tools to OpenStreetMap feature and changeset pages.

  1. // ==UserScript==
  2. // @name FacilMap OSM Analysis Tools
  3. // @namespace https://facilmap.org/
  4. // @description Adds links to FacilMap OSM Analysis Tools to OpenStreetMap feature and changeset pages.
  5. // @include https://www.openstreetmap.org/changeset/*
  6. // @include https://www.openstreetmap.org/relation/*
  7. // @include https://www.openstreetmap.org/way/*
  8. // @include https://www.openstreetmap.org/node/*
  9. // @license BSD-2
  10. // @version 0.0.1.20250310074008
  11. // ==/UserScript==
  12.  
  13. const m = location.pathname.match(/^\/(changeset|relation|way|node)\/(\d+)/);
  14. if (m) {
  15. const [, type, id] = m;
  16.  
  17. if (type === "changeset") {
  18. document.querySelector(".browse-section .details").insertAdjacentHTML("afterend", `<ul class="list-unstyled"></ul>`);
  19. }
  20. if (["relation", "way", "node", "changeset"].includes(type)) {
  21. document.querySelector(".browse-section ul").insertAdjacentHTML("beforeend", `<li><a href="https://facilmap.org/#q=${type}%20${id}" target="_blank">Open on FacilMap</a></li>`);
  22. }
  23. if (["relation", "way"].includes(type)) {
  24. document.querySelector(".browse-section ul").insertAdjacentHTML("beforeend", `<li><a href="https://facilmap.org/#q=blame%20${type}%20${id}" target="_blank">Blame on FacilMap</a></li>`);
  25. }
  26. }