Link OSM changesets to achavi

4/4/2020 14:41:03

目前为 2020-04-05 提交的版本。查看 最新版本

// ==UserScript==
// @name        Link OSM changesets to achavi
// @namespace   Violentmonkey Scripts
// @match       https://www.openstreetmap.org/user/*/history
// @grant       none
// @version     1.0
// @author      Swyter
// @run-dat      document-start
// @description 4/4/2020 14:41:03
// ==/UserScript==

// Create an observer instance linked to the callback function
new MutationObserver(function(mutationsList, observer)
{
    for(var mutation of mutationsList) {
        if (mutation.type == 'childList') {
            console.log('watch paragraph has changed or child has been added/removed', 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 });