From c7fb3585c40817c510fb363578e5dca6f9a21539 Mon Sep 17 00:00:00 2001 From: piquark6046 Date: Thu, 12 Dec 2024 04:04:08 +0000 Subject: [PATCH] breakage: entire elements are invisible if an user is banned https://gall.dcinside.com/mgallery/board/view/?id=adguard&no=385&page=1 --- package.json | 2 +- sources/banner.txt | 2 +- sources/src/index.ts | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index abb455c..e52dbf7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@list-kr/namulink", - "version": "4.1.0", + "version": "4.1.1", "description": "", "type": "module", "scripts": { diff --git a/sources/banner.txt b/sources/banner.txt index 73f6cc2..5e0f230 100644 --- a/sources/banner.txt +++ b/sources/banner.txt @@ -8,7 +8,7 @@ // @downloadURL https://cdn.jsdelivr.net/npm/@list-kr/namulink@latest/dist/NamuLink.user.js // @license MIT // -// @version 4.1.0 +// @version 4.1.1 // @author PiQuark6046 and contributors // // @match https://namu.wiki/* diff --git a/sources/src/index.ts b/sources/src/index.ts index 7c38d10..51aac25 100644 --- a/sources/src/index.ts +++ b/sources/src/index.ts @@ -56,6 +56,9 @@ const RemovePowerLinkAdWorker = (SearchedElements: HTMLElement[]): HTMLElement[] || /목차/.test(getComputedStyle(HTMLInElement, '::before').getPropertyValue('content'))) ) }) + TargetedElements = TargetedElements.filter(SearchedElement => { + return !SearchedElement.textContent.includes('https://board.namu.wiki/b/') + }) return TargetedElements } @@ -64,6 +67,7 @@ const RemovePowerLinkAd = async () => { ElementsInArticle.push(...Array.from(Win.document.querySelectorAll('div[class] div[class*=" "]:has(span ~ ul li) ~ div div[class] > div[class] div[class] ~ *[class]'))) ElementsInArticle.push(...Array.from(Win.document.querySelectorAll('div:not([class*=" "]) div[class] *[class*=" "]:not(:has(svg[viewBox="0 0 20 20"]))'))) ElementsInArticle.push(...Array.from(Win.document.querySelectorAll('div[class*=" "] > div[class*=" "]:has(span ~ ul li) ~ div[class*=" "] > div[class]'))) + ElementsInArticle.push(...Array.from(Win.document.querySelectorAll('div[onmouseover][onmouseout] ~ div[class*=" "] > div[style]'))) let TargetedElements: HTMLElement[] = [] const PLimitInstance = PLimit((navigator.hardwareConcurrency ?? 4) < 4 ? 4 : navigator.hardwareConcurrency) const PLimitJobs: Promise[] = []