@filteringdev/namulink 19.3.1 → 19.5.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.3.1
11
+ // @version 19.5.0
12
12
  // @author PiQuark6046 and contributors
13
13
  //
14
14
  // @grant unsafeWindow
@@ -18,11 +18,10 @@
18
18
  // @description:ko NamuLink는 나무위키에 있는 파워링크 광고를 차단합니다.
19
19
  //
20
20
  // @match *://namu.wiki/*
21
- // @match *://*.namu.wiki/*
22
21
  // ==/UserScript==
23
22
 
24
23
 
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);})();
24
+ (()=>{var z=typeof unsafeWindow<"u"?unsafeWindow:window;function C(a,f="NamuLink"){let h=a.Function.prototype.call,d=a.Reflect.apply,R=a.Object.defineProperty,E=a.Proxy,p=a.Object.getOwnPropertyDescriptor,m=[[/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 T(t){if(typeof t!="object"||t===null||typeof d(p,a.Object,[t,"_"])?.get=="function")return null;let e=new Set,n=t._;for(;typeof n=="object"&&n!==null&&!e.has(n);){e.add(n);let o=n.vnode;if(typeof o=="object"&&o!==null){let l=o.el;if(l instanceof HTMLElement)return l}n=n.parent}return null}function w(t){if(typeof t!="object"||t===null||typeof d(p,a.Object,[t,"_"])?.get=="function")return null;let e=new Set,n=t._;for(;typeof n=="object"&&n!==null&&!e.has(n);){e.add(n);let o=n.render;if(typeof o=="function")return o;n=n.parent}return null}function P(t){if(typeof t!="object"||t===null||typeof d(p,a.Object,[t,"_"])?.get=="function")return null;let e=new Set,n=t._;for(;typeof n=="object"&&n!==null&&!e.has(n);){e.add(n);let o=n.parent;if(typeof o=="object"&&o!==null){let i=o.vnode;if(typeof i=="object"&&i!==null){let u=i.el;if(u instanceof HTMLElement)return u}}let l=n.vnode;if(typeof l=="object"&&l!==null){let i=l.el;if(i instanceof HTMLElement)return i}n=o}return null}let S=.35,b=.75,s=.04;function r(t){return Number.parseFloat(t)||0}let k=null,g=!1;a.Function.prototype.call=new Proxy(h,{apply(t,e,n){if(g)return d(t,e,n);g=!0;let o=String(e);if(o.length<500&&m.filter(l=>l.filter(i=>i.test(o)).length===l.length).length===1){let l=P(n[6]);if(l!==null&&[...l.querySelectorAll("*")].filter(i=>{if(!(i instanceof HTMLElement))return!1;let u=i.getClientRects()[0]?.height??0,c=Math.max(r(getComputedStyle(i).getPropertyValue("padding-bottom")),r(getComputedStyle(i).getPropertyValue("margin-bottom")));return u>0&&c>=u*(S-s)&&c<=u*(b+s)}).length>=1)return console.debug(`[${f}]: Function.prototype.call called for PowerLink Skeleton:`,e),k=l,a.document.dispatchEvent(new CustomEvent("PL2PlaceHolder")),a.document.dispatchEvent(new CustomEvent("PL2PlaceHolderMobile")),g=!1,d(t,()=>{},[]);console.debug(`[${f}]: Matched Function.prototype.call called, but not for PowerLink Skeleton:`,e)}return g=!1,d(t,e,n)}}),a.Object.defineProperty=new Proxy(R,{apply(t,e,n){let o=w(n[0]),l=P(n[0]),i=String(o??"");if(o!==null&&l!==null&&i.length<500&&m.filter(u=>u.filter(c=>c.test(i)).length===u.length).length===1&&[...l.querySelectorAll("*")].filter(u=>{if(!(u instanceof HTMLElement))return!1;let c=u.getClientRects()[0]?.height??0,y=Math.max(r(getComputedStyle(u).getPropertyValue("padding-bottom")),r(getComputedStyle(u).getPropertyValue("margin-bottom")));return c>0&&y>=c*(S-s)&&y<=c*(b+s)}).length>=1){console.debug(`[${f}]: Restoring renderer.call for detected PowerLink skeleton:`,n[0]),o.call=Function.prototype.call;return}return d(t,e,n)}});let V=[[/\( *\) *=> *{ *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(t,e,n){let o=String(n[0]);return V.filter(l=>l.filter(i=>i.test(o)).length>=1).length===1?(console.debug(`[${f}]: setTimeout called for PowerLink Skeleton:`,n[0]),d(t,e,[()=>{},0])):d(t,e,n)}});function x(t,e){if(typeof t!="object"||t===null)return 1;if(typeof d(p,a.Object,[t,"_"])?.get=="function")return null;let n=new Set,o=t._;for(;typeof o=="object"&&o!==null;){if(n.has(o))return 2;n.add(o);let l=o;if(typeof l.render=="function")return l.render=e,0;o=l.parent}return 3}function j(t){if(typeof t!="object"||t===null||typeof d(p,a.Object,[t,"_"])?.get=="function")return null;let e=new Set,n=t._;for(;typeof n=="object"&&n!==null&&!e.has(n);){e.add(n);let o=n,l=o.render;if(typeof l=="function")return l;let i=o.vnode;if(typeof i=="object"&&i!==null){let u=i.type;if(typeof u=="object"&&u!==null){let c=u.render;if(typeof c=="function")return c}}n=o.parent}return null}function v(t,e){if(typeof t!="object"||t===null)return 1;if(typeof d(p,a.Object,[t,"_"])?.get=="function")return null;let n=new Set,o=t._;for(;typeof o=="object"&&o!==null;){if(n.has(o))return 2;n.add(o);let l=o,i=l.vnode;if(typeof i=="object"&&i!==null){let u=i.type;if(typeof u=="object"&&u!==null&&typeof u.render=="function")return u.render=e,0}o=l.parent}return 3}let L=new Set;a.Proxy=new Proxy(E,{construct(t,e){let n=w(e[0]),o=j(e[0]),l=P(e[0]),i=String(n??"");if(n!==null&&l!==null&&i.length<500&&m.filter(u=>u.filter(c=>c.test(i)).length===u.length).length===1&&[...l.querySelectorAll("*")].filter(u=>{if(!(u instanceof HTMLElement))return!1;let c=u.getClientRects()[0]?.height??0,y=Math.max(r(getComputedStyle(u).getPropertyValue("padding-bottom")),r(getComputedStyle(u).getPropertyValue("margin-bottom")));return c>0&&y>=c*(S-s)&&y<=c*(b+s)}).length>=1)console.debug(`[${f}]: Prevented declaring render function in Vue.js 3 for detected PowerLink skeleton:`,e[0],l),L.add(n),x(e[0],()=>null),a.document.dispatchEvent(new CustomEvent("PL2PlaceHolderProxy"));else if(o!==null&&L.has(o))return console.debug(`[${f}]: Prevented declaring render function in Vue.js 3 in SPA moving for detected PowerLink skeleton:`,e[0]),v(e[0],()=>null),a.document.dispatchEvent(new CustomEvent("PL2PlaceHolderProxy")),Reflect.construct(t,e);return Reflect.construct(t,e)}}),a.document.addEventListener("PL2AdvertContainer",()=>{setTimeout(()=>{let t=new Set([k]);t=new Set([...t,...[...t].flatMap(e=>[...e.querySelectorAll("*")])]),t=new Set([...t].filter(e=>r(getComputedStyle(e).getPropertyValue("border-bottom-width"))>=.5)),t=new Set([...t].filter(e=>r(getComputedStyle(e).getPropertyValue("border-left-width"))>=.5)),t=new Set([...t].filter(e=>r(getComputedStyle(e).getPropertyValue("border-right-width"))>=.5)),t=new Set([...t].filter(e=>r(getComputedStyle(e).getPropertyValue("border-top-width"))>=.5)),t=new Set([...t].filter(e=>[...e.querySelectorAll("*")].some(n=>{if(!(n instanceof HTMLElement))return!1;let o=n.getClientRects()[0]?.height??0,l=r(getComputedStyle(n).getPropertyValue("margin-bottom"));return o===0?!1:l>=o*.65&&l<=o*1.25}))),console.debug(`[${f}]: Removing PowerLink Skeleton Containers (PL2AdvertContainer):`,t),t.forEach(e=>{e.setAttribute("style","display: none !important;")})},2500)}),a.document.addEventListener("PL2PlaceHolderMobile",()=>{setTimeout(()=>{let t=new Set([...a.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=>r(getComputedStyle(e).getPropertyValue("margin-bottom"))>15||r(getComputedStyle(e).getPropertyValue("padding-top"))>20)),t=new Set([...t].filter(e=>e instanceof HTMLElement&&e.innerText.trim().length===0)),t=new Set([...t].filter(e=>[...e.querySelectorAll("*")].some(n=>n instanceof HTMLElement&&r(getComputedStyle(n).getPropertyValue("padding-top"))>=5&&r(getComputedStyle(n).getPropertyValue("padding-bottom"))>=5&&r(getComputedStyle(n).getPropertyValue("padding-left"))>=5&&r(getComputedStyle(n).getPropertyValue("padding-right"))>=5))),console.debug(`[${f}]: Removing PowerLink Skeleton Containers (PL2PlaceHolderMobile):`,t),t.forEach(e=>{e.setAttribute("style","display: none !important;")})},2500)}),a.document.addEventListener("PL2PlaceHolder",()=>{setTimeout(()=>{let t=new Set([...a.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=>r(getComputedStyle(e).getPropertyValue("padding-top"))>10||r(getComputedStyle(e).getPropertyValue("margin-top"))>10)),t=new Set([...t,...[...t].flatMap(e=>[...e.querySelectorAll("*:not(button)")])]),t=new Set([...t].filter(e=>e instanceof HTMLElement&&e.innerText.trim().length===0)),t=new Set([...t].filter(e=>r(getComputedStyle(e).getPropertyValue("border-bottom-width"))>=.5)),t=new Set([...t].filter(e=>r(getComputedStyle(e).getPropertyValue("border-left-width"))>=.5)),t=new Set([...t].filter(e=>r(getComputedStyle(e).getPropertyValue("border-right-width"))>=.5)),t=new Set([...t].filter(e=>r(getComputedStyle(e).getPropertyValue("border-top-width"))>=.5)),t=new Set([...t].filter(e=>r(getComputedStyle(e).getPropertyValue("transition-duration"))>=.01)),console.debug(`[${f}]: Removing PowerLink Skeleton Containers (PL2PlaceHolder):`,t),t.forEach(e=>{e.setAttribute("style","display: none !important;")})},2500)}),a.document.addEventListener("PL2PlaceHolderProxy",()=>{setTimeout(()=>{let t=new Set([...a.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=>r(getComputedStyle(e).getPropertyValue("padding-top"))>=5&&r(getComputedStyle(e).getPropertyValue("padding-bottom"))>=5&&r(getComputedStyle(e).getPropertyValue("padding-left"))>=5&&r(getComputedStyle(e).getPropertyValue("padding-right"))>=5&&r(getComputedStyle(e).getPropertyValue("border-top-width"))>=.35&&r(getComputedStyle(e).getPropertyValue("border-bottom-width"))>=.35&&r(getComputedStyle(e).getPropertyValue("border-left-width"))>=.35&&r(getComputedStyle(e).getPropertyValue("border-right-width"))>=.35&&e.getClientRects()[0]?.height<=20&&e.getClientRects()[0]?.height>0)),t=new Set([...t].filter(e=>e instanceof HTMLElement&&e.innerText.trim().length===0)),console.debug(`[${f}]: Removing PowerLink Skeleton Containers (PL2PlaceHolderProxy):`,t),t.forEach(e=>{e.setAttribute("style","display: none !important;")})},2500)})}C(z);})();
26
25
  /*!
27
26
  * @license MPL-2.0
28
27
  * This Source Code Form is subject to the terms of the Mozilla Public
package/dist/index.js CHANGED
@@ -12,6 +12,8 @@ export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink'
12
12
  const OriginalFunctionPrototypeCall = BrowserWindow.Function.prototype.call;
13
13
  const OriginalReflectApply = BrowserWindow.Reflect.apply;
14
14
  const OriginalObjectDefineProperty = BrowserWindow.Object.defineProperty;
15
+ const OriginalProxy = BrowserWindow.Proxy;
16
+ const OriginalObjectGetOwnPropertyDescriptor = BrowserWindow.Object.getOwnPropertyDescriptor;
15
17
  const PL2MajorFuncCallPatterns = [[
16
18
  /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]+/,
17
19
  /, *[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 *+-]+/,
@@ -24,6 +26,8 @@ export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink'
24
26
  function PowerLinkElementFromArg(Arg) {
25
27
  if (typeof Arg !== 'object' || Arg === null)
26
28
  return null;
29
+ if (typeof OriginalReflectApply(OriginalObjectGetOwnPropertyDescriptor, BrowserWindow.Object, [Arg, '_'])?.get === 'function')
30
+ return null;
27
31
  const Visited = new Set();
28
32
  let Current = Arg['_'];
29
33
  while (typeof Current === 'object' && Current !== null) {
@@ -44,6 +48,8 @@ export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink'
44
48
  function PowerLinkRenderFromArg(Arg) {
45
49
  if (typeof Arg !== 'object' || Arg === null)
46
50
  return null;
51
+ if (typeof OriginalReflectApply(OriginalObjectGetOwnPropertyDescriptor, BrowserWindow.Object, [Arg, '_'])?.get === 'function')
52
+ return null;
47
53
  const Visited = new Set();
48
54
  let Current = Arg['_'];
49
55
  while (typeof Current === 'object' && Current !== null) {
@@ -60,6 +66,8 @@ export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink'
60
66
  function PowerLinkElementFromArgParent(Arg) {
61
67
  if (typeof Arg !== 'object' || Arg === null)
62
68
  return null;
69
+ if (typeof OriginalReflectApply(OriginalObjectGetOwnPropertyDescriptor, BrowserWindow.Object, [Arg, '_'])?.get === 'function')
70
+ return null;
63
71
  const Visited = new Set();
64
72
  let Current = Arg['_'];
65
73
  while (typeof Current === 'object' && Current !== null) {
@@ -126,10 +134,10 @@ export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink'
126
134
  BrowserWindow.Object.defineProperty = new Proxy(OriginalObjectDefineProperty, {
127
135
  apply(Target, ThisArg, Args) {
128
136
  // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
129
- let VuejsRenderer = PowerLinkRenderFromArg(Args[0]);
137
+ let VuejsRender = PowerLinkRenderFromArg(Args[0]);
130
138
  let PL2Element = PowerLinkElementFromArgParent(Args[0]);
131
- let Stringified = String(VuejsRenderer ?? '');
132
- if (VuejsRenderer !== null && PL2Element !== null && Stringified.length < 500 &&
139
+ let Stringified = String(VuejsRender ?? '');
140
+ if (VuejsRender !== null && PL2Element !== null && Stringified.length < 500 &&
133
141
  PL2MajorFuncCallPatterns.filter(Patterns => Patterns.filter(Pattern => Pattern.test(Stringified)).length === Patterns.length).length === 1 &&
134
142
  [...PL2Element.querySelectorAll('*')].filter(Child => {
135
143
  if (!(Child instanceof HTMLElement))
@@ -139,7 +147,7 @@ export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink'
139
147
  return PL2TitleHeight > 0 && PL2TitleMarginBottom >= PL2TitleHeight * (MinRatio - EpsilonRatio) && PL2TitleMarginBottom <= PL2TitleHeight * (MaxRatio + EpsilonRatio);
140
148
  }).length >= 1) {
141
149
  console.debug(`[${UserscriptName}]: Restoring renderer.call for detected PowerLink skeleton:`, Args[0]);
142
- VuejsRenderer.call = Function.prototype.call;
150
+ VuejsRender.call = Function.prototype.call;
143
151
  return;
144
152
  }
145
153
  return OriginalReflectApply(Target, ThisArg, Args);
@@ -162,6 +170,118 @@ export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink'
162
170
  return OriginalReflectApply(Target, ThisArg, Args);
163
171
  }
164
172
  });
173
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
174
+ function PowerLinkOverrideRenderFromArg(Arg, Override) {
175
+ if (typeof Arg !== 'object' || Arg === null)
176
+ return 1;
177
+ if (typeof OriginalReflectApply(OriginalObjectGetOwnPropertyDescriptor, BrowserWindow.Object, [Arg, '_'])?.get === 'function')
178
+ return null;
179
+ const Visited = new Set();
180
+ let Current = Arg['_'];
181
+ while (typeof Current === 'object' && Current !== null) {
182
+ if (Visited.has(Current))
183
+ return 2;
184
+ Visited.add(Current);
185
+ const RecordCurrent = Current;
186
+ const Render = RecordCurrent['render'];
187
+ if (typeof Render === 'function') {
188
+ RecordCurrent['render'] = Override;
189
+ return 0;
190
+ }
191
+ Current = RecordCurrent['parent'];
192
+ }
193
+ return 3;
194
+ }
195
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
196
+ function PowerLinkVnodeTypeRenderFromArg(Arg) {
197
+ if (typeof Arg !== 'object' || Arg === null)
198
+ return null;
199
+ if (typeof OriginalReflectApply(OriginalObjectGetOwnPropertyDescriptor, BrowserWindow.Object, [Arg, '_'])?.get === 'function')
200
+ return null;
201
+ const Visited = new Set();
202
+ let Current = Arg['_'];
203
+ while (typeof Current === 'object' && Current !== null) {
204
+ if (Visited.has(Current))
205
+ break;
206
+ Visited.add(Current);
207
+ const CurrentRecord = Current;
208
+ const Render = CurrentRecord['render'];
209
+ if (typeof Render === 'function')
210
+ return Render;
211
+ const VNode = CurrentRecord['vnode'];
212
+ if (typeof VNode === 'object' && VNode !== null) {
213
+ const Type = VNode['type'];
214
+ if (typeof Type === 'object' && Type !== null) {
215
+ const TypeRender = Type['render'];
216
+ if (typeof TypeRender === 'function')
217
+ return TypeRender;
218
+ }
219
+ }
220
+ Current = CurrentRecord['parent'];
221
+ }
222
+ return null;
223
+ }
224
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
225
+ function PowerLinkOverrideVnodeTypeRenderOnlyFromArg(Arg, Override) {
226
+ if (typeof Arg !== 'object' || Arg === null)
227
+ return 1;
228
+ if (typeof OriginalReflectApply(OriginalObjectGetOwnPropertyDescriptor, BrowserWindow.Object, [Arg, '_'])?.get === 'function')
229
+ return null;
230
+ const Visited = new Set();
231
+ let Current = Arg['_'];
232
+ while (typeof Current === 'object' && Current !== null) {
233
+ if (Visited.has(Current))
234
+ return 2;
235
+ Visited.add(Current);
236
+ const CurrentRecord = Current;
237
+ const VNode = CurrentRecord['vnode'];
238
+ if (typeof VNode === 'object' && VNode !== null) {
239
+ const Type = VNode['type'];
240
+ if (typeof Type === 'object' && Type !== null) {
241
+ const TypeRender = Type['render'];
242
+ if (typeof TypeRender === 'function') {
243
+ Type['render'] = Override;
244
+ return 0;
245
+ }
246
+ }
247
+ }
248
+ Current = CurrentRecord['parent'];
249
+ }
250
+ return 3;
251
+ }
252
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
253
+ let VuejsPL2Render = new Set();
254
+ BrowserWindow.Proxy = new Proxy(OriginalProxy, {
255
+ construct(Target, Args) {
256
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
257
+ let VuejsRender = PowerLinkRenderFromArg(Args[0]);
258
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
259
+ let VuejsCtxSubtreeRender = PowerLinkVnodeTypeRenderFromArg(Args[0]);
260
+ let PL2Element = PowerLinkElementFromArgParent(Args[0]);
261
+ let Stringified = String(VuejsRender ?? '');
262
+ if (VuejsRender !== null && PL2Element !== null && Stringified.length < 500 &&
263
+ PL2MajorFuncCallPatterns.filter(Patterns => Patterns.filter(Pattern => Pattern.test(Stringified)).length === Patterns.length).length === 1 &&
264
+ [...PL2Element.querySelectorAll('*')].filter(Child => {
265
+ if (!(Child instanceof HTMLElement))
266
+ return false;
267
+ let PL2TitleHeight = Child.getClientRects()[0]?.height ?? 0;
268
+ let PL2TitleMarginBottom = Math.max(ParseCssFloat(getComputedStyle(Child).getPropertyValue('padding-bottom')), ParseCssFloat(getComputedStyle(Child).getPropertyValue('margin-bottom')));
269
+ return PL2TitleHeight > 0 && PL2TitleMarginBottom >= PL2TitleHeight * (MinRatio - EpsilonRatio) && PL2TitleMarginBottom <= PL2TitleHeight * (MaxRatio + EpsilonRatio);
270
+ }).length >= 1) {
271
+ console.debug(`[${UserscriptName}]: Prevented declaring render function in Vue.js 3 for detected PowerLink skeleton:`, Args[0], PL2Element);
272
+ VuejsPL2Render.add(VuejsRender);
273
+ PowerLinkOverrideRenderFromArg(Args[0], () => null);
274
+ BrowserWindow.document.dispatchEvent(new CustomEvent('PL2PlaceHolderProxy'));
275
+ }
276
+ else if (VuejsCtxSubtreeRender !== null && VuejsPL2Render.has(VuejsCtxSubtreeRender)) {
277
+ console.debug(`[${UserscriptName}]: Prevented declaring render function in Vue.js 3 in SPA moving for detected PowerLink skeleton:`, Args[0]);
278
+ PowerLinkOverrideVnodeTypeRenderOnlyFromArg(Args[0], () => null);
279
+ BrowserWindow.document.dispatchEvent(new CustomEvent('PL2PlaceHolderProxy'));
280
+ return Reflect.construct(Target, Args);
281
+ }
282
+ return Reflect.construct(Target, Args);
283
+ }
284
+ });
165
285
  BrowserWindow.document.addEventListener('PL2AdvertContainer', () => {
166
286
  setTimeout(() => {
167
287
  let ContainerElements = new Set([CommentContainer]);
@@ -202,27 +322,49 @@ export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink'
202
322
  Container.setAttribute('style', 'display: none !important;');
203
323
  });
204
324
  }, 2500);
205
- BrowserWindow.document.addEventListener('PL2PlaceHolder', () => {
206
- setTimeout(() => {
207
- let ContainerElements = new Set([...BrowserWindow.document.querySelectorAll('div[class] div[class] div[class] ~ div[class]')]);
208
- ContainerElements = new Set([...ContainerElements].filter(Container => Container instanceof HTMLElement));
209
- ContainerElements = new Set([...ContainerElements].filter(Container => {
210
- return ParseCssFloat(getComputedStyle(Container).getPropertyValue('padding-top')) > 10 ||
211
- ParseCssFloat(getComputedStyle(Container).getPropertyValue('margin-top')) > 10;
212
- }));
213
- ContainerElements = new Set([...ContainerElements, ...[...ContainerElements].flatMap(Container => [...Container.querySelectorAll('*:not(button)')])]);
214
- ContainerElements = new Set([...ContainerElements].filter(Container => Container instanceof HTMLElement && Container.innerText.trim().length === 0));
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));
220
- console.debug(`[${UserscriptName}]: Removing PowerLink Skeleton Containers (PL2PlaceHolder):`, ContainerElements);
221
- ContainerElements.forEach(Container => {
222
- Container.setAttribute('style', 'display: none !important;');
223
- });
224
- }, 2500);
225
- });
325
+ });
326
+ BrowserWindow.document.addEventListener('PL2PlaceHolder', () => {
327
+ setTimeout(() => {
328
+ let ContainerElements = new Set([...BrowserWindow.document.querySelectorAll('div[class] div[class] div[class] ~ div[class]')]);
329
+ ContainerElements = new Set([...ContainerElements].filter(Container => Container instanceof HTMLElement));
330
+ ContainerElements = new Set([...ContainerElements].filter(Container => {
331
+ return ParseCssFloat(getComputedStyle(Container).getPropertyValue('padding-top')) > 10 ||
332
+ ParseCssFloat(getComputedStyle(Container).getPropertyValue('margin-top')) > 10;
333
+ }));
334
+ ContainerElements = new Set([...ContainerElements, ...[...ContainerElements].flatMap(Container => [...Container.querySelectorAll('*:not(button)')])]);
335
+ ContainerElements = new Set([...ContainerElements].filter(Container => Container instanceof HTMLElement && Container.innerText.trim().length === 0));
336
+ ContainerElements = new Set([...ContainerElements].filter(Container => ParseCssFloat(getComputedStyle(Container).getPropertyValue('border-bottom-width')) >= 0.5));
337
+ ContainerElements = new Set([...ContainerElements].filter(Container => ParseCssFloat(getComputedStyle(Container).getPropertyValue('border-left-width')) >= 0.5));
338
+ ContainerElements = new Set([...ContainerElements].filter(Container => ParseCssFloat(getComputedStyle(Container).getPropertyValue('border-right-width')) >= 0.5));
339
+ ContainerElements = new Set([...ContainerElements].filter(Container => ParseCssFloat(getComputedStyle(Container).getPropertyValue('border-top-width')) >= 0.5));
340
+ ContainerElements = new Set([...ContainerElements].filter(Container => ParseCssFloat(getComputedStyle(Container).getPropertyValue('transition-duration')) >= 0.01));
341
+ console.debug(`[${UserscriptName}]: Removing PowerLink Skeleton Containers (PL2PlaceHolder):`, ContainerElements);
342
+ ContainerElements.forEach(Container => {
343
+ Container.setAttribute('style', 'display: none !important;');
344
+ });
345
+ }, 2500);
346
+ });
347
+ BrowserWindow.document.addEventListener('PL2PlaceHolderProxy', () => {
348
+ setTimeout(() => {
349
+ let ContainerElements = new Set([...BrowserWindow.document.querySelectorAll('div[class] div[class] div[class] ~ div[class]')]);
350
+ ContainerElements = new Set([...ContainerElements].filter(Container => Container instanceof HTMLElement));
351
+ ContainerElements = new Set([...ContainerElements].filter(Container => {
352
+ return ParseCssFloat(getComputedStyle(Container).getPropertyValue('padding-top')) >= 5 &&
353
+ ParseCssFloat(getComputedStyle(Container).getPropertyValue('padding-bottom')) >= 5 &&
354
+ ParseCssFloat(getComputedStyle(Container).getPropertyValue('padding-left')) >= 5 &&
355
+ ParseCssFloat(getComputedStyle(Container).getPropertyValue('padding-right')) >= 5 &&
356
+ ParseCssFloat(getComputedStyle(Container).getPropertyValue('border-top-width')) >= 0.35 &&
357
+ ParseCssFloat(getComputedStyle(Container).getPropertyValue('border-bottom-width')) >= 0.35 &&
358
+ ParseCssFloat(getComputedStyle(Container).getPropertyValue('border-left-width')) >= 0.35 &&
359
+ ParseCssFloat(getComputedStyle(Container).getPropertyValue('border-right-width')) >= 0.35 &&
360
+ Container.getClientRects()[0]?.height <= 20 && Container.getClientRects()[0]?.height > 0;
361
+ }));
362
+ ContainerElements = new Set([...ContainerElements].filter(Container => Container instanceof HTMLElement && Container.innerText.trim().length === 0));
363
+ console.debug(`[${UserscriptName}]: Removing PowerLink Skeleton Containers (PL2PlaceHolderProxy):`, ContainerElements);
364
+ ContainerElements.forEach(Container => {
365
+ Container.setAttribute('style', 'display: none !important;');
366
+ });
367
+ }, 2500);
226
368
  });
227
369
  }
228
370
  RunNamuLinkUserscript(Win);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@filteringdev/namulink",
3
- "version": "19.3.1",
3
+ "version": "19.5.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "scripts": {