您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
check panda.chaika.moe for related galleries when searching
当前为
// ==UserScript== // @name find panda // @namespace http://tampermonkey.net/ // @version 0.1 // @description check panda.chaika.moe for related galleries when searching // @description:zh 在搜索时检查panda.chaika.moe里是否有相关的画廊 // @author ayasetan // @license MIT // @icon https://www.google.com/s2/favicons?sz=64&domain=e-hentai.org // @run-at document-start // @match https://exhentai.org/* // @match https://e-hentai.org/* // @grant GM_xmlhttpRequest // @grant GM_getResourceText // @connect panda.chaika.moe // @resource iziToast.min.css https://cdn.jsdelivr.net/npm/[email protected]/dist/css/iziToast.min.css // @resource iziToast.min.js https://cdn.jsdelivr.net/npm/[email protected]/dist/js/iziToast.min.js // ==/UserScript== /* inject resource */ ((...names) => { if (typeof GM_getResourceText === void 0) { const text = "need grant GM_getResourceText permission"; alert(text); throw text; } for (const name of names) { const data = GM_getResourceText(name); if (!data.length) { console.warn(`resource ${name} have no content`); } if (name.endsWith(".js")) { const el = document.createElement("script"); el.textContent = data; document.body.appendChild(el); } else if (name.endsWith(".css")) { const el = document.createElement("style"); el.textContent = data; document.body.appendChild(el); } } })('iziToast.min.css', 'iziToast.min.js'); (function() { "use strict"; const request = (url, { json = null, form = null } = {}) => { return new Promise((resolve, reject) => { const r = GM_xmlhttpRequest != null ? GM_xmlhttpRequest : XMLHttpRequest; let method = "POST"; let ct, data; if (json) { ct = "application/json"; data = JSON.stringify(json); } else if (form) { ct = "application/x-www-form-urlencoded"; data = new FormData(); for (const [k, v] of Object.entries(form)) { data.append(k, v); } } else { method = "GET"; } r({ url, data, method, headers: { "Content-Type": ct }, onload: (resp) => { resolve(resp.responseText); }, onerror: (err) => { reject(err); } }); }); }; const main = async () => { const u = new URL(location.href); const kw = u.searchParams.get("f_search"); if (!kw) { return; } let content; try { content = await request(`https://panda.chaika.moe/archive-autocomplete/?q=${kw}`); } catch (error) { alert("can not connect to panda.chaika.moe. see more info from dev tool"); throw error; } if (content === noMatchesFound) { console.log("nothing found in panda"); return; } const openPanda = () => { window.open(`https://panda.chaika.moe/search/?title=${kw}`); }; iziToast.show({ message: "Find a panda", messageColor: "#ffffff", color: "#363940", timeout: 1e4, position: "topRight", onOpened: (_, el) => { el.addEventListener("click", openPanda); }, onClosed(_, el) { el.removeEventListener("click", openPanda); } }); }; const noMatchesFound = '<span class="block"><em>No matches found</em></span>'; main(); })();