Last active
November 10, 2022 16:58
-
-
Save julenwang/c8e5c0d0de2037f1400d4eabc361f72d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name copyLilithAllUrls.js | |
// @version 0.1.0 | |
// @description 2022/05/05 | |
// @author Julen | |
// @match https://*.lilith001.workers.dev | |
// @grant none | |
// ==/UserScript== | |
(function () { | |
let nav = document.querySelector("#nav"); | |
if (nav) { | |
let btn = document.createElement("button"); | |
btn.type = "button"; | |
btn.textContent = "copy所有磁力链"; | |
nav.appendChild(btn); | |
btn.onclick = () => { | |
let result = Array.from(document.querySelectorAll("#list>li")) | |
.filter((node) => node.style.display !== "none") | |
.map( | |
(node) => | |
node.querySelector("i[data-clipboard-text]").dataset.clipboardText | |
) | |
.reduce((acc, cur) => { | |
return `${acc}${cur}\n`; | |
}, ""); | |
window.navigator.clipboard.writeText(result); | |
}; | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment