2022/6/6 19:57:03
当前为
// ==UserScript==
// @name Ferium add command for modrinth
// @namespace Violentmonkey Scripts
// @match https://modrinth.com/mods
// @license MIT
// @grant none
// @version 0.1.0
// @author -
// @description 2022/6/6 19:57:03
// ==/UserScript==
const observer = new MutationObserver((mutations, observer) => {
for(const mutation of mutations) {
if (mutation.type === 'childList' && mutation.target.id === 'search-results') {
for(const node of mutation.addedNodes) {
if(node.className === 'project-card card') {
const buttons = node.querySelector('.right-side .buttons')
const title = node.querySelector('.title a').href.match(/.*\/(.*)/)[1]
buttons.innerHTML += `<button class="iconified-button" onclick='navigator.clipboard.writeText("ferium add ${title}");this.innerText="Copied!"' title="ferium add ${title}">Ferium</button>`
}
}
}
}
});
observer.observe(document.body, { attributes: false, childList: true, subtree: true });