FacilMap OSM Analysis Tools

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

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name           FacilMap OSM Analysis Tools
// @namespace      https://facilmap.org/
// @description    Adds links to FacilMap OSM Analysis Tools to OpenStreetMap feature and changeset pages.
// @include        https://www.openstreetmap.org/changeset/*
// @include        https://www.openstreetmap.org/relation/*
// @include        https://www.openstreetmap.org/way/*
// @include        https://www.openstreetmap.org/node/*
// @license        BSD-2
// @version 0.0.1.20250310074008
// ==/UserScript==

const m = location.pathname.match(/^\/(changeset|relation|way|node)\/(\d+)/);
if (m) {
    const [, type, id] = m;

    if (type === "changeset") {
        document.querySelector(".browse-section .details").insertAdjacentHTML("afterend", `<ul class="list-unstyled"></ul>`);
    }
    if (["relation", "way", "node", "changeset"].includes(type)) {
        document.querySelector(".browse-section ul").insertAdjacentHTML("beforeend", `<li><a href="https://facilmap.org/#q=${type}%20${id}" target="_blank">Open on FacilMap</a></li>`);
    }
    if (["relation", "way"].includes(type)) {
        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>`);
    }
}