// ==UserScript== // @name Tong Li Online: Blurs R-rated Covers // @name:zh-TW 東立漫遊網:模糊限制級封面 // @description Blurs the covers of R-rated novels 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.0.0 // @license MIT // @match https://www.tongli.com.tw/ // @match https://www.tongli.com.tw/index.aspx // @match https://www.tongli.com.tw/webpagebooks.aspx // @match https://www.tongli.com.tw/WebPageBooks.aspx // @match https://www.tongli.com.tw/BooksList.aspx // @match https://www.tongli.com.tw/GbooksList.aspx // @match https://www.tongli.com.tw/ThemeBL.aspx // @match https://www.tongli.com.tw/ThemeBeautiful.aspx // @match https://www.tongli.com.tw/ThemeGL.aspx // @match https://www.tongli.com.tw/NovelDetail.aspx // @run-at document-end // @grant GM_addStyle // @require https://update.greasyfork.icu/scripts/482311/1296481/queue.js // @supportURL https://greasyfork.org/scripts/482312/feedback // @downloadURL none // ==/UserScript== GM_addStyle(` .b_package.nsfw img, .owl-item.nsfw > .item img { filter: blur(7.5px); transition: 0.3s; } .b_package.nsfw:hover img, .b_package.nsfw:active img, .owl-item.nsfw > .item:hover img, .owl-item.nsfw > .item:active img { filter: blur(0px); } `); const queue = new Queue({ autostart: true, concurrency: 20 }); const products = document.querySelectorAll(".b_package, .owl-item"); for (const product of products) { queue.push(async () => { const toBlur = await isNsfw(product.querySelector("a").href); if (toBlur) { product.classList.add("nsfw"); } }); } async function isNsfw(url) { try { const response = await fetch(url); 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) { console.error(e); } return false; }