@filteringdev/namulink 19.2.0 → 19.3.0

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.0
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 L=typeof unsafeWindow<"u"?unsafeWindow:window;function z(a,p="NamuLink"){let S=a.Function.prototype.call,c=a.Reflect.apply,x=a.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 k(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 l=n.vnode;if(typeof l=="object"&&l!==null){let o=l.el;if(o instanceof HTMLElement)return o}n=n.parent}return null}function A(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 l=n.render;if(typeof l=="function")return l;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 l=n.parent;if(typeof l=="object"&&l!==null){let r=l.vnode;if(typeof r=="object"&&r!==null){let i=r.el;if(i instanceof HTMLElement)return i}}let o=n.vnode;if(typeof o=="object"&&o!==null){let r=o.el;if(r instanceof HTMLElement)return r}n=l}return null}let s=.35,y=.75,f=.04,b=null,d=!1;a.Function.prototype.call=new Proxy(S,{apply(e,t,n){if(d)return c(e,t,n);d=!0;let l=String(t);if(l.length<500&&g.filter(o=>o.filter(r=>r.test(l)).length===o.length).length===1){let o=m(n[6]);if(o!==null&&[...o.querySelectorAll("*")].filter(r=>{if(!(r instanceof HTMLElement))return!1;let i=r.getClientRects()[0]?.height??0,u=Math.max(Number(getComputedStyle(r).getPropertyValue("padding-bottom").replaceAll(/px/g,"")),Number(getComputedStyle(r).getPropertyValue("margin-bottom").replaceAll(/px/g,"")));return i>0&&u>=i*(s-f)&&u<=i*(y+f)}).length>=1)return console.debug(`[${p}]: Function.prototype.call called for PowerLink Skeleton:`,t),b=o,a.document.dispatchEvent(new CustomEvent("PL2PlaceHolder")),a.document.dispatchEvent(new CustomEvent("PL2PlaceHolderMobile")),d=!1,c(e,()=>{},[]);console.debug(`[${p}]: Matched Function.prototype.call called, but not for PowerLink Skeleton:`,t)}return d=!1,c(e,t,n)}}),a.Object.defineProperty=new Proxy(x,{apply(e,t,n){let l=A(n[0]),o=m(n[0]),r=String(l??"");if(l!==null&&o!==null&&r.length<500&&g.filter(i=>i.filter(u=>u.test(r)).length===i.length).length===1&&[...o.querySelectorAll("*")].filter(i=>{if(!(i instanceof HTMLElement))return!1;let u=i.getClientRects()[0]?.height??0,P=Math.max(Number(getComputedStyle(i).getPropertyValue("padding-bottom").replaceAll(/px/g,"")),Number(getComputedStyle(i).getPropertyValue("margin-bottom").replaceAll(/px/g,"")));return u>0&&P>=u*(s-f)&&P<=u*(y+f)}).length>=1){console.debug(`[${p}]: Restoring renderer.call for detected PowerLink skeleton:`,n[0]),l.call=Function.prototype.call;return}return c(e,t,n)}});let w=[[/\( *\) *=> *{ *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]+ *\) *\] *\(\) *;/]];a.setTimeout=new Proxy(a.setTimeout,{apply(e,t,n){let l=String(n[0]);return w.filter(o=>o.filter(r=>r.test(l)).length>=1).length===1?(console.debug(`[${p}]: setTimeout called for PowerLink Skeleton:`,n[0]),c(e,t,[()=>{},0])):c(e,t,n)}}),a.document.addEventListener("PL2AdvertContainer",()=>{setTimeout(()=>{let e=new Set([b]);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(n=>{if(!(n instanceof HTMLElement))return!1;let l=n.getClientRects()[0]?.height??0,o=Number(getComputedStyle(n).getPropertyValue("margin-bottom").replaceAll(/px/g,""));return l===0?!1:o>=l*.65&&o<=l*1.25}))),console.debug(`[${p}]: Removing PowerLink Skeleton Containers (PL2AdvertContainer):`,e),e.forEach(t=>{t.setAttribute("style","display: none !important;")})},2500)}),a.document.addEventListener("PL2PlaceHolderMobile",()=>{setTimeout(()=>{let e=new Set([...a.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(n=>n instanceof HTMLElement&&Number(getComputedStyle(n).getPropertyValue("padding-top").replaceAll(/px/g,""))>=5&&Number(getComputedStyle(n).getPropertyValue("padding-bottom").replaceAll(/px/g,""))>=5&&Number(getComputedStyle(n).getPropertyValue("padding-left").replaceAll(/px/g,""))>=5&&Number(getComputedStyle(n).getPropertyValue("padding-right").replaceAll(/px/g,""))>=5))),console.debug(`[${p}]: Removing PowerLink Skeleton Containers (PL2PlaceHolderMobile):`,e),e.forEach(t=>{t.setAttribute("style","display: none !important;")})},2500),a.document.addEventListener("PL2PlaceHolder",()=>{setTimeout(()=>{let e=new Set([...a.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(`[${p}]: Removing PowerLink Skeleton Containers (PL2PlaceHolder):`,e),e.forEach(t=>{t.setAttribute("style","display: none !important;")})},2500)})})}z(L);})();
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,6 +40,51 @@ 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;
@@ -49,7 +99,7 @@ export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink'
49
99
  InHook = true;
