Link OSM changesets to achavi

4/4/2020 14:41:03

当前为 2020-04-05 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Link OSM changesets to achavi
  3. // @namespace Violentmonkey Scripts
  4. // @match https://www.openstreetmap.org/user/*/history
  5. // @grant none
  6. // @version 1.0
  7. // @author Swyter
  8. // @run-dat document-start
  9. // @description 4/4/2020 14:41:03
  10. // ==/UserScript==
  11.  
  12. // Create an observer instance linked to the callback function
  13. new MutationObserver(function(mutationsList, observer)
  14. {
  15. for(var mutation of mutationsList) {
  16. if (mutation.type == 'childList') {
  17. console.log('watch paragraph has changed or child has been added/removed', mutation);
  18. }
  19. }
  20. for (var elem of document.querySelectorAll('div.changesets div.details'))
  21. elem.innerHTML = elem.innerHTML.replace(/#(\d+)/g, `#<a title='View revision $1 on achavi.' href=https://nrenner.github.io/achavi/?changeset=$1>$1</a>`)
  22. }).observe(document.querySelector('div.changesets'), { childList: true });