@filteringdev/namulink 19.2.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.
@@ -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.2.0
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 x=typeof unsafeWindow<"u"?unsafeWindow:window;function A(o,i="NamuLink"){let f=o.Function.prototype.call,u=o.Reflect.apply,s=[[/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 y(e){if(typeof e!="object"||e===null)return null;let t=new Set,l=e._;for(;typeof l=="object"&&l!==null&&!t.has(l);){t.add(l);let r=l.vnode;if(typeof r=="object"&&r!==null){let n=r.el;if(n instanceof HTMLElement)return n}l=l.parent}return null}let S=.35,b=.75,d=.04,m=null,p=!1;o.Function.prototype.call=new Proxy(f,{apply(e,t,l){if(p)return u(e,t,l);p=!0;let r=String(t);if(r.length<500&&s.filter(n=>n.filter(a=>a.test(r)).length===n.length).length===1){let n=y(l[6]);if(n!==null&&[...n.querySelectorAll("*")].filter(a=>{if(!(a instanceof HTMLElement))return!1;let c=a.getClientRects()[0]?.height??0,g=Math.max(Number(getComputedStyle(a).getPropertyValue("padding-bottom").replaceAll(/px/g,"")),Number(getComputedStyle(a).getPropertyValue("margin-bottom").replaceAll(/px/g,"")));return c>0&&g>=c*(S-d)&&g<=c*(b+d)}).length>=1)return console.debug(`[${i}]: Function.prototype.call called for PowerLink Skeleton:`,t),m=n,o.document.dispatchEvent(new CustomEvent("PL2PlaceHolder")),o.document.dispatchEvent(new CustomEvent("PL2PlaceHolderMobile")),p=!1,u(e,()=>{},[]);console.debug(`[${i}]: Matched Function.prototype.call called, but not for PowerLink Skeleton:`,t)}return p=!1,u(e,t,l)}});let P=[[/\( *\) *=> *{ *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]+ *\) *\] *\(\) *;/]];o.setTimeout=new Proxy(o.setTimeout,{apply(e,t,l){let r=String(l[0]);return P.filter(n=>n.filter(a=>a.test(r)).length>=1).length===1?(console.debug(`[${i}]: setTimeout called for PowerLink Skeleton:`,l[0]),u(e,t,[()=>{},0])):u(e,t,l)}}),o.document.addEventListener("PL2AdvertContainer",()=>{setTimeout(()=>{let e=new Set([m]);e=new Set([...e,...[...e].flatMap(t=>[...t.querySelectorAll("*")])]),e=new Set([...e].filter(t=>Number(getComputedStyle(t).getPropertyValue("border-bottom-width").replaceAll(/px/g,""))>=.5)),e=new Set([...e].filter(t=>Number(getComputedStyle(t).getPropertyValue("border-left-width").replaceAll(/px/g,""))>=.5)),e=new Set([...e].filter(t=>Number(getComputedStyle(t).getPropertyValue("border-right-width").replaceAll(/px/g,""))>=.5)),e=new Set([...e].filter(t=>Number(getComputedStyle(t).getPropertyValue("border-top-width").replaceAll(/px/g,""))>=.5)),e=new Set([...e].filter(t=>[...t.querySelectorAll("*")].some(l=>{if(!(l instanceof HTMLElement))return!1;let r=l.getClientRects()[0]?.height??0,n=Number(getComputedStyle(l).getPropertyValue("margin-bottom").replaceAll(/px/g,""));return r===0?!1:n>=r*.65&&n<=r*1.25}))),console.debug(`[${i}]: Removing PowerLink Skeleton Containers (PL2AdvertContainer):`,e),e.forEach(t=>{t.setAttribute("style","display: none !important;")})},2500)}),o.document.addEventListener("PL2PlaceHolderMobile",()=>{setTimeout(()=>{let e=new Set([...o.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=>Number(getComputedStyle(t).getPropertyValue("margin-bottom").replaceAll(/px$/g,""))>15||Number(getComputedStyle(t).getPropertyValue("padding-top").replaceAll(/px$/g,""))>20)),e=new Set([...e].filter(t=>t instanceof HTMLElement&&t.innerText.trim().length===0)),e=new Set([...e].filter(t=>[...t.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(`[${i}]: Removing PowerLink Skeleton Containers (PL2PlaceHolderMobile):`,e),e.forEach(t=>{t.setAttribute("style","display: none !important;")})},2500),o.document.addEventListener("PL2PlaceHolder",()=>{setTimeout(()=>{let e=new Set([...o.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=>Number(getComputedStyle(t).getPropertyValue("padding-top").replaceAll(/px$/g,""))>10||Number(getComputedStyle(t).getPropertyValue("margin-top").replaceAll(/px$/g,""))>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=>Number(getComputedStyle(t).getPropertyValue("border-bottom-width").replaceAll(/px/g,""))>=.5)),e=new Set([...e].filter(t=>Number(getComputedStyle(t).getPropertyValue("border-left-width").replaceAll(/px/g,""))>=.5)),e=new Set([...e].filter(t=>Number(getComputedStyle(t).getPropertyValue("border-right-width").replaceAll(/px/g,""))>=.5)),e=new Set([...e].filter(t=>Number(getComputedStyle(t).getPropertyValue("border-top-width").replaceAll(/px/g,""))>=.5)),e=new Set([...e].filter(t=>Number(getComputedStyle(t).getPropertyValue("transition-duration").replaceAll(/s$/g,""))>=.01)),console.debug(`[${i}]: Removing PowerLink Skeleton Containers (PL2PlaceHolder):`,e),e.forEach(t=>{t.setAttribute("style","display: none !important;")})},2500)})})}A(x);})();
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
@@ -11,12 +11,17 @@ const Win = typeof unsafeWindow !== 'undefined' ? unsafeWindow : window;
11
11
  export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink') {
12
12
  const OriginalFunctionPrototypeCall = BrowserWindow.Function.prototype.call;
13
13
  const OriginalReflectApply = BrowserWindow.Reflect.apply;
14
+ const OriginalObjectDefineProperty = BrowserWindow.Object.defineProperty;
14
15
  const PL2MajorFuncCallPatterns = [[
15
16
  /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]+/,
16
17
  /, *[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 *+-]+/,
17
18
  /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]+ * *\) *; *}/
