您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Turns every changeset into a link that leads to this useful OSM change inspector.
当前为
// ==UserScript== // @name Link OpenStreetMap changesets to achavi / Open on achavi // @description Turns every changeset into a link that leads to this useful OSM change inspector. // @namespace gf.qytechs.cn/users/4813-swyter // @match https://www.openstreetmap.org/user/*/history // @match https://www.openstreetmap.org/changeset/* // @grant none // @version 2020.04.05 // @author Swyter // @run-at document-start // @icon https://upload.wikimedia.org/wikipedia/commons/b/b0/Openstreetmap_logo.svg // ==/UserScript== /* swy: create an observer instance (in the *history* page) 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 */ mo = 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); __relinkifier(); }); function __relinkifier() { console.log('[i] relinkifier()', document.querySelectorAll('div.changesets div.details, div#sidebar_content > h2')); for (var elem of document.querySelectorAll('div.changesets div.details, div#sidebar_content > h2')) elem.innerHTML = elem.innerHTML.replace(/(\d+)/g, `<a title='View revision $1 on achavi.' ach href=https://nrenner.github.io/achavi/?changeset=$1>$1</a>`); mo.observe(document.querySelector('div#sidebar_content') || document.createElement('dummy'), { childList: true }); mo.observe(document.querySelector('div.changesets') || document.createElement('dummy'), { childList: true }); mo.observe(document.querySelector('div#sidebar_loader') || document.createElement('dummy'), { childList: true }); } window.addEventListener('DOMContentLoaded', function() { /* swy: and do the same thing in the *changeset* page, where as a title; in this case the element is static, so we don't need to wait for JS to grab it and it in there */ mo.observe(document.querySelector('div#sidebar_content') || document.createElement('dummy'), { childList: true }); mo.observe(document.querySelector('div.changesets') || document.createElement('dummy'), { childList: true }); mo.observe(document.querySelector('div#sidebar_loader') || document.createElement('dummy'), { childList: true }); __relinkifier(); }); /* --- */ /* swy: the guys at Greasemonkey are a bunch of incompetent folks, they break stuff all the time */ function GM_addStyle(text) { document.documentElement.appendChild(((thing = document.createElement('style')).textContent = text) && thing); } GM_addStyle(` div#sidebar_content > h2 a[ach], div#sidebar_content > div.changesets .details a[ach] { color: #192d86 !important; } `);
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址