Link OSM changesets to achavi

Turns every changeset into a link that least to this useful change inspector.

目前為 2020-04-05 提交的版本,檢視 最新版本

// ==UserScript==
// @name        Link OSM changesets to achavi
// @description Turns every changeset into a link that least to this useful change inspector.
// @namespace   gf.qytechs.cn/users/4813-swyter
// @match       https://www.openstreetmap.org/user/*/history
// @grant       none
// @version     2020.04.05
// @author      Swyter
// @run-at      document-idle
// ==/UserScript==

/* swy: create an observer instance linked to the callback function as shown here:
        https://www.freecodecamp.org/forum/t/how-can-i-detect-or-trigger-an-event-when-text-in-p-tag-is-changed/270692/4 */
new MutationObserver(function(mutationsList, observer)
{
  for (var mutation of mutationsList)
    if (mutation.type == 'childList')
      console.log('[i] changesets frame refreshed, re-running the link-ifier: ', mutation);

  for (var elem of document.querySelectorAll('div.changesets div.details'))
    elem.innerHTML = elem.innerHTML.replace(/#(\d+)/g, `#<a title='View revision $1 on achavi.' href=https://nrenner.github.io/achavi/?changeset=$1>$1</a>`)
  
}).observe(document.querySelector('div.changesets'), { childList: true });

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址