Blurs the covers of R-rated books on Tong Li Online.
当前为
// ==UserScript==
// @name Tong Li Online: Blurs R-rated Covers
// @name:zh-TW 東立漫遊網:模糊限制級封面
// @description Blurs the covers of R-rated books on Tong Li Online.
// @description:zh-TW 模糊東立漫遊網限制級書本的封面。
// @icon https://icons.duckduckgo.com/ip3/www.tongli.com.tw.ico
// @author Jason Kwok
// @namespace https://jasonhk.dev/
// @version 1.3.3
// @license MIT
// @match https://www.tongli.com.tw/
// @match https://www.tongli.com.tw/index.aspx
// @match https://www.tongli.com.tw/BooksLst_Srh.aspx
// @match https://www.tongli.com.tw/GbooksList.aspx
// @match https://www.tongli.com.tw/GbooksList.aspx?*
// @match https://www.tongli.com.tw/search3.aspx
// @match https://www.tongli.com.tw/Search3.aspx
// @match https://www.tongli.com.tw/BooksList.aspx
// @match https://www.tongli.com.tw/BooksList.aspx?*
// @match https://www.tongli.com.tw/webpagebooks.aspx
// @match https://www.tongli.com.tw/webpagebooks.aspx?*
// @match https://www.tongli.com.tw/WebPageBooks.aspx
// @match https://www.tongli.com.tw/WebPageBooks.aspx?*
// @match https://www.tongli.com.tw/ThemeBL.aspx
// @match https://www.tongli.com.tw/ThemeBLBooks.aspx
// @match https://www.tongli.com.tw/ThemeBLBooks.aspx?*
// @match https://www.tongli.com.tw/ThemeBeautiful.aspx
// @match https://www.tongli.com.tw/ThemeBeautiful.aspx?*
// @match https://www.tongli.com.tw/ThemeGL.aspx
// @match https://www.tongli.com.tw/ThemeGL.aspx?*
// @match https://www.tongli.com.tw/NovelIndex/
// @match https://www.tongli.com.tw/NovelDetail.aspx
// @match https://www.tongli.com.tw/NovelDetail.aspx?*
// @match https://www.tongli.com.tw/BooksDetail.aspx
// @match https://www.tongli.com.tw/BooksDetail.aspx?*
// @run-at document-end
// @inject-into page
// @grant none
// @require https://update.gf.qytechs.cn/scripts/483122/1304475/style-shims.js
// @require https://update.gf.qytechs.cn/scripts/482311/1297431/queue.js
// @supportURL https://gf.qytechs.cn/scripts/482312/feedback
// ==/UserScript==
GM.addStyle(`
.b_package.nsfw img, .owl-item.nsfw > .item img, .comicBox li.nsfw img, .sdBook :is(.hot, .tabbook).nsfw input
{
filter: blur(7.5px);
transition: 0.3s;
}
.b_package.nsfw:hover img, .b_package.nsfw:focus-within img,
.owl-item.nsfw > .item:hover img, .owl-item.nsfw > .item:focus-within img,
.comicBox li.nsfw:hover img, .comicBox li.nsfw:focus-within img,
.sdBook :is(.hot, .tabbook).nsfw:hover input, .sdBook :is(.hot, .tabbook).nsfw:focus-within input
{
filter: blur(0px);
}
`);
async function isNsfw(url, { signal } = {})
{
try
{
const response = await fetch(url, { signal, credentials: "omit" });
if (response.status === 200)
{
const html = await response.text();
const parser = new DOMParser();
const page = parser.parseFromString(html, "text/html");
if (page.getElementById("ContentPlaceHolder1_GradeTxt")?.innerText === "限制級") { return true; }
}
}
catch (e)
{
if (typeof e === "string")
{
console.debug(e);
}
else if ((e instanceof DOMException) && (e.name === "AbortError"))
{
console.debug(signal.reason);
}
else
{
console.error(e);
}
}
return false;
}
const queue = new Queue({ autostart: true, concurrency: 20 });
const pathname = location.pathname.toLowerCase();
if ((pathname === "/bookslst_srh.aspx") || (pathname === "/gbookslist.aspx"))
{
const serieses = document.querySelectorAll(".b_package");
for (const series of serieses)
{
queue.push(async () =>
{
try
{
const response = await fetch(series.querySelector("a").href, { credentials: "omit" });
if (response.status === 200)
{
const html = await response.text();
const parser = new DOMParser();
const page = parser.parseFromString(html, "text/html");
const controller = new AbortController();
const signal = controller.signal;
const products = page.querySelectorAll(".b_package");
for (const product of products)
{
queue.push(async () =>
{
if (await isNsfw(product.querySelector("a").href, { signal }))
{
controller.abort(`Skipping other checks for the series “${series.querySelector(".pk_txt > em").innerText}” since a R-rated book in it was found.`);
series.classList.add("nsfw");
}
});
}
}
}
catch (e)
{
console.error(e);
}
});
}
}
else
{
const products = document.querySelectorAll(".b_package, .owl-item, .comicBox li");
for (const product of products)
{
queue.push(async () =>
{
if (await isNsfw(product.querySelector("a").href))
{
product.classList.add("nsfw");
}
});
}
if (pathname === "/search3.aspx")
{
const sandbox = document.createElement("iframe");
sandbox.style = "display: none;"
document.body.appendChild(sandbox);
sandbox.contentWindow.WebForm_PostBackOptions = window.WebForm_PostBackOptions;
sandbox.contentWindow.WebForm_DoPostBackWithOptions = (options) => (new URL(options.actionUrl, location).href);
const products = document.querySelectorAll(".sdBook :is(.hot, .tabbook)");
for (const product of products)
{
const url = sandbox.contentWindow.eval(product.querySelector("input").getAttribute("onclick"));
queue.push(async () =>
{
if (await isNsfw(url))
{
product.classList.add("nsfw");
}
});
}
sandbox.remove();
}
}
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址