@filteringdev/namulink 19.4.0 → 19.6.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.4.0
11
+ // @version 19.6.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 z=typeof unsafeWindow<"u"?unsafeWindow:window;function R(u,c="NamuLink"){let L=u.Function.prototype.call,f=u.Reflect.apply,h=u.Object.defineProperty,k=u.Proxy,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 *[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 V(t){if(typeof t!="object"||t===null)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 r=o.el;if(r instanceof HTMLElement)return r}n=n.parent}return null}function S(t){if(typeof t!="object"||t===null)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 y(t){if(typeof t!="object"||t===null)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 a=i.el;if(a instanceof HTMLElement)return a}}let r=n.vnode;if(typeof r=="object"&&r!==null){let i=r.el;if(i instanceof HTMLElement)return i}n=o}return null}let m=.35,P=.75,p=.04;function l(t){return Number.parseFloat(t)||0}let b=null,g=!1;u.Function.prototype.call=new Proxy(L,{apply(t,e,n){if(g)return f(t,e,n);g=!0;let o=String(e);if(o.length<500&&s.filter(r=>r.filter(i=>i.test(o)).length===r.length).length===1){let r=y(n[6]);if(r!==null&&[...r.querySelectorAll("*")].filter(i=>{if(!(i instanceof HTMLElement))return!1;let a=i.getClientRects()[0]?.height??0,d=Math.max(l(getComputedStyle(i).getPropertyValue("padding-bottom")),l(getComputedStyle(i).getPropertyValue("margin-bottom")));return a>0&&d>=a*(m-p)&&d<=a*(P+p)}).length>=1)return console.debug(`[${c}]: Function.prototype.call called for PowerLink Skeleton:`,e),b=r,u.document.dispatchEvent(new CustomEvent("PL2PlaceHolder")),u.document.dispatchEvent(new CustomEvent("PL2PlaceHolderMobile")),g=!1,f(t,()=>{},[]);console.debug(`[${c}]: Matched Function.prototype.call called, but not for PowerLink Skeleton:`,e)}return g=!1,f(t,e,n)}}),u.Object.defineProperty=new Proxy(h,{apply(t,e,n){let o=S(n[0]),r=y(n[0]),i=String(o??"");if(o!==null&&r!==null&&i.length<500&&s.filter(a=>a.filter(d=>d.test(i)).length===a.length).length===1&&[...r.querySelectorAll("*")].filter(a=>{if(!(a instanceof HTMLElement))return!1;let d=a.getClientRects()[0]?.height??0,w=Math.max(l(getComputedStyle(a).getPropertyValue("padding-bottom")),l(getComputedStyle(a).getPropertyValue("margin-bottom")));return d>0&&w>=d*(m-p)&&w<=d*(P+p)}).length>=1){console.debug(`[${c}]: Restoring renderer.call for detected PowerLink skeleton:`,n[0]),o.call=Function.prototype.call;return}return f(t,e,n)}});let E=[[/\( *\) *=> *{ *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]+ *\) *\] *\(\) *;/]];u.setTimeout=new Proxy(u.setTimeout,{apply(t,e,n){let o=String(n[0]);return E.filter(r=>r.filter(i=>i.test(o)).length>=1).length===1?(console.debug(`[${c}]: setTimeout called for PowerLink Skeleton:`,n[0]),f(t,e,[()=>{},0])):f(t,e,n)}});function x(t,e){if(typeof t!="object"||t===null)return 1;let n=new Set,o=t._;for(;typeof o=="object"&&o!==null;){if(n.has(o))return 2;n.add(o);let r=o;if(typeof r.render=="function")return r.render=e,0;o=r.parent}return 3}u.Proxy=new Proxy(k,{construct(t,e){let n=S(e[0]),o=y(e[0]),r=String(n??"");return n!==null&&o!==null&&r.length<500&&s.filter(i=>i.filter(a=>a.test(r)).length===i.length).length===1&&[...o.querySelectorAll("*")].filter(i=>{if(!(i instanceof HTMLElement))return!1;let a=i.getClientRects()[0]?.height??0,d=Math.max(l(getComputedStyle(i).getPropertyValue("padding-bottom")),l(getComputedStyle(i).getPropertyValue("margin-bottom")));return a>0&&d>=a*(m-p)&&d<=a*(P+p)}).length>=1&&(console.debug(`[${c}]: Prevented declaring render function in Vue.js 3 for detected PowerLink skeleton:`,e[0],o),x(e[0],()=>null),u.document.dispatchEvent(new CustomEvent("PL2PlaceHolderProxy"))),Reflect.construct(t,e)}}),u.document.addEventListener("PL2AdvertContainer",()=>{setTimeout(()=>{let t=new Set([b]);t=new Set([...t,...[...t].flatMap(e=>[...e.querySelectorAll("*")])]),t=new Set([...t].filter(e=>l(getComputedStyle(e).getPropertyValue("border-bottom-width"))>=.5)),t=new Set([...t].filter(e=>l(getComputedStyle(e).getPropertyValue("border-left-width"))>=.5)),t=new Set([...t].filter(e=>l(getComputedStyle(e).getPropertyValue("border-right-width"))>=.5)),t=new Set([...t].filter(e=>l(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,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):`,t),t.forEach(e=>{e.setAttribute("style","display: none !important;")})},2500)}),u.document.addEventListener("PL2PlaceHolderMobile",()=>{setTimeout(()=>{let t=new Set([...u.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=>l(getComputedStyle(e).getPropertyValue("margin-bottom"))>15||l(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&&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):`,t),t.forEach(e=>{e.setAttribute("style","display: none !important;")})},2500)}),u.document.addEventListener("PL2PlaceHolder",()=>{setTimeout(()=>{let t=new Set([...u.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=>l(getComputedStyle(e).getPropertyValue("padding-top"))>10||l(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=>l(getComputedStyle(e).getPropertyValue("border-bottom-width"))>=.5)),t=new Set([...t].filter(e=>l(getComputedStyle(e).getPropertyValue("border-left-width"))>=.5)),t=new Set([...t].filter(e=>l(getComputedStyle(e).getPropertyValue("border-right-width"))>=.5)),t=new Set([...t].filter(e=>l(getComputedStyle(e).getPropertyValue("border-top-width"))>=.5)),t=new Set([...t].filter(e=>l(getComputedStyle(e).getPropertyValue("transition-duration"))>=.01)),console.debug(`[${c}]: Removing PowerLink Skeleton Containers (PL2PlaceHolder):`,t),t.forEach(e=>{e.setAttribute("style","display: none !important;")})},2500)}),u.document.addEventListener("PL2PlaceHolderProxy",()=>{setTimeout(()=>{let t=new Set([...u.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=>l(getComputedStyle(e).getPropertyValue("padding-top"))>=5&&l(getComputedStyle(e).getPropertyValue("padding-bottom"))>=5&&l(getComputedStyle(e).getPropertyValue("padding-left"))>=5&&l(getComputedStyle(e).getPropertyValue("padding-right"))>=5&&l(getComputedStyle(e).getPropertyValue("border-top-width"))>=.35&&l(getComputedStyle(e).getPropertyValue("border-bottom-width"))>=.35&&l(getComputedStyle(e).getPropertyValue("border-left-width"))>=.35&&l(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(`[${c}]: Removing PowerLink Skeleton Containers (PL2PlaceHolderProxy):`,t),t.forEach(e=>{e.setAttribute("style","display: none !important;")})},2500)})}R(z);})();
24
+ (()=>{var T=typeof unsafeWindow<"u"?unsafeWindow:window;function M(c,f="NamuLink"){let x=c.Function.prototype.call,d=c.Reflect.apply,j=c.Object.defineProperty,E=c.Proxy,s=c.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 Z(t){if(typeof t!="object"||t===null||typeof d(s,c.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 k(t){if(typeof t!="object"||t===null||typeof d(s,c.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(s,c.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 r=i.el;if(r instanceof HTMLElement)return r}}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 b=.35,S=.75,y=.04;function u(t){return Number.parseFloat(t)||0}let w=null,g=!1;c.Function.prototype.call=new Proxy(x,{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 r=i.getClientRects()[0]?.height??0,a=Math.max(u(getComputedStyle(i).getPropertyValue("padding-bottom")),u(getComputedStyle(i).getPropertyValue("margin-bottom")));return r>0&&a>=r*(b-y)&&a<=r*(S+y)}).length>=1)return console.debug(`[${f}]: Function.prototype.call called for PowerLink Skeleton:`,e),w=l,c.document.dispatchEvent(new CustomEvent("PL2PlaceHolder")),c.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)}}),c.Object.defineProperty=new Proxy(j,{apply(t,e,n){let o=k(n[0]),l=P(n[0]),i=String(o??"");if(o!==null&&l!==null&&i.length<500&&m.filter(r=>r.filter(a=>a.test(i)).length===r.length).length===1&&[...l.querySelectorAll("*")].filter(r=>{if(!(r instanceof HTMLElement))return!1;let a=r.getClientRects()[0]?.height??0,p=Math.max(u(getComputedStyle(r).getPropertyValue("padding-bottom")),u(getComputedStyle(r).getPropertyValue("margin-bottom")));return a>0&&p>=a*(b-y)&&p<=a*(S+y)}).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]+ *\) *\] *\(\) *;/]];c.setTimeout=new Proxy(c.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 v(t,e){if(typeof t!="object"||t===null)return 1;if(typeof d(s,c.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 z(t){if(typeof t!="object"||t===null||typeof d(s,c.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 r=i.type;if(typeof r=="object"&&r!==null){let a=r.render;if(typeof a=="function")return a}}n=o.parent}return null}function C(t,e){if(typeof t!="object"||t===null)return 1;if(typeof d(s,c.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 r=i.type;if(typeof r=="object"&&r!==null&&typeof r.render=="function")return r.render=e,0}o=l.parent}return 3}function H(t){return String(t).includes("https://ader.naver.com/")}function L(t){for(let e of Object.keys(t)){let n=t[e],o=s(t,e);if(typeof n=="object"&&n!==null&&typeof o?.get!="function"){if(L(n))return!0}else if(typeof n=="string"&&n.includes("ader.naver.com"))return!0}return!1}function h(t,e){let n=t;for(let o of Object.keys(n)){let l=n[o],i=s(t,o);if(typeof l=="object"&&l!==null&&typeof i?.get!="function"){if(h(l,e))return!0}else if(typeof l=="string"&&l.includes("ader.naver.com"))return n[o]=e,!0}return!1}let R=new Set;c.Proxy=new Proxy(E,{construct(t,e){let n=k(e[0]),o=z(e[0]),l=P(e[0]),i=String(n??"");if(n!==null&&l!==null&&i.length<500&&m.filter(r=>r.filter(a=>a.test(i)).length===r.length).length===1&&[...l.querySelectorAll("*")].filter(r=>{if(!(r instanceof HTMLElement))return!1;let a=r.getClientRects()[0]?.height??0,p=Math.max(u(getComputedStyle(r).getPropertyValue("padding-bottom")),u(getComputedStyle(r).getPropertyValue("margin-bottom")));return a>0&&p>=a*(b-y)&&p<=a*(S+y)}).length>=1)console.debug(`[${f}]: Prevented declaring render function in Vue.js 3 for detected PowerLink skeleton:`,e[0],l),R.add(n),v(e[0],()=>null),c.document.dispatchEvent(new CustomEvent("PL2PlaceHolderProxy"));else if(o!==null&&R.has(o))return console.debug(`[${f}]: Prevented declaring render function in Vue.js 3 in SPA moving for detected PowerLink skeleton:`,e[0]),C(e[0],()=>null),c.document.dispatchEvent(new CustomEvent("PL2PlaceHolderProxy")),Reflect.construct(t,e);if(typeof e[1].set=="function"){let r=e[1].set;e[1].set=function(...a){if(H(a[2])){console.debug(`[${f}]: Proxy set called for PowerLink Skeleton:`,a);return}if(L(a[0])&&Object.keys(a[0]).some(p=>typeof a[0][p]<"u"&&a[0][p]instanceof AbortController)){console.debug(`[${f}]: Proxy set called for PowerLink Skeleton (target check):`,a),c.document.dispatchEvent(new CustomEvent("PL2PlaceHolderProxy"));return}else h(a[0],"")&&console.debug(`[${f}]: Proxy set called for PowerLink Skeleton (target check and replace):`,a);return d(r,this,a)}}return Reflect.construct(t,e)}}),c.document.addEventListener("PL2AdvertContainer",()=>{setTimeout(()=>{let t=new Set([w]);t=new Set([...t,...[...t].flatMap(e=>[...e.querySelectorAll("*")])]),t=new Set([...t].filter(e=>u(getComputedStyle(e).getPropertyValue("border-bottom-width"))>=.5)),t=new Set([...t].filter(e=>u(getComputedStyle(e).getPropertyValue("border-left-width"))>=.5)),t=new Set([...t].filter(e=>u(getComputedStyle(e).getPropertyValue("border-right-width"))>=.5)),t=new Set([...t].filter(e=>u(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=u(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)}),c.document.addEventListener("PL2PlaceHolderMobile",()=>{setTimeout(()=>{let t=new Set([...c.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=>u(getComputedStyle(e).getPropertyValue("margin-bottom"))>15||u(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&&u(getComputedStyle(n).getPropertyValue("padding-top"))>=5&&u(getComputedStyle(n).getPropertyValue("padding-bottom"))>=5&&u(getComputedStyle(n).getPropertyValue("padding-left"))>=5&&u(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)}),c.document.addEventListener("PL2PlaceHolder",()=>{setTimeout(()=>{let t=new Set([...c.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=>u(getComputedStyle(e).getPropertyValue("padding-top"))>10||u(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=>u(getComputedStyle(e).getPropertyValue("border-bottom-width"))>=.5)),t=new Set([...t].filter(e=>u(getComputedStyle(e).getPropertyValue("border-left-width"))>=.5)),t=new Set([...t].filter(e=>u(getComputedStyle(e).getPropertyValue("border-right-width"))>=.5)),t=new Set([...t].filter(e=>u(getComputedStyle(e).getPropertyValue("border-top-width"))>=.5)),t=new Set([...t].filter(e=>u(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)}),c.document.addEventListener("PL2PlaceHolderProxy",()=>{setTimeout(()=>{let t=new Set([...c.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=>u(getComputedStyle(e).getPropertyValue("padding-top"))>=5&&u(getComputedStyle(e).getPropertyValue("padding-bottom"))>=5&&u(getComputedStyle(e).getPropertyValue("padding-left"))>=5&&u(getComputedStyle(e).getPropertyValue("padding-right"))>=5&&u(getComputedStyle(e).getPropertyValue("border-top-width"))>=.35&&u(getComputedStyle(e).getPropertyValue("border-bottom-width"))>=.35&&u(getComputedStyle(e).getPropertyValue("border-left-width"))>=.35&&u(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)})}M(T);})();
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
@@ -13,6 +13,7 @@ export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink'
13
13
  const OriginalReflectApply = BrowserWindow.Reflect.apply;
14
14
  const OriginalObjectDefineProperty = BrowserWindow.Object.defineProperty;
15
15
  const OriginalProxy = BrowserWindow.Proxy;
16
+ const OriginalObjectGetOwnPropertyDescriptor = BrowserWindow.Object.getOwnPropertyDescriptor;
16
17
  const PL2MajorFuncCallPatterns = [[
17
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]+/,
18
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 *+-]+/,
@@ -25,6 +26,8 @@ export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink'
25
26
  function PowerLinkElementFromArg(Arg) {
26
27
  if (typeof Arg !== 'object' || Arg === null)
27
28
  return null;
29
+ if (typeof OriginalReflectApply(OriginalObjectGetOwnPropertyDescriptor, BrowserWindow.Object, [Arg, '_'])?.get === 'function')
30
+ return null;
28
31
  const Visited = new Set();
29
32
  let Current = Arg['_'];
30
33
  while (typeof Current === 'object' && Current !== null) {
@@ -45,6 +48,8 @@ export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink'
45
48
  function PowerLinkRenderFromArg(Arg) {
46
49
  if (typeof Arg !== 'object' || Arg === null)
47
50
  return null;
51
+ if (typeof OriginalReflectApply(OriginalObjectGetOwnPropertyDescriptor, BrowserWindow.Object, [Arg, '_'])?.get === 'function')
52
+ return null;
48
53
  const Visited = new Set();
49
54
  let Current = Arg['_'];
50
55
  while (typeof Current === 'object' && Current !== null) {
@@ -61,6 +66,8 @@ export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink'
61
66
  function PowerLinkElementFromArgParent(Arg) {
62
67
  if (typeof Arg !== 'object' || Arg === null)
63
68
  return null;
69
+ if (typeof OriginalReflectApply(OriginalObjectGetOwnPropertyDescriptor, BrowserWindow.Object, [Arg, '_'])?.get === 'function')
70
+ return null;
64
71
  const Visited = new Set();
65
72
  let Current = Arg['_'];
66
73
  while (typeof Current === 'object' && Current !== null) {
@@ -127,10 +134,10 @@ export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink'
127
134
  BrowserWindow.Object.defineProperty = new Proxy(OriginalObjectDefineProperty, {
128
135
  apply(Target, ThisArg, Args) {
129
136
  // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
130
- let VuejsRenderer = PowerLinkRenderFromArg(Args[0]);
137
+ let VuejsRender = PowerLinkRenderFromArg(Args[0]);
131
138
  let PL2Element = PowerLinkElementFromArgParent(Args[0]);
132
- let Stringified = String(VuejsRenderer ?? '');
133
- if (VuejsRenderer !== null && PL2Element !== null && Stringified.length < 500 &&
139
+ let Stringified = String(VuejsRender ?? '');
140
+ if (VuejsRender !== null && PL2Element !== null && Stringified.length < 500 &&
134
141
  PL2MajorFuncCallPatterns.filter(Patterns => Patterns.filter(Pattern => Pattern.test(Stringified)).length === Patterns.length).length === 1 &&
135
142
  [...PL2Element.querySelectorAll('*')].filter(Child => {
136
143
  if (!(Child instanceof HTMLElement))
@@ -140,7 +147,7 @@ export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink'
140
147
  return PL2TitleHeight > 0 && PL2TitleMarginBottom >= PL2TitleHeight * (MinRatio - EpsilonRatio) && PL2TitleMarginBottom <= PL2TitleHeight * (MaxRatio + EpsilonRatio);
141
148
  }).length >= 1) {
142
149
  console.debug(`[${UserscriptName}]: Restoring renderer.call for detected PowerLink skeleton:`, Args[0]);
143
- VuejsRenderer.call = Function.prototype.call;
150
+ VuejsRender.call = Function.prototype.call;
144
151
  return;
145
152
  }
146
153
  return OriginalReflectApply(Target, ThisArg, Args);
@@ -167,6 +174,8 @@ export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink'
167
174
  function PowerLinkOverrideRenderFromArg(Arg, Override) {
168
175
  if (typeof Arg !== 'object' || Arg === null)
169
176
  return 1;
177
+ if (typeof OriginalReflectApply(OriginalObjectGetOwnPropertyDescriptor, BrowserWindow.Object, [Arg, '_'])?.get === 'function')
178
+ return null;
170
179
  const Visited = new Set();
171
180
  let Current = Arg['_'];
172
181
  while (typeof Current === 'object' && Current !== null) {
@@ -183,13 +192,116 @@ export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink'
183
192
  }
184
193
  return 3;
185
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
+ function ProxySetHandlerNewValueCheck(NewValue) {
253
+ let Stringified = String(NewValue);
254
+ return Stringified.includes('https://ader.naver.com/');
255
+ }
256
+ function ProxySetHandlerTargetCheck(Target) {
257
+ for (const PropertyName of Object.keys(Target)) {
258
+ const Value = Target[PropertyName];
259
+ const Descriptor = OriginalObjectGetOwnPropertyDescriptor(Target, PropertyName);
260
+ if (typeof Value === 'object' &&
261
+ Value !== null &&
262
+ typeof Descriptor?.get !== 'function') {
263
+ if (ProxySetHandlerTargetCheck(Value)) {
264
+ return true;
265
+ }
266
+ }
267
+ else if (typeof Value === 'string' &&
268
+ Value.includes('ader.naver.com')) {
269
+ return true;
270
+ }
271
+ }
272
+ return false;
273
+ }
274
+ function ProxySetHandlerTargetCheckAndReplace(Target, NewValue) {
275
+ const Record = Target;
276
+ for (const PropertyName of Object.keys(Record)) {
277
+ const Value = Record[PropertyName];
278
+ const Descriptor = OriginalObjectGetOwnPropertyDescriptor(Target, PropertyName);
279
+ if (typeof Value === 'object' &&
280
+ Value !== null &&
281
+ typeof Descriptor?.get !== 'function') {
282
+ if (ProxySetHandlerTargetCheckAndReplace(Value, NewValue)) {
283
+ return true;
284
+ }
285
+ }
286
+ else if (typeof Value === 'string' &&
287
+ Value.includes('ader.naver.com')) {
288
+ Record[PropertyName] = NewValue;
289
+ return true;
290
+ }
291
+ }
292
+ return false;
293
+ }
294
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
295
+ let VuejsPL2Render = new Set();
186
296
  BrowserWindow.Proxy = new Proxy(OriginalProxy, {
187
297
  construct(Target, Args) {
188
298
  // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
189
- let VuejsRenderer = PowerLinkRenderFromArg(Args[0]);
299
+ let VuejsRender = PowerLinkRenderFromArg(Args[0]);
300
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
301
+ let VuejsCtxSubtreeRender = PowerLinkVnodeTypeRenderFromArg(Args[0]);
190
302
  let PL2Element = PowerLinkElementFromArgParent(Args[0]);
191
- let Stringified = String(VuejsRenderer ?? '');
192
- if (VuejsRenderer !== null && PL2Element !== null && Stringified.length < 500 &&
303
+ let Stringified = String(VuejsRender ?? '');
304
+ if (VuejsRender !== null && PL2Element !== null && Stringified.length < 500 &&
193
305
  PL2MajorFuncCallPatterns.filter(Patterns => Patterns.filter(Pattern => Pattern.test(Stringified)).length === Patterns.length).length === 1 &&
194
306
  [...PL2Element.querySelectorAll('*')].filter(Child => {
195
307
  if (!(Child instanceof HTMLElement))
@@ -199,9 +311,35 @@ export function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'NamuLink'
199
311
  return PL2TitleHeight > 0 && PL2TitleMarginBottom >= PL2TitleHeight * (MinRatio - EpsilonRatio) && PL2TitleMarginBottom <= PL2TitleHeight * (MaxRatio + EpsilonRatio);
200
312
  }).length >= 1) {
201
313
  console.debug(`[${UserscriptName}]: Prevented declaring render function in Vue.js 3 for detected PowerLink skeleton:`, Args[0], PL2Element);
314
+ VuejsPL2Render.add(VuejsRender);
202
315
  PowerLinkOverrideRenderFromArg(Args[0], () => null);
203
316
  BrowserWindow.document.dispatchEvent(new CustomEvent('PL2PlaceHolderProxy'));
204
317
  }
318
+ else if (VuejsCtxSubtreeRender !== null && VuejsPL2Render.has(VuejsCtxSubtreeRender)) {
319
+ console.debug(`[${UserscriptName}]: Prevented declaring render function in Vue.js 3 in SPA moving for detected PowerLink skeleton:`, Args[0]);
320
+ PowerLinkOverrideVnodeTypeRenderOnlyFromArg(Args[0], () => null);
321
+ BrowserWindow.document.dispatchEvent(new CustomEvent('PL2PlaceHolderProxy'));
322
+ return Reflect.construct(Target, Args);
323
+ }
324
+ if (typeof Args[1].set === 'function') {
325
+ const OriginalSet = Args[1].set;
326
+ Args[1].set = function (...SetArgs) {
327
+ if (ProxySetHandlerNewValueCheck(SetArgs[2])) {
328
+ console.debug(`[${UserscriptName}]: Proxy set called for PowerLink Skeleton:`, SetArgs);
329
+ return;
330
+ }
331
+ if (ProxySetHandlerTargetCheck(SetArgs[0]) &&
332
+ Object.keys(SetArgs[0]).some(PropertyName => typeof SetArgs[0][PropertyName] !== 'undefined' && SetArgs[0][PropertyName] instanceof AbortController)) {
333
+ console.debug(`[${UserscriptName}]: Proxy set called for PowerLink Skeleton (target check):`, SetArgs);
334
+ BrowserWindow.document.dispatchEvent(new CustomEvent('PL2PlaceHolderProxy'));
335
+ return;
336
+ }
337
+ else if (ProxySetHandlerTargetCheckAndReplace(SetArgs[0], '')) {
338
+ console.debug(`[${UserscriptName}]: Proxy set called for PowerLink Skeleton (target check and replace):`, SetArgs);
339
+ }
340
+ return OriginalReflectApply(OriginalSet, this, SetArgs);
341
+ };
342
+ }
205
343
  return Reflect.construct(Target, Args);
206
344
  }
207
345
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@filteringdev/namulink",
3
- "version": "19.4.0",
3
+ "version": "19.6.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "scripts": {