@filteringdev/namulink 19.0.0-build.1 → 19.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/NamuLink.user.js +4 -5
- package/dist/index.js +16 -0
- package/package.json +1 -1
package/dist/NamuLink.user.js
CHANGED
|
@@ -8,22 +8,21 @@
|
|
|
8
8
|
// @downloadURL https://cdn.jsdelivr.net/npm/@filteringdev/namulink@latest/dist/NamuLink.user.js
|
|
9
9
|
// @license MPL-2.0
|
|
10
10
|
//
|
|
11
|
-
// @version 19.0.
|
|
11
|
+
// @version 19.0.1
|
|
12
12
|
// @author PiQuark6046 and contributors
|
|
13
13
|
//
|
|
14
14
|
// @grant unsafeWindow
|
|
15
15
|
// @run-at document-start
|
|
16
16
|
//
|
|
17
|
-
// @description NamuLink
|
|
18
|
-
// @description:ko NamuLink는
|
|
19
|
-
// @description:ja NamuLinkを使うと、AdGuard, uBlock Origin, Brave, およびABPがAd-Shieldに素早く対抗できます。
|
|
17
|
+
// @description NamuLink blocks the PowerLink advertisement on NamuWiki.
|
|
18
|
+
// @description:ko NamuLink는 나무위키에 있는 파워링크 광고를 차단합니다.
|
|
20
19
|
//
|
|
21
20
|
// @match *://namu.wiki/*
|
|
22
21
|
// @match *://*.namu.wiki/*
|
|
23
22
|
// ==/UserScript==
|
|
24
23
|
|
|
25
24
|
|
|
26
|
-
(()=>{var s=typeof unsafeWindow<"u"?unsafeWindow:window;function
|
|
25
|
+
(()=>{var s=typeof unsafeWindow<"u"?unsafeWindow:window;function m(n,r="NamuLink"){let u=n.Function.prototype.call,p=n.Reflect.apply,c=new CustomEvent("PL2PlaceHolder"),d=[[/function *\( *_0x[a-f0-9]+ *, *_0x[a-f0-9]+ *, *_0x[a-f0-9]+ *, *_0x[a-f0-9]+ *, *_0x[a-f0-9]+ *, *_0x[a-f0-9]+ *\) *{ *var *_0x[a-f0-9]+/,/('|")td('|") *, *{ *('|")class('|") *: *\( *-? *0x[a-f0-9]+ *\+ *-? *0x[a-f0-9]+ *\+ *0x[a-f0-9]+ *, *_0x[a-f0-9]+ *\[ *_0x[a-f0-9]+ */,/\( *_0x[a-f0-9]+ *\( *0x[a-f0-9]+ *\) *\) *, *('|")onClick('|") *: *_0x[a-f0-9]+ *\[ *-? *0x[a-f0-9]+ *\* *-? *0x[a-f0-9]+/,/_0x[a-f0-9]+ *\( *0x[a-f0-9]+ *\) *\) *, *('|")colspan('|") *: *_0x[a-f0-9]+ *\( *0x[a-f0-9]+ *\) *=== *_0x[a-f0-9]+ *\[ *_0x[a-f0-9]+ *\(/]],g=[[/new *Map *\( *Object *\[ *_0x[a-f0-9]+ *\( *0x[a-f0-9]+ *\) *\] *\( *{ *('|")pretendard('|") *: *{ *('|")fontFamily('|") *: */,/('|")fontFamily('|") *: *_0x[a-f0-9]+ *\( *0x[a-f0-9]+ *\) *, *('|")styleUrl('|") *: *_0x[a-f0-9]+ *\( *0x[a-f0-9]+ *\) *, *('|")isGoogleFonts/,/('|")popper--wide('|") *: *_0x[a-f0-9]+ *\( *0x[a-f0-9]+ *\) *, *('|")popper__title('|") *: *_0x[a-f0-9]+ *\( *0x[a-f0-9]+ *\) *} *} *,/]],o=!1;n.Function.prototype.call=new Proxy(u,{apply(t,e,l){if(o)return p(t,e,l);o=!0;let i=String(e);return i.length<5e4&&!g.some(a=>a.every(f=>f.test(i)))&&d.filter(a=>a.filter(f=>f.test(i)).length===a.length).length===1?(console.debug(`[${r}]: Function.prototype.call called for PowerLink Skeleton:`,e),n.document.dispatchEvent(c),o=!1,p(t,()=>{},[])):(o=!1,p(t,e,l))}}),n.document.addEventListener("PL2PlaceHolder",()=>{setTimeout(()=>{let t=new Set([...n.document.querySelectorAll('div[class] div[class*=" "] div[class*=" "] ~ div[class*=" "]')]);t=new Set([...t].filter(e=>e instanceof HTMLElement)),t=new Set([...t].filter(e=>Number(getComputedStyle(e).getPropertyValue("padding-top").replaceAll(/px$/g,""))>20)),t=new Set([...t,...[...t].flatMap(e=>[...e.querySelectorAll("*")])]),t=new Set([...t].filter(e=>e instanceof HTMLElement&&e.innerText.trim().length===0)),t=new Set([...t].filter(e=>Number(getComputedStyle(e).getPropertyValue("border-bottom-width").replaceAll(/px/g,""))>=1)),t=new Set([...t].filter(e=>Number(getComputedStyle(e).getPropertyValue("border-left-width").replaceAll(/px/g,""))>=1)),t=new Set([...t].filter(e=>Number(getComputedStyle(e).getPropertyValue("border-right-width").replaceAll(/px/g,""))>=1)),t=new Set([...t].filter(e=>Number(getComputedStyle(e).getPropertyValue("border-top-width").replaceAll(/px/g,""))>=1)),console.debug(`[${r}]: Removing PowerLink Skeleton Containers:`,t),t.forEach(e=>{e.setAttribute("style","display: none !important;")})},2500),setTimeout(()=>{let t=new Set([...n.document.querySelectorAll('div[class*=" "] div[class*=" "] ~ div[class*=" "]')]);t=new Set([...t].filter(e=>e instanceof HTMLElement)),t=new Set([...t].filter(e=>Number(getComputedStyle(e).getPropertyValue("margin-bottom").replaceAll(/px$/g,""))>15||Number(getComputedStyle(e).getPropertyValue("padding-top").replaceAll(/px$/g,""))>20)),t=new Set([...t].filter(e=>e instanceof HTMLElement&&e.innerText.trim().length===0)),t=new Set([...t].filter(e=>[...e.querySelectorAll("*")].some(l=>l instanceof HTMLElement&&Number(getComputedStyle(l).getPropertyValue("padding-top").replaceAll(/px/g,""))>=5&&Number(getComputedStyle(l).getPropertyValue("padding-bottom").replaceAll(/px/g,""))>=5&&Number(getComputedStyle(l).getPropertyValue("padding-left").replaceAll(/px/g,""))>=5&&Number(getComputedStyle(l).getPropertyValue("padding-right").replaceAll(/px/g,""))>=5))),console.debug(`[${r}]: Removing PowerLink Skeleton Containers:`,t),t.forEach(e=>{e.setAttribute("style","display: none !important;")})},2500)})}m(s);})();
|
|
27
26
|
/*!
|
|
28
27
|
* @license MPL-2.0
|
|
29
28
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
package/dist/index.js
CHANGED
|
@@ -60,6 +60,22 @@ export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink'
|
|
|
60
60
|
Container.setAttribute('style', 'display: none !important;');
|
|
61
61
|
});
|
|
62
62
|
}, 2500);
|
|
63
|
+
setTimeout(() => {
|
|
64
|
+
let ContainerElements = new Set([...BrowserWindow.document.querySelectorAll('div[class*=" "] div[class*=" "] ~ div[class*=" "]')]);
|
|
65
|
+
ContainerElements = new Set([...ContainerElements].filter(Container => Container instanceof HTMLElement));
|
|
66
|
+
ContainerElements = new Set([...ContainerElements].filter(Container => Number(getComputedStyle(Container).getPropertyValue('margin-bottom').replaceAll(/px$/g, '')) > 15 ||
|
|
67
|
+
Number(getComputedStyle(Container).getPropertyValue('padding-top').replaceAll(/px$/g, '')) > 20));
|
|
68
|
+
ContainerElements = new Set([...ContainerElements].filter(Container => Container instanceof HTMLElement && Container.innerText.trim().length === 0));
|
|
69
|
+
ContainerElements = new Set([...ContainerElements].filter(Container => [...Container.querySelectorAll('*')].some(Child => Child instanceof HTMLElement &&
|
|
70
|
+
(Number(getComputedStyle(Child).getPropertyValue('padding-top').replaceAll(/px/g, '')) >= 5 &&
|
|
71
|
+
Number(getComputedStyle(Child).getPropertyValue('padding-bottom').replaceAll(/px/g, '')) >= 5 &&
|
|
72
|
+
Number(getComputedStyle(Child).getPropertyValue('padding-left').replaceAll(/px/g, '')) >= 5 &&
|
|
73
|
+
Number(getComputedStyle(Child).getPropertyValue('padding-right').replaceAll(/px/g, '')) >= 5))));
|
|
74
|
+
console.debug(`[${UserscriptName}]: Removing PowerLink Skeleton Containers:`, ContainerElements);
|
|
75
|
+
ContainerElements.forEach(Container => {
|
|
76
|
+
Container.setAttribute('style', 'display: none !important;');
|
|
77
|
+
});
|
|
78
|
+
}, 2500);
|
|
63
79
|
});
|
|
64
80
|
}
|
|
65
81
|
RunNamuLinkUserscript(Win);
|