選択したGyazoのOCRテキストをコピーするUserScript
選択範囲に含めたGyazoのURLから、Gyazo OCRを取得してclip boardにコピーするUserScript
CSPの壊れたFirefoxでしか使えないので注意
FirefoxのCSPは破損している
TamperMonkeyを使うようにした
2023-05-01 09:00:50 GM_fetchを使う
Popup Menu ver.
code:popupMenu.js
scrapbox.PopupMenu.addButton({
title: (text) => /https:\/\/(?:thumb\.|i\.)?gyazo\.com\/a-z0-9+/.test(text)
? globalThis.GM_fetch
? "copy Gyazo OCR"
: "open Gyazo"
: "",
onClick: async (text) => {
const id = text.match(/https:\/\/(?:thumb\.|i\.)?gyazo\.com\/(a-z0-9+)/)?.1;
if (!id) return;
if (!globalThis.GM_fetch) {
window.open(https://gyazo.com/${id});
return;
}
const res = await GM_fetch(https://gyazo.com/${id}.json);
const ocr = (await res.json()).metadata?.ocr?.description;
if (!ocr) return;
try {
await navigator.clipboard.writeText(ocr);
} catch(e) {
console.error(e);
alert(${e.name} ${e.message});
}
},
});
#2023-05-01 09:00:45
#2023-02-24 05:18:20 tamperMonkeyがないときは、gyazoページを開くようにした
#2023-02-03 08:55:03
#2022-11-21 08:38:57
#2022-04-23 14:08:13