@filteringdev/namulink 19.3.0 → 19.3.1-build.5d014907c481
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 +2 -2
- package/dist/index.js +23 -20
- package/package.json +1 -1
package/dist/NamuLink.user.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
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.3.
|
|
11
|
+
// @version 19.3.1-build.5d014907c481
|
|
12
12
|
// @author PiQuark6046 and contributors
|
|
13
13
|
//
|
|
14
14
|
// @grant unsafeWindow
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
// ==/UserScript==
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
(()=>{var
|
|
25
|
+
(()=>{var E=typeof unsafeWindow<"u"?unsafeWindow:window;function x(i,c="NamuLink"){let w=i.Function.prototype.call,d=i.Reflect.apply,L=i.Object.defineProperty,g=[[/function *\( *[A-Za-z0-9]+ *, *[A-Za-z0-9]+ *, *[A-Za-z0-9]+ *, *[A-Za-z0-9]+ *, *[A-Za-z0-9]+ *, *[A-Za-z0-9]+ *\) *{ *return *[A-Za-z.-9]+/,/, *[A-Za-z0-9]+ *, *[A-Za-z0-9]+ *\) *{ *return *[A-Za-z.-9]+ *\( *[0-9a-fx *+-]+ *, *[A-Za-z.-9]+ *, *[A-Za-z.-9]+ *, *[0-9a-fx *+-]+/,/return *[A-Za-z.-9]+ *\( *[0-9a-fx *+-]+ *, *[A-Za-z.-9]+ *, *[A-Za-z.-9]+ *, *[0-9a-fx *+-]+ *,[A-Za-z.-9]+ *, *[A-Za-z.-9]+ * *\) *; *}/],[/function *[A-Za-z0-9]+ *\( *[A-Za-z0-9]+ *, *[A-Za-z0-9]+ *, *[A-Za-z0-9]+ *, *[A-Za-z0-9]+ *, *[A-Za-z0-9]+ *, *[A-Za-z0-9]+ *\) *{ *return *[A-Za-z.-9]+/,/, *[A-Za-z0-9]+ *, *[A-Za-z0-9]+ *\) *{ *return *[A-Za-z.-9]+ *\( *[0-9a-fx *+-]+ *, *[A-Za-z.-9]+ *, *[A-Za-z.-9]+ *, *[0-9a-fx *+-]+/,/return *[A-Za-z.-9]+ *\( *[0-9a-fx *+-]+ *, *[A-Za-z.-9]+ *, *[A-Za-z.-9]+ *, *[0-9a-fx *+-]+ *,[A-Za-z.-9]+ *, *[A-Za-z.-9]+ * *\) *; *}/]];function h(e){if(typeof e!="object"||e===null)return null;let t=new Set,n=e._;for(;typeof n=="object"&&n!==null&&!t.has(n);){t.add(n);let o=n.vnode;if(typeof o=="object"&&o!==null){let r=o.el;if(r instanceof HTMLElement)return r}n=n.parent}return null}function z(e){if(typeof e!="object"||e===null)return null;let t=new Set,n=e._;for(;typeof n=="object"&&n!==null&&!t.has(n);){t.add(n);let o=n.render;if(typeof o=="function")return o;n=n.parent}return null}function m(e){if(typeof e!="object"||e===null)return null;let t=new Set,n=e._;for(;typeof n=="object"&&n!==null&&!t.has(n);){t.add(n);let o=n.parent;if(typeof o=="object"&&o!==null){let a=o.vnode;if(typeof a=="object"&&a!==null){let u=a.el;if(u instanceof HTMLElement)return u}}let r=n.vnode;if(typeof r=="object"&&r!==null){let a=r.el;if(a instanceof HTMLElement)return a}n=o}return null}let y=.35,P=.75,s=.04;function l(e){return Number.parseFloat(e)||0}let S=null,p=!1;i.Function.prototype.call=new Proxy(w,{apply(e,t,n){if(p)return d(e,t,n);p=!0;let o=String(t);if(o.length<500&&g.filter(r=>r.filter(a=>a.test(o)).length===r.length).length===1){let r=m(n[6]);if(r!==null&&[...r.querySelectorAll("*")].filter(a=>{if(!(a instanceof HTMLElement))return!1;let u=a.getClientRects()[0]?.height??0,f=Math.max(l(getComputedStyle(a).getPropertyValue("padding-bottom")),l(getComputedStyle(a).getPropertyValue("margin-bottom")));return u>0&&f>=u*(y-s)&&f<=u*(P+s)}).length>=1)return console.debug(`[${c}]: Function.prototype.call called for PowerLink Skeleton:`,t),S=r,i.document.dispatchEvent(new CustomEvent("PL2PlaceHolder")),i.document.dispatchEvent(new CustomEvent("PL2PlaceHolderMobile")),p=!1,d(e,()=>{},[]);console.debug(`[${c}]: Matched Function.prototype.call called, but not for PowerLink Skeleton:`,t)}return p=!1,d(e,t,n)}}),i.Object.defineProperty=new Proxy(L,{apply(e,t,n){let o=z(n[0]),r=m(n[0]),a=String(o??"");if(o!==null&&r!==null&&a.length<500&&g.filter(u=>u.filter(f=>f.test(a)).length===u.length).length===1&&[...r.querySelectorAll("*")].filter(u=>{if(!(u instanceof HTMLElement))return!1;let f=u.getClientRects()[0]?.height??0,b=Math.max(l(getComputedStyle(u).getPropertyValue("padding-bottom")),l(getComputedStyle(u).getPropertyValue("margin-bottom")));return f>0&&b>=f*(y-s)&&b<=f*(P+s)}).length>=1){console.debug(`[${c}]: Restoring renderer.call for detected PowerLink skeleton:`,n[0]),o.call=Function.prototype.call;return}return d(e,t,n)}});let k=[[/\( *\) *=> *{ *var *_0x[0-9a-z]+ *= *a0_0x[0-9a-f]+ *; *this\[ *_0x[a-z0-9]+\( *0x[0-9a-f]+ *\) *\]\(\); *}/,/\( *\) *=> *{ *var *_0x[0-9a-z]+ *= *a0_0x[0-9a-f]+ *; *this\[ *_0x[a-z0-9]+\( *0x[0-9a-f]+ *\) *\]\(\); *}/],[/\( *\) *=> *{ *var _0x[a-z0-9]+ *= *_0x[a-z0-9]+ *; *if *\( *this\[ *_0x[a-z0-9]+ *\( *0x[0-9a-f]+ *\) *\] *\) *return *clearTimeout/,/\( *0x[0-9a-f]+ *\) *\] *\) *, *void *\( *this\[ *_0x[a-z0-9]+\( *0x[0-9a-f]+ *\) *\] *= *void *\([x0-9a-f*+-]+ *\) *\) *; *this\[_0x[a-z0-9]+\( *0x[0-9a-f]+ *\) *\] *\(\) *;/]];i.setTimeout=new Proxy(i.setTimeout,{apply(e,t,n){let o=String(n[0]);return k.filter(r=>r.filter(a=>a.test(o)).length>=1).length===1?(console.debug(`[${c}]: setTimeout called for PowerLink Skeleton:`,n[0]),d(e,t,[()=>{},0])):d(e,t,n)}}),i.document.addEventListener("PL2AdvertContainer",()=>{setTimeout(()=>{let e=new Set([S]);e=new Set([...e,...[...e].flatMap(t=>[...t.querySelectorAll("*")])]),e=new Set([...e].filter(t=>l(getComputedStyle(t).getPropertyValue("border-bottom-width"))>=.5)),e=new Set([...e].filter(t=>l(getComputedStyle(t).getPropertyValue("border-left-width"))>=.5)),e=new Set([...e].filter(t=>l(getComputedStyle(t).getPropertyValue("border-right-width"))>=.5)),e=new Set([...e].filter(t=>l(getComputedStyle(t).getPropertyValue("border-top-width"))>=.5)),e=new Set([...e].filter(t=>[...t.querySelectorAll("*")].some(n=>{if(!(n instanceof HTMLElement))return!1;let o=n.getClientRects()[0]?.height??0,r=l(getComputedStyle(n).getPropertyValue("margin-bottom"));return o===0?!1:r>=o*.65&&r<=o*1.25}))),console.debug(`[${c}]: Removing PowerLink Skeleton Containers (PL2AdvertContainer):`,e),e.forEach(t=>{t.setAttribute("style","display: none !important;")})},2500)}),i.document.addEventListener("PL2PlaceHolderMobile",()=>{setTimeout(()=>{let e=new Set([...i.document.querySelectorAll("div[class] div[class] div[class] ~ div[class]")]);e=new Set([...e].filter(t=>t instanceof HTMLElement)),e=new Set([...e].filter(t=>l(getComputedStyle(t).getPropertyValue("margin-bottom"))>15||l(getComputedStyle(t).getPropertyValue("padding-top"))>20)),e=new Set([...e].filter(t=>t instanceof HTMLElement&&t.innerText.trim().length===0)),e=new Set([...e].filter(t=>[...t.querySelectorAll("*")].some(n=>n instanceof HTMLElement&&l(getComputedStyle(n).getPropertyValue("padding-top"))>=5&&l(getComputedStyle(n).getPropertyValue("padding-bottom"))>=5&&l(getComputedStyle(n).getPropertyValue("padding-left"))>=5&&l(getComputedStyle(n).getPropertyValue("padding-right"))>=5))),console.debug(`[${c}]: Removing PowerLink Skeleton Containers (PL2PlaceHolderMobile):`,e),e.forEach(t=>{t.setAttribute("style","display: none !important;")})},2500),i.document.addEventListener("PL2PlaceHolder",()=>{setTimeout(()=>{let e=new Set([...i.document.querySelectorAll("div[class] div[class] div[class] ~ div[class]")]);e=new Set([...e].filter(t=>t instanceof HTMLElement)),e=new Set([...e].filter(t=>l(getComputedStyle(t).getPropertyValue("padding-top"))>10||l(getComputedStyle(t).getPropertyValue("margin-top"))>10)),e=new Set([...e,...[...e].flatMap(t=>[...t.querySelectorAll("*:not(button)")])]),e=new Set([...e].filter(t=>t instanceof HTMLElement&&t.innerText.trim().length===0)),e=new Set([...e].filter(t=>l(getComputedStyle(t).getPropertyValue("border-bottom-width"))>=.5)),e=new Set([...e].filter(t=>l(getComputedStyle(t).getPropertyValue("border-left-width"))>=.5)),e=new Set([...e].filter(t=>l(getComputedStyle(t).getPropertyValue("border-right-width"))>=.5)),e=new Set([...e].filter(t=>l(getComputedStyle(t).getPropertyValue("border-top-width"))>=.5)),e=new Set([...e].filter(t=>l(getComputedStyle(t).getPropertyValue("transition-duration"))>=.01)),console.debug(`[${c}]: Removing PowerLink Skeleton Containers (PL2PlaceHolder):`,e),e.forEach(t=>{t.setAttribute("style","display: none !important;")})},2500)})})}x(E);})();
|
|
26
26
|
/*!
|
|
27
27
|
* @license MPL-2.0
|
|
28
28
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
package/dist/index.js
CHANGED
|
@@ -88,6 +88,9 @@ export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink'
|
|
|
88
88
|
const MinRatio = 0.35;
|
|
89
89
|
const MaxRatio = 0.75;
|
|
90
90
|
const EpsilonRatio = 0.04;
|
|
91
|
+
function ParseCssFloat(Value) {
|
|
92
|
+
return Number.parseFloat(Value) || 0;
|
|
93
|
+
}
|
|
91
94
|
let CommentContainer = null;
|
|
92
95
|
let InHook = false;
|
|
93
96
|
BrowserWindow.Function.prototype.call = new Proxy(OriginalFunctionPrototypeCall, {
|
|
@@ -104,7 +107,7 @@ export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink'
|
|
|
104
107
|
if (!(Child instanceof HTMLElement))
|
|
105
108
|
return false;
|
|
106
109
|
let PL2TitleHeight = Child.getClientRects()[0]?.height ?? 0;
|
|
107
|
-
let PL2TitleMarginBottom = Math.max(
|
|
110
|
+
let PL2TitleMarginBottom = Math.max(ParseCssFloat(getComputedStyle(Child).getPropertyValue('padding-bottom')), ParseCssFloat(getComputedStyle(Child).getPropertyValue('margin-bottom')));
|
|
108
111
|
return PL2TitleHeight > 0 && PL2TitleMarginBottom >= PL2TitleHeight * (MinRatio - EpsilonRatio) && PL2TitleMarginBottom <= PL2TitleHeight * (MaxRatio + EpsilonRatio);
|
|
109
112
|
}).length >= 1) {
|
|
110
113
|
console.debug(`[${UserscriptName}]: Function.prototype.call called for PowerLink Skeleton:`, ThisArg);
|
|
@@ -132,7 +135,7 @@ export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink'
|
|
|
132
135
|
if (!(Child instanceof HTMLElement))
|
|
133
136
|
return false;
|
|
134
137
|
let PL2TitleHeight = Child.getClientRects()[0]?.height ?? 0;
|
|
135
|
-
let PL2TitleMarginBottom = Math.max(
|
|
138
|
+
let PL2TitleMarginBottom = Math.max(ParseCssFloat(getComputedStyle(Child).getPropertyValue('padding-bottom')), ParseCssFloat(getComputedStyle(Child).getPropertyValue('margin-bottom')));
|
|
136
139
|
return PL2TitleHeight > 0 && PL2TitleMarginBottom >= PL2TitleHeight * (MinRatio - EpsilonRatio) && PL2TitleMarginBottom <= PL2TitleHeight * (MaxRatio + EpsilonRatio);
|
|
137
140
|
}).length >= 1) {
|
|
138
141
|
console.debug(`[${UserscriptName}]: Restoring renderer.call for detected PowerLink skeleton:`, Args[0]);
|
|
@@ -163,15 +166,15 @@ export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink'
|
|
|
163
166
|
setTimeout(() => {
|
|
164
167
|
let ContainerElements = new Set([CommentContainer]);
|
|
165
168
|
ContainerElements = new Set([...ContainerElements, ...[...ContainerElements].flatMap(Container => [...Container.querySelectorAll('*')])]);
|
|
166
|
-
ContainerElements = new Set([...ContainerElements].filter(Container =>
|
|
167
|
-
ContainerElements = new Set([...ContainerElements].filter(Container =>
|
|
168
|
-
ContainerElements = new Set([...ContainerElements].filter(Container =>
|
|
169
|
-
ContainerElements = new Set([...ContainerElements].filter(Container =>
|
|
169
|
+
ContainerElements = new Set([...ContainerElements].filter(Container => ParseCssFloat(getComputedStyle(Container).getPropertyValue('border-bottom-width')) >= 0.5));
|
|
170
|
+
ContainerElements = new Set([...ContainerElements].filter(Container => ParseCssFloat(getComputedStyle(Container).getPropertyValue('border-left-width')) >= 0.5));
|
|
171
|
+
ContainerElements = new Set([...ContainerElements].filter(Container => ParseCssFloat(getComputedStyle(Container).getPropertyValue('border-right-width')) >= 0.5));
|
|
172
|
+
ContainerElements = new Set([...ContainerElements].filter(Container => ParseCssFloat(getComputedStyle(Container).getPropertyValue('border-top-width')) >= 0.5));
|
|
170
173
|
ContainerElements = new Set([...ContainerElements].filter(Container => [...Container.querySelectorAll('*')].some(Child => {
|
|
171
174
|
if (!(Child instanceof HTMLElement))
|
|
172
175
|
return false;
|
|
173
176
|
let PL2TitleHeight = Child.getClientRects()[0]?.height ?? 0;
|
|
174
|
-
let PL2TitleMarginBottom =
|
|
177
|
+
let PL2TitleMarginBottom = ParseCssFloat(getComputedStyle(Child).getPropertyValue('margin-bottom'));
|
|
175
178
|
if (PL2TitleHeight === 0)
|
|
176
179
|
return false;
|
|
177
180
|
return PL2TitleMarginBottom >= PL2TitleHeight * 0.65 && PL2TitleMarginBottom <= PL2TitleHeight * 1.25;
|
|
@@ -186,14 +189,14 @@ export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink'
|
|
|
186
189
|
setTimeout(() => {
|
|
187
190
|
let ContainerElements = new Set([...BrowserWindow.document.querySelectorAll('div[class] div[class] div[class] ~ div[class]')]);
|
|
188
191
|
ContainerElements = new Set([...ContainerElements].filter(Container => Container instanceof HTMLElement));
|
|
189
|
-
ContainerElements = new Set([...ContainerElements].filter(Container =>
|
|
190
|
-
|
|
192
|
+
ContainerElements = new Set([...ContainerElements].filter(Container => ParseCssFloat(getComputedStyle(Container).getPropertyValue('margin-bottom')) > 15 ||
|
|
193
|
+
ParseCssFloat(getComputedStyle(Container).getPropertyValue('padding-top')) > 20));
|
|
191
194
|
ContainerElements = new Set([...ContainerElements].filter(Container => Container instanceof HTMLElement && Container.innerText.trim().length === 0));
|
|
192
195
|
ContainerElements = new Set([...ContainerElements].filter(Container => [...Container.querySelectorAll('*')].some(Child => Child instanceof HTMLElement &&
|
|
193
|
-
(
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
196
|
+
(ParseCssFloat(getComputedStyle(Child).getPropertyValue('padding-top')) >= 5 &&
|
|
197
|
+
ParseCssFloat(getComputedStyle(Child).getPropertyValue('padding-bottom')) >= 5 &&
|
|
198
|
+
ParseCssFloat(getComputedStyle(Child).getPropertyValue('padding-left')) >= 5 &&
|
|
199
|
+
ParseCssFloat(getComputedStyle(Child).getPropertyValue('padding-right')) >= 5))));
|
|
197
200
|
console.debug(`[${UserscriptName}]: Removing PowerLink Skeleton Containers (PL2PlaceHolderMobile):`, ContainerElements);
|
|
198
201
|
ContainerElements.forEach(Container => {
|
|
199
202
|
Container.setAttribute('style', 'display: none !important;');
|
|
@@ -204,16 +207,16 @@ export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink'
|
|
|
204
207
|
let ContainerElements = new Set([...BrowserWindow.document.querySelectorAll('div[class] div[class] div[class] ~ div[class]')]);
|
|
205
208
|
ContainerElements = new Set([...ContainerElements].filter(Container => Container instanceof HTMLElement));
|
|
206
209
|
ContainerElements = new Set([...ContainerElements].filter(Container => {
|
|
207
|
-
return
|
|
208
|
-
|
|
210
|
+
return ParseCssFloat(getComputedStyle(Container).getPropertyValue('padding-top')) > 10 ||
|
|
211
|
+
ParseCssFloat(getComputedStyle(Container).getPropertyValue('margin-top')) > 10;
|
|
209
212
|
}));
|
|
210
213
|
ContainerElements = new Set([...ContainerElements, ...[...ContainerElements].flatMap(Container => [...Container.querySelectorAll('*:not(button)')])]);
|
|
211
214
|
ContainerElements = new Set([...ContainerElements].filter(Container => Container instanceof HTMLElement && Container.innerText.trim().length === 0));
|
|
212
|
-
ContainerElements = new Set([...ContainerElements].filter(Container =>
|
|
213
|
-
ContainerElements = new Set([...ContainerElements].filter(Container =>
|
|
214
|
-
ContainerElements = new Set([...ContainerElements].filter(Container =>
|
|
215
|
-
ContainerElements = new Set([...ContainerElements].filter(Container =>
|
|
216
|
-
ContainerElements = new Set([...ContainerElements].filter(Container =>
|
|
215
|
+
ContainerElements = new Set([...ContainerElements].filter(Container => ParseCssFloat(getComputedStyle(Container).getPropertyValue('border-bottom-width')) >= 0.5));
|
|
216
|
+
ContainerElements = new Set([...ContainerElements].filter(Container => ParseCssFloat(getComputedStyle(Container).getPropertyValue('border-left-width')) >= 0.5));
|
|
217
|
+
ContainerElements = new Set([...ContainerElements].filter(Container => ParseCssFloat(getComputedStyle(Container).getPropertyValue('border-right-width')) >= 0.5));
|
|
218
|
+
ContainerElements = new Set([...ContainerElements].filter(Container => ParseCssFloat(getComputedStyle(Container).getPropertyValue('border-top-width')) >= 0.5));
|
|
219
|
+
ContainerElements = new Set([...ContainerElements].filter(Container => ParseCssFloat(getComputedStyle(Container).getPropertyValue('transition-duration')) >= 0.01));
|
|
217
220
|
console.debug(`[${UserscriptName}]: Removing PowerLink Skeleton Containers (PL2PlaceHolder):`, ContainerElements);
|
|
218
221
|
ContainerElements.forEach(Container => {
|
|
219
222
|
Container.setAttribute('style', 'display: none !important;');
|