You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
1.9 KiB
26 lines
1.9 KiB
// ==UserScript==
|
|
// @name Miniflux - External links
|
|
// @description 「全ての外部リンクをコピー」ボタンを追加
|
|
// @match https://*/unread
|
|
// @match https://*/feed/*/entries*
|
|
// ==/UserScript==
|
|
|
|
const clip = '<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-clipboard" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><desc>Download more icon variants from https://tabler-icons.io/i/clipboard</desc><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2"></path><rect x="9" y="3" width="6" height="4" rx="2"></rect></svg>';
|
|
const check = '<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-clipboard-check" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><desc>Download more icon variants from https://tabler-icons.io/i/clipboard-check</desc><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2"></path><rect x="9" y="3" width="6" height="4" rx="2"></rect><path d="M9 14l2 2l4 -4"></path></svg>';
|
|
|
|
let a = document.createElement("a");
|
|
a.href = "#";
|
|
a.innerHTML = clip + "全ての外部リンクをコピー";
|
|
a.addEventListener("click", () => {
|
|
let links = Array.from(document.querySelectorAll(".item-meta-icons > li:nth-of-type(3) > a")).map(r => r.href);
|
|
navigator.clipboard.writeText(links.join("\n"));
|
|
li.removeChild(a);
|
|
let em = document.createElement("em");
|
|
li.appendChild(em);
|
|
em.innerHTML = check + "コピーしました";
|
|
});
|
|
|
|
let li = document.createElement("li");
|
|
li.appendChild(a);
|
|
document.querySelector("section.page-header ul").appendChild(li);
|