OSM Hide Relation Centroid Circle

Hides the orange circle that appears at the centroid of selected relations (e.g. municipality/county borders) on openstreetmap.org

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         OSM Hide Relation Centroid Circle
// @name:sv      OSM – Dölj relations-centroidcirkel
// @namespace    https://greasyfork.org/users/1168708-rotski
// @version      1.0.1
// @description  Hides the orange circle that appears at the centroid of selected relations (e.g. municipality/county borders) on openstreetmap.org
// @description:sv Döljer den orange cirkeln som visas vid centroiden av valda relationer (t.ex. kommun- och länsgränser) på openstreetmap.org
// @author       Rotski + Claude
// @match        https://www.openstreetmap.org/*
// @icon         https://www.openstreetmap.org/favicon.ico
// @grant        none
// @license      MIT
// ==/UserScript==

(function () {
  'use strict';

  var DEFAULT_COLOR = '#FF6200';
  var currentColor = GM_getValue('borderColor', DEFAULT_COLOR);

  function applyStyles() {
    document.querySelectorAll('.leaflet-interactive').forEach(function (el) {
      var stroke = el.getAttribute('stroke') || '';
      var fill = el.getAttribute('fill') || '';
      var d = el.getAttribute('d') || '';
      if (!d) return;
      if (fill === '#FF6200') {
        el.style.display = 'none';
      } else if (stroke === '#FF6200') {
        el.style.stroke = currentColor;
        el.style.fill = 'none';
      }
    });
  }

  // UI
  var ui = document.createElement('div');
  ui.style.cssText = [
    'position:fixed',
    'bottom:20px',
    'right:20px',
    'z-index:99999',
    'background:#fff',
    'border:1px solid #ccc',
    'border-radius:8px',
    'padding:10px 14px',
    'font:13px/1.4 sans-serif',
    'box-shadow:0 2px 8px rgba(0,0,0,0.2)',
    'display:flex',
    'align-items:center',
    'gap:8px'
  ].join(';');

  var label = document.createElement('span');
  label.textContent = 'Gränsfärg:';

  var picker = document.createElement('input');
  picker.type = 'color';
  picker.value = currentColor;
  picker.style.cssText = 'width:36px;height:28px;border:none;padding:0;cursor:pointer;background:none';

  var resetBtn = document.createElement('button');
  resetBtn.textContent = 'Återställ';
  resetBtn.style.cssText = 'font:12px sans-serif;padding:4px 8px;cursor:pointer;border:1px solid #ccc;border-radius:4px;background:#f5f5f5';

  picker.addEventListener('input', function () {
    currentColor = picker.value;
    GM_setValue('borderColor', currentColor);
    applyStyles();
  });

  resetBtn.addEventListener('click', function () {
    currentColor = DEFAULT_COLOR;
    picker.value = DEFAULT_COLOR;
    GM_setValue('borderColor', DEFAULT_COLOR);
    applyStyles();
  });

  ui.appendChild(label);
  ui.appendChild(picker);
  ui.appendChild(resetBtn);
  document.body.appendChild(ui);

  new MutationObserver(applyStyles).observe(document.documentElement, {
    childList: true,
    subtree: true
  });

  applyStyles();
  setTimeout(applyStyles, 500);
  setTimeout(applyStyles, 1500);
})();