Skip to content

Instantly share code, notes, and snippets.

@julenwang
Last active November 10, 2022 16:58
Show Gist options
  • Save julenwang/c8e5c0d0de2037f1400d4eabc361f72d to your computer and use it in GitHub Desktop.
Save julenwang/c8e5c0d0de2037f1400d4eabc361f72d to your computer and use it in GitHub Desktop.
// ==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