50
100
  const Stringified = String(ThisArg);
51
101
  if (Stringified.length < 500 && PL2MajorFuncCallPatterns.filter(Patterns => Patterns.filter(Pattern => Pattern.test(Stringified)).length === Patterns.length).length === 1) {
52
- let PL2Element = GetPowerLinkElementFromArg(Args[6]);
102
+ let PL2Element = PowerLinkElementFromArgParent(Args[6]);
53
103
  if (PL2Element !== null && [...PL2Element.querySelectorAll('*')].filter(Child => {
54
104
  if (!(Child instanceof HTMLElement))
55
105
  return false;
@@ -70,6 +120,28 @@ export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink'
70
120
  return OriginalReflectApply(Target, ThisArg, Args);
71
121
  }
72
122
  });
123
+ BrowserWindow.Object.defineProperty = new Proxy(OriginalObjectDefineProperty, {
124
+ apply(Target, ThisArg, Args) {
125
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
126
+ let VuejsRenderer = PowerLinkRenderFromArg(Args[0]);
127
+ let PL2Element = PowerLinkElementFromArgParent(Args[0]);
128
+ let Stringified = String(VuejsRenderer ?? '');
129
+ if (VuejsRenderer !== null && PL2Element !== null && Stringified.length < 500 &&
130
+ PL2MajorFuncCallPatterns.filter(Patterns => Patterns.filter(Pattern => Pattern.test(Stringified)).length === Patterns.length).length === 1 &&
131
+ [...PL2Element.querySelectorAll('*')].filter(Child => {
132
+ if (!(Child instanceof HTMLElement))
133
+ return false;
134
+ let PL2TitleHeight = Child.getClientRects()[0]?.height ?? 0;
135
+ let PL2TitleMarginBottom = Math.max(Number(getComputedStyle(Child).getPropertyValue('padding-bottom').replaceAll(/px/g, '')), Number(getComputedStyle(Child).getPropertyValue('margin-bottom').replaceAll(/px/g, '')));
136
+ return PL2TitleHeight > 0 && PL2TitleMarginBottom >= PL2TitleHeight * (MinRatio - EpsilonRatio) && PL2TitleMarginBottom <= PL2TitleHeight * (MaxRatio + EpsilonRatio);
137
+ }).length >= 1) {
138
+ console.debug(`[${UserscriptName}]: Restoring renderer.call for detected PowerLink skeleton:`, Args[0]);
139
+ VuejsRenderer.call = Function.prototype.call;
140
+ return;
141
+ }
142
+ return OriginalReflectApply(Target, ThisArg, Args);
143
+ }
144
+ });
73
145
  let PL2AfterLoadInitTimerPatterns = [[
74
146
  /\( *\) *=> *{ *var *_0x[0-9a-z]+ *= *a0_0x[0-9a-f]+ *; *this\[ *_0x[a-z0-9]+\( *0x[0-9a-f]+ *\) *\]\(\); *}/,
75
147
  /\( *\) *=> *{ *var *_0x[0-9a-z]+ *= *a0_0x[0-9a-f]+ *; *this\[ *_0x[a-z0-9]+\( *0x[0-9a-f]+ *\) *\]\(\); *}/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@filteringdev/namulink",
3
- "version": "19.2.0",
3
+ "version": "19.3.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "scripts": {