19
+ ], [
20
+ /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]+/,
21
+ /, *[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 *+-]+/,
22
+ /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]+ * *\) *; *}/
18
23
  ]];
19
- function GetPowerLinkElementFromArg(Arg) {
24
+ function PowerLinkElementFromArg(Arg) {
20
25
  if (typeof Arg !== 'object' || Arg === null)
21
26
  return null;
22
27
  const Visited = new Set();
@@ -35,9 +40,57 @@ export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink'
35
40
  }
36
41
  return null;
37
42
  }
43
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
44
+ function PowerLinkRenderFromArg(Arg) {
45
+ if (typeof Arg !== 'object' || Arg === null)
46
+ return null;
47
+ const Visited = new Set();
48
+ let Current = Arg['_'];
49
+ while (typeof Current === 'object' && Current !== null) {
50
+ if (Visited.has(Current))
51
+ break;
52
+ Visited.add(Current);
53
+ const Render = Current['render'];
54
+ if (typeof Render === 'function')
55
+ return Render;
56
+ Current = Current['parent'];
57
+ }
58
+ return null;
59
+ }
60
+ function PowerLinkElementFromArgParent(Arg) {
61
+ if (typeof Arg !== 'object' || Arg === null)
62
+ return null;
63
+ const Visited = new Set();
64
+ let Current = Arg['_'];
65
+ while (typeof Current === 'object' && Current !== null) {
66
+ if (Visited.has(Current))
67
+ break;
68
+ Visited.add(Current);
69
+ const Parent = Current['parent'];
70
+ if (typeof Parent === 'object' && Parent !== null) {
71
+ const ParentVNode = Parent['vnode'];
72
+ if (typeof ParentVNode === 'object' && ParentVNode !== null) {
73
+ const ParentElement = ParentVNode['el'];
74
+ if (ParentElement instanceof HTMLElement)
75
+ return ParentElement;
76
+ }
77
+ }
78
+ const VNode = Current['vnode'];
79
+ if (typeof VNode === 'object' && VNode !== null) {
80
+ const Element = VNode['el'];
81
+ if (Element instanceof HTMLElement)
82
+ return Element;
83
+ }
84
+ Current = Parent;
85
+ }
86
+ return null;
87
+ }
38
88
  const MinRatio = 0.35;
39
89
  const MaxRatio = 0.75;
40
90
  const EpsilonRatio = 0.04;
91
+ function ParseCssFloat(Value) {
92
+ return Number.parseFloat(Value) || 0;
93
+ }
41
94
  let CommentContainer = null;
42
95
  let InHook = false;
43
96
  BrowserWindow.Function.prototype.call = new Proxy(OriginalFunctionPrototypeCall, {
@@ -49,12 +102,12 @@ export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink'
49
102
  InHook = true;
50
103
  const Stringified = String(ThisArg);
51
104
  if (Stringified.length < 500 && PL2MajorFuncCallPatterns.filter(Patterns => Patterns.filter(Pattern => Pattern.test(Stringified)).length === Patterns.length).length === 1) {
52
- let PL2Element = GetPowerLinkElementFromArg(Args[6]);
105
+ let PL2Element = PowerLinkElementFromArgParent(Args[6]);
53
106
  if (PL2Element !== null && [...PL2Element.querySelectorAll('*')].filter(Child => {
54
107
  if (!(Child instanceof HTMLElement))
55
108
  return false;
56
109
  let PL2TitleHeight = Child.getClientRects()[0]?.height ?? 0;
57
- let PL2TitleMarginBottom = Math.max(Number(getComputedStyle(Child).getPropertyValue('padding-bottom').replaceAll(/px/g, '')), Number(getComputedStyle(Child).getPropertyValue('margin-bottom').replaceAll(/px/g, '')));
110
+ let PL2TitleMarginBottom = Math.max(ParseCssFloat(getComputedStyle(Child).getPropertyValue('padding-bottom')), ParseCssFloat(getComputedStyle(Child).getPropertyValue('margin-bottom')));
58
111
  return PL2TitleHeight > 0 && PL2TitleMarginBottom >= PL2TitleHeight * (MinRatio - EpsilonRatio) && PL2TitleMarginBottom <= PL2TitleHeight * (MaxRatio + EpsilonRatio);
59
112
  }).length >= 1) {
60
113
  console.debug(`[${UserscriptName}]: Function.prototype.call called for PowerLink Skeleton:`, ThisArg);
@@ -70,6 +123,28 @@ export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink'
70
123
  return OriginalReflectApply(Target, ThisArg, Args);
71
124
  }
72
125
  });
126
+ BrowserWindow.Object.defineProperty = new Proxy(OriginalObjectDefineProperty, {
127
+ apply(Target, ThisArg, Args) {
128
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
129
+ let VuejsRenderer = PowerLinkRenderFromArg(Args[0]);
130
+ let PL2Element = PowerLinkElementFromArgParent(Args[0]);
131
+ let Stringified = String(VuejsRenderer ?? '');
132
+ if (VuejsRenderer !== null && PL2Element !== null && Stringified.length < 500 &&
133
+ PL2MajorFuncCallPatterns.filter(Patterns => Patterns.filter(Pattern => Pattern.test(Stringified)).length === Patterns.length).length === 1 &&
134
+ [...PL2Element.querySelectorAll('*')].filter(Child => {
135
+ if (!(Child instanceof HTMLElement))
136
+ return false;
137
+ let PL2TitleHeight = Child.getClientRects()[0]?.height ?? 0;
138
+ let PL2TitleMarginBottom = Math.max(ParseCssFloat(getComputedStyle(Child).getPropertyValue('padding-bottom')), ParseCssFloat(getComputedStyle(Child).getPropertyValue('margin-bottom')));
139
+ return PL2TitleHeight > 0 && PL2TitleMarginBottom >= PL2TitleHeight * (MinRatio - EpsilonRatio) && PL2TitleMarginBottom <= PL2TitleHeight * (MaxRatio + EpsilonRatio);
140
+ }).length >= 1) {
141
+ console.debug(`[${UserscriptName}]: Restoring renderer.call for detected PowerLink skeleton:`, Args[0]);
142
+ VuejsRenderer.call = Function.prototype.call;
143
+ return;
144
+ }
145
+ return OriginalReflectApply(Target, ThisArg, Args);
146
+ }
147
+ });
73
148
  let PL2AfterLoadInitTimerPatterns = [[
74
149
  /\( *\) *=> *{ *var *_0x[0-9a-z]+ *= *a0_0x[0-9a-f]+ *; *this\[ *_0x[a-z0-9]+\( *0x[0-9a-f]+ *\) *\]\(\); *}/,
75
150
  /\( *\) *=> *{ *var *_0x[0-9a-z]+ *= *a0_0x[0-9a-f]+ *; *this\[ *_0x[a-z0-9]+\( *0x[0-9a-f]+ *\) *\]\(\); *}/
@@ -91,15 +166,15 @@ export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink'
91
166
  setTimeout(() => {
92
167
  let ContainerElements = new Set([CommentContainer]);
93
168
  ContainerElements = new Set([...ContainerElements, ...[...ContainerElements].flatMap(Container => [...Container.querySelectorAll('*')])]);
94
- ContainerElements = new Set([...ContainerElements].filter(Container => Number(getComputedStyle(Container).getPropertyValue('border-bottom-width').replaceAll(/px/g, '')) >= 0.5));
95
- ContainerElements = new Set([...ContainerElements].filter(Container => Number(getComputedStyle(Container).getPropertyValue('border-left-width').replaceAll(/px/g, '')) >= 0.5));
96
- ContainerElements = new Set([...ContainerElements].filter(Container => Number(getComputedStyle(Container).getPropertyValue('border-right-width').replaceAll(/px/g, '')) >= 0.5));
97
- ContainerElements = new Set([...ContainerElements].filter(Container => Number(getComputedStyle(Container).getPropertyValue('border-top-width').replaceAll(/px/g, '')) >= 0.5));
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));
98
173
  ContainerElements = new Set([...ContainerElements].filter(Container => [...Container.querySelectorAll('*')].some(Child => {
99
174
  if (!(Child instanceof HTMLElement))
100
175
  return false;
101
176
  let PL2TitleHeight = Child.getClientRects()[0]?.height ?? 0;
102
- let PL2TitleMarginBottom = Number(getComputedStyle(Child).getPropertyValue('margin-bottom').replaceAll(/px/g, ''));
177
+ let PL2TitleMarginBottom = ParseCssFloat(getComputedStyle(Child).getPropertyValue('margin-bottom'));
103
178
  if (PL2TitleHeight === 0)
104
179
  return false;
105
180
  return PL2TitleMarginBottom >= PL2TitleHeight * 0.65 && PL2TitleMarginBottom <= PL2TitleHeight * 1.25;
@@ -114,14 +189,14 @@ export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink'
114
189
  setTimeout(() => {
115
190
  let ContainerElements = new Set([...BrowserWindow.document.querySelectorAll('div[class] div[class] div[class] ~ div[class]')]);
116
191
  ContainerElements = new Set([...ContainerElements].filter(Container => Container instanceof HTMLElement));
117
- ContainerElements = new Set([...ContainerElements].filter(Container => Number(getComputedStyle(Container).getPropertyValue('margin-bottom').replaceAll(/px$/g, '')) > 15 ||
118
- Number(getComputedStyle(Container).getPropertyValue('padding-top').replaceAll(/px$/g, '')) > 20));
192
+ ContainerElements = new Set([...ContainerElements].filter(Container => ParseCssFloat(getComputedStyle(Container).getPropertyValue('margin-bottom')) > 15 ||
193
+ ParseCssFloat(getComputedStyle(Container).getPropertyValue('padding-top')) > 20));
119
194
  ContainerElements = new Set([...ContainerElements].filter(Container => Container instanceof HTMLElement && Container.innerText.trim().length === 0));
120
195
  ContainerElements = new Set([...ContainerElements].filter(Container => [...Container.querySelectorAll('*')].some(Child => Child instanceof HTMLElement &&
121
- (Number(getComputedStyle(Child).getPropertyValue('padding-top').replaceAll(/px/g, '')) >= 5 &&
122
- Number(getComputedStyle(Child).getPropertyValue('padding-bottom').replaceAll(/px/g, '')) >= 5 &&
123
- Number(getComputedStyle(Child).getPropertyValue('padding-left').replaceAll(/px/g, '')) >= 5 &&
124
- Number(getComputedStyle(Child).getPropertyValue('padding-right').replaceAll(/px/g, '')) >= 5))));
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))));
125
200
  console.debug(`[${UserscriptName}]: Removing PowerLink Skeleton Containers (PL2PlaceHolderMobile):`, ContainerElements);
126
201
  ContainerElements.forEach(Container => {
127
202
  Container.setAttribute('style', 'display: none !important;');
@@ -132,16 +207,16 @@ export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink'
132
207
  let ContainerElements = new Set([...BrowserWindow.document.querySelectorAll('div[class] div[class] div[class] ~ div[class]')]);
133
208
  ContainerElements = new Set([...ContainerElements].filter(Container => Container instanceof HTMLElement));
134
209
  ContainerElements = new Set([...ContainerElements].filter(Container => {
135
- return Number(getComputedStyle(Container).getPropertyValue('padding-top').replaceAll(/px$/g, '')) > 10 ||
136
- Number(getComputedStyle(Container).getPropertyValue('margin-top').replaceAll(/px$/g, '')) > 10;
210
+ return ParseCssFloat(getComputedStyle(Container).getPropertyValue('padding-top')) > 10 ||
211
+ ParseCssFloat(getComputedStyle(Container).getPropertyValue('margin-top')) > 10;
137
212
  }));
138
213
  ContainerElements = new Set([...ContainerElements, ...[...ContainerElements].flatMap(Container => [...Container.querySelectorAll('*:not(button)')])]);
139
214
  ContainerElements = new Set([...ContainerElements].filter(Container => Container instanceof HTMLElement && Container.innerText.trim().length === 0));
140
- ContainerElements = new Set([...ContainerElements].filter(Container => Number(getComputedStyle(Container).getPropertyValue('border-bottom-width').replaceAll(/px/g, '')) >= 0.5));
141
- ContainerElements = new Set([...ContainerElements].filter(Container => Number(getComputedStyle(Container).getPropertyValue('border-left-width').replaceAll(/px/g, '')) >= 0.5));
142
- ContainerElements = new Set([...ContainerElements].filter(Container => Number(getComputedStyle(Container).getPropertyValue('border-right-width').replaceAll(/px/g, '')) >= 0.5));
143
- ContainerElements = new Set([...ContainerElements].filter(Container => Number(getComputedStyle(Container).getPropertyValue('border-top-width').replaceAll(/px/g, '')) >= 0.5));
144
- ContainerElements = new Set([...ContainerElements].filter(Container => Number(getComputedStyle(Container).getPropertyValue('transition-duration').replaceAll(/s$/g, '')) >= 0.01));
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));
145
220
  console.debug(`[${UserscriptName}]: Removing PowerLink Skeleton Containers (PL2PlaceHolder):`, ContainerElements);
146
221
  ContainerElements.forEach(Container => {
147
222
  Container.setAttribute('style', 'display: none !important;');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@filteringdev/namulink",
3
- "version": "19.2.0",
3
+ "version": "19.3.1-build.5d014907c481",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "scripts": {