@filteringdev/namulink 20.1.2 → 20.1.3

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 20.1.2
11
+ // @version 20.1.3
12
12
  // @author PiQuark6046 and contributors
13
13
  //
14
14
  // @grant unsafeWindow
@@ -22,7 +22,7 @@
22
22
  // ==/UserScript==
23
23
 
24
24
 
25
- (()=>{function y(e,r={}){let n=r.QuietMs??120,t=r.EventName??"vue:settled",a=r.ChangeEventName??"vue:dom-changed";if(!(e instanceof HTMLElement))throw new TypeError("TargetEl must be an HTMLElement");let u=-1,l=0,d=!1,m=performance.now(),o=i=>{e.dispatchEvent(new CustomEvent(a,{detail:{Seq:l,At:m,MutationCount:i.length,Mutations:i}}))},g=()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{d||e.dispatchEvent(new CustomEvent(t,{detail:{Seq:l,QuietMs:n,SettledAt:performance.now(),ElapsedSinceLastMutation:performance.now()-m,Target:e}}))})})},p=()=>{clearTimeout(u),u=setTimeout(g,n)},f=new MutationObserver(i=>{l+=1,m=performance.now(),o(i),p()});return f.observe(e,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),p(),{Disconnect(){d=!0,clearTimeout(u),f.disconnect(),e.dispatchEvent(new CustomEvent("vue:observer-disconnected",{detail:{Target:e}}))}}}function h(e,r=document.documentElement){return new Promise(n=>{let t=r.querySelector(e);if(t&&t instanceof HTMLElement){n(t);return}let a=new MutationObserver(()=>{let u=r.querySelector(e);u&&u instanceof HTMLElement&&(a.disconnect(),n(u))});a.observe(r,{subtree:!0,childList:!0,attributes:!0})})}function M(e){let r=e.trim();if(!r||r==="none")return null;let n=r.match(/^url\((.*)\)$/i);if(!n)return null;let t=n[1].trim();return(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))&&(t=t.slice(1,-1)),t}function E(e,r){let n=r;for(;n;){let t=e.getComputedStyle(n).backgroundColor;if(t&&t!=="transparent"&&t!=="rgba(0, 0, 0, 0)")return t;n=n.parentElement}return"rgb(255, 255, 255)"}function S(e,r,n){let t=new Set;function a(l){l&&(l==="transparent"||l==="rgba(0, 0, 0, 0)"||t.add(l))}a(n);let u=e.getComputedStyle(r);if(a(u.backgroundColor),a(u.color),a(e.getComputedStyle(e.document.documentElement).backgroundColor),e.document.body){let l=e.getComputedStyle(e.document.body);a(l.backgroundColor),a(l.color)}return a("rgb(255, 255, 255)"),a("rgb(0, 0, 0)"),[...t]}function L(e,r){if(r instanceof e.HTMLImageElement)return r.currentSrc||r.src||""||null;let n=e.getComputedStyle(r).backgroundImage;return M(n)}function T(e,r){let n=0,t=new Map;r.addEventListener("message",d=>{let m=d.data;if(!m||!("RequestId"in m))return;let o=t.get(m.RequestId);if(o){if(t.delete(m.RequestId),m.Kind==="detect-result"){o.Resolve(m.Result);return}o.Reject(new Error(m.Error))}});function a(d){let m=`ocr-${Date.now()}-${n++}`,o={Kind:"detect",RequestId:m,...d};return new Promise((g,p)=>{t.set(m,{Resolve:g,Reject:p}),r.postMessage(o)})}async function u(d,m){let o=L(e,d);if(!o)return null;let g=await C(e,d,o),p=E(e,d),f=S(e,d,p);return a({ImageData:g,BackgroundCandidates:f,FontCandidates:m?.FontCandidates,ScoreThreshold:m?.ScoreThreshold})}async function l(d){let m=await C(e,d.HostElement,d.SourceUrl),o=E(e,d.HostElement),g=S(e,d.HostElement,o);return a({ImageData:m,BackgroundCandidates:g,FontCandidates:d.FontCandidates,ScoreThreshold:d.ScoreThreshold})}return{DetectFromElement:u,DetectFromSource:l,Terminate(){for(let d of t.values())d.Reject(new Error("OCR worker terminated"));t.clear(),r.terminate()}}}function w(e){return/^data:image\/svg\+xml(?:[;,]|$)/i.test(e)}function P(e,r){let n=e.atob(r),t=new Uint8Array(n.length);for(let a=0;a<n.length;a++)t[a]=n.charCodeAt(a);return new TextDecoder().decode(t)}function R(e,r){let n=r.indexOf(",");if(n<0)throw new Error("Invalid SVG data URL");let t=r.slice(0,n).toLowerCase(),a=r.slice(n+1);return t.includes(";base64")?P(e,a):decodeURIComponent(a)}function F(e,r,n,t){let u=new e.DOMParser().parseFromString(r,"image/svg+xml");if(u.querySelector("parsererror"))throw new Error("Failed to parse SVG markup");let l=u.documentElement;if(!l||l.nodeName.toLowerCase()!=="svg")throw new Error("SVG root element not found");return l.getAttribute("xmlns")||l.setAttribute("xmlns","http://www.w3.org/2000/svg"),l.getAttribute("width")||l.setAttribute("width",String(n)),l.getAttribute("height")||l.setAttribute("height",String(t)),new e.XMLSerializer().serializeToString(u)}function H(e){return e.complete&&e.naturalWidth>0?Promise.resolve():new Promise((r,n)=>{function t(){e.removeEventListener("load",a),e.removeEventListener("error",u)}function a(){t(),r()}function u(){t(),n(new Error("Failed to load SVG image"))}e.addEventListener("load",a),e.addEventListener("error",u)})}async function x(e,r){let n=new e.Image;n.decoding="async",n.src=r;try{if(await n.decode(),n.naturalWidth>0)return n}catch{}return await H(n),n}function v(e){return typeof e=="string"&&/^image\/svg\+xml(?:\s*;|$)/i.test(e)}function D(e,r){let n=r.getBoundingClientRect(),t=Math.max(1,e.devicePixelRatio||1);return{Width:Math.max(1,Math.round((n.width||r.clientWidth||96)*t)),Height:Math.max(1,Math.round((n.height||r.clientHeight||32)*t))}}async function b(e,r,n){let{Width:t,Height:a}=D(e,r),u=F(e,n,t,a),l=e.URL.createObjectURL(new e.Blob([u],{type:"image/svg+xml"}));try{let d=await x(e,l),m=e.document.createElement("canvas");m.width=t,m.height=a;let o=m.getContext("2d",{willReadFrequently:!0});if(!o)throw new Error("2D context unavailable");return o.clearRect(0,0,t,a),o.drawImage(d,0,0,t,a),o.getImageData(0,0,t,a)}finally{e.URL.revokeObjectURL(l)}}async function k(e,r){let n=await e.createImageBitmap(r);try{let t=e.document.createElement("canvas");t.width=n.width,t.height=n.height;let a=t.getContext("2d",{willReadFrequently:!0});if(!a)throw new Error("2D context unavailable");return a.drawImage(n,0,0),a.getImageData(0,0,t.width,t.height)}finally{n.close()}}async function C(e,r,n){if(w(n)){let a=R(e,n);return await b(e,r,a)}let t=await new Promise((a,u)=>{GM.xmlHttpRequest({url:n,method:"GET",responseType:"blob",onload:l=>{if(l.status<200||l.status>=300){u(new Error(`Failed to fetch image: ${l.status} ${l.statusText}`));return}let d=l.response;if(!(d instanceof Blob)){u(new Error("Failed to fetch image: invalid blob response"));return}let m=l.responseHeaders.match(/^content-type:\s*(.+)$/im),o=m?m[1].trim():null;a({BlobData:d,ContentTypeHeader:o})},onerror:u,ontimeout:u})});if(v(t.BlobData.type)||v(t.ContentTypeHeader)){let a=await t.BlobData.text();return await b(e,r,a)}return await k(e,t.BlobData)}var I=typeof unsafeWindow<"u"?unsafeWindow:window;async function q(e,r="NamuLink"){let n=e.Reflect.apply,t=[[/\( *\) *=> *{ *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]+ *\) *\] *\(\) *;/]];e.setTimeout=new Proxy(e.setTimeout,{apply(o,g,p){let f=String(p[0]);return t.filter(i=>i.filter(c=>c.test(f)).length>=1).length===1?(console.debug(`[${r}]: setTimeout called for PowerLink Skeleton:`,p[0]),n(o,g,[()=>{},0])):n(o,g,p)}});let a=await h("#app",e.document);y(a,{QuietMs:250,EventName:"vue:settled",ChangeEventName:"vue:change"});let u=T(e,new Worker(URL.createObjectURL(new Blob(['(()=>{var b=["\\uD30C\\uC6CC\\uB9C1\\uD06C","\\uAD11\\uACE0","\\uAD11\\uACE0\\uB4F1\\uB85D"],k=["Pretendard JP, sans-serif","Pretendard, sans-serif","system-ui, sans-serif","Apple SD Gothic Neo, sans-serif","Nanum Gothic, sans-serif","Noto Sans KR, sans-serif","Arial, sans-serif"],H=new Map;function T(t,n){return new OffscreenCanvas(Math.max(1,Math.floor(t)),Math.max(1,Math.floor(n)))}function C(t){let n=t.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("2D context unavailable");return n}function Y(t){let n=C(t),{width:a,height:e}=t,r=n.getImageData(0,0,a,e).data,o=new Uint8ClampedArray(a*e);for(let i=0,s=0;i<r.length;i+=4,s++){let l=r[i],h=r[i+1],g=r[i+2];o[s]=Math.round(.299*l+.587*h+.114*g)}return{Width:a,Height:e,Data:o}}function A(t){let n=new Uint32Array(256);for(let l=0;l<t.Data.length;l++)n[t.Data[l]]++;let a=t.Data.length,e=0;for(let l=0;l<256;l++)e+=l*n[l];let r=0,o=0,i=-1,s=127;for(let l=0;l<256;l++){if(o+=n[l],o===0)continue;let h=a-o;if(h===0)break;r+=l*n[l];let g=r/o,d=(e-r)/h,c=o*h*(g-d)*(g-d);c>i&&(i=c,s=l)}return s}function M(t){let n=A(t),a=0,e=0;for(let i=0;i<t.Data.length;i++)t.Data[i]<n?a++:e++;let r=a<e,o=new Uint8Array(t.Width*t.Height);for(let i=0;i<t.Data.length;i++){let s=r?t.Data[i]<n:t.Data[i]>n;o[i]=s?1:0}return{Width:t.Width,Height:t.Height,Data:o}}function O(t){let n=new Uint8Array(t.Width*t.Height);for(let a=1;a<t.Height-1;a++)for(let e=1;e<t.Width-1;e++){let r=1;for(let o=-1;o<=1&&r;o++)for(let i=-1;i<=1;i++)if(t.Data[(a+o)*t.Width+(e+i)]===0){r=0;break}n[a*t.Width+e]=r}return{Width:t.Width,Height:t.Height,Data:n}}function w(t){let n=new Uint8Array(t.Width*t.Height);for(let a=1;a<t.Height-1;a++)for(let e=1;e<t.Width-1;e++){let r=0;for(let o=-1;o<=1&&!r;o++)for(let i=-1;i<=1;i++)if(t.Data[(a+o)*t.Width+(e+i)]===1){r=1;break}n[a*t.Width+e]=r}return{Width:t.Width,Height:t.Height,Data:n}}function N(t){return w(O(w(t)))}function v(t,n=20){let a=new Uint8Array(t.Width*t.Height),e=[],r=new Int32Array(t.Width*t.Height),o=new Int32Array(t.Width*t.Height);for(let i=0;i<t.Height;i++)for(let s=0;s<t.Width;s++){let l=i*t.Width+s;if(a[l]||t.Data[l]===0)continue;let h=0,g=0;r[g]=s,o[g]=i,g++,a[l]=1;let d=s,c=i,u=s,f=i,X=0;for(;h<g;){let m=r[h],D=o[h];h++,X++,m<d&&(d=m),D<c&&(c=D),m>u&&(u=m),D>f&&(f=D);for(let I=-1;I<=1;I++)for(let y=-1;y<=1;y++){if(y===0&&I===0)continue;let W=m+y,B=D+I;if(W<0||B<0||W>=t.Width||B>=t.Height)continue;let x=B*t.Width+W;a[x]||t.Data[x]===0||(a[x]=1,r[g]=W,o[g]=B,g++)}}X>=n&&e.push({X:d,Y:c,Width:u-d+1,Height:f-c+1})}return e}function U(t,n=8,a=4){let e=[...t],r=!0;function o(i,s){let l=i.X+i.Width,h=i.Y+i.Height,g=s.X+s.Width,d=s.Y+s.Height;return!(l+n<s.X||g+n<i.X||h+a<s.Y||d+a<i.Y)}for(;r;){r=!1;t:for(let i=0;i<e.length;i++)for(let s=i+1;s<e.length;s++){if(!o(e[i],e[s]))continue;let l=e[i],h=e[s];e[i]={X:Math.min(l.X,h.X),Y:Math.min(l.Y,h.Y),Width:Math.max(l.X+l.Width,h.X+h.Width)-Math.min(l.X,h.X),Height:Math.max(l.Y+l.Height,h.Y+h.Height)-Math.min(l.Y,h.Y)},e.splice(s,1),r=!0;break t}}return e}function R(t,n){let a=new Uint8Array(n.Width*n.Height);for(let e=0;e<n.Height;e++)for(let r=0;r<n.Width;r++)a[e*n.Width+r]=t.Data[(n.Y+e)*t.Width+(n.X+r)];return{Width:n.Width,Height:n.Height,Data:a}}function E(t){let n=t.Width,a=t.Height,e=-1,r=-1;for(let o=0;o<t.Height;o++)for(let i=0;i<t.Width;i++)t.Data[o*t.Width+i]!==0&&(i<n&&(n=i),o<a&&(a=o),i>e&&(e=i),o>r&&(r=o));return e<n||r<a?{Width:1,Height:1,Data:new Uint8Array([0])}:R(t,{X:n,Y:a,Width:e-n+1,Height:r-a+1})}function P(t,n,a){let e=new Uint8Array(n*a);for(let r=0;r<a;r++)for(let o=0;o<n;o++){let i=Math.min(t.Width-1,Math.floor(o/n*t.Width)),s=Math.min(t.Height-1,Math.floor(r/a*t.Height));e[r*n+o]=t.Data[s*t.Width+i]}return{Width:n,Height:a,Data:e}}function p(t,n=64){let a=E(t),e=Math.max(a.Width,a.Height),r=new Uint8Array(e*e),o=Math.floor((e-a.Width)/2),i=Math.floor((e-a.Height)/2);for(let s=0;s<a.Height;s++)for(let l=0;l<a.Width;l++)r[(s+i)*e+(l+o)]=a.Data[s*a.Width+l];return P({Width:e,Height:e,Data:r},n,n)}function F(t,n){if(t.Width!==n.Width||t.Height!==n.Height)throw new Error("Image size mismatch");let a=0;for(let e=0;e<t.Data.length;e++)t.Data[e]!==n.Data[e]&&a++;return a/t.Data.length}function K(t,n){let a=`${t}__${n}`,e=H.get(a);if(e)return e;let r=256,o=96,i=T(r,o),s=C(i);s.fillStyle="white",s.fillRect(0,0,r,o);let l=Math.floor(o*.72);for(;l>8;){s.clearRect(0,0,r,o),s.fillStyle="white",s.fillRect(0,0,r,o),s.fillStyle="black",s.textAlign="center",s.textBaseline="middle",s.font=`700 ${l}px ${n}`;let g=s.measureText(t),d=g.width,c=(g.actualBoundingBoxAscent||l*.8)+(g.actualBoundingBoxDescent||l*.2);if(d<=r*.9&&c<=o*.9){s.fillText(t,r/2,o/2);let u=Y(i),f=p(M(u));return H.set(a,f),f}l--}s.font=`700 12px ${n}`,s.fillStyle="black",s.textAlign="center",s.textBaseline="middle",s.fillText(t,r/2,o/2);let h=p(M(Y(i)));return H.set(a,h),h}function V(t,n,a){let e=p(t),r=Number.POSITIVE_INFINITY;for(let o of a){let i=K(n,o),s=F(e,i);s<r&&(r=s)}return r}function z(t){let n=v(t,16);return U(n,10,6).filter(e=>{if(e.Width<8||e.Height<8)return!1;let r=e.Width/e.Height;return r>.5&&r<12})}async function $(t){let a=q(t.ImageData)?t.BackgroundCandidates:t.BackgroundCandidates.slice(0,1),e=t.FontCandidates??k,r=t.ScoreThreshold??.32,o=null;for(let i of a){let s=_(t.ImageData,i),l=G(s),h=N(M(l)),g=z(h);if(g.length!==0)for(let d of g){let c=R(h,d);for(let u of b){let f=V(c,u,e);(!o||f<o.Score)&&(o={Label:u,Score:f,Box:d})}}}return!o||o.Score>r?null:o}function G(t){let{width:n,height:a,data:e}=t,r=new Uint8ClampedArray(n*a);for(let o=0,i=0;o<e.length;o+=4,i++){let s=e[o],l=e[o+1],h=e[o+2];r[i]=Math.round(.299*s+.587*l+.114*h)}return{Width:n,Height:a,Data:r}}function q(t){let n=t.data;for(let a=3;a<n.length;a+=4)if(n[a]<255)return!0;return!1}function _(t,n){let a=T(t.width,t.height),e=C(a);return e.fillStyle=n,e.fillRect(0,0,t.width,t.height),e.putImageData(t,0,0),e.getImageData(0,0,t.width,t.height)}self.addEventListener("message",t=>{(async()=>{let n=t.data;if(!(!n||n.Kind!=="detect"))try{let a=await $(n),e={Kind:"detect-result",RequestId:n.RequestId,Result:a};self.postMessage(e)}catch(a){let e=a instanceof Error?a.message:String(a),r={Kind:"detect-error",RequestId:n.RequestId,Error:e};self.postMessage(r)}})()});})();\n'],{type:"application/javascript"}))));async function l(o){let g=[];for(let p of o){let f=[...p.querySelectorAll("*")].filter(c=>c instanceof HTMLElement).filter(c=>c instanceof HTMLImageElement||getComputedStyle(c).backgroundImage!=="none").filter(c=>parseFloat(getComputedStyle(c).getPropertyValue("width"))>=5&&parseFloat(getComputedStyle(c).getPropertyValue("height"))>=5).filter(c=>parseFloat(getComputedStyle(c).getPropertyValue("width"))<=50&&parseFloat(getComputedStyle(c).getPropertyValue("height"))<=50),i=0;for(let c of f)if(await u.DetectFromElement(c,{ScoreThreshold:.32})!==null&&(i+=1),i>=1){g.push(p);break}}return g}function d(o){let g=new Set([o]);for(let p=0;;p++){let f=[...g][p].parentElement;if(f===null)break;g.add(f)}return g}a.addEventListener("vue:settled",async()=>{let o=[...document.querySelectorAll("#app div[class] div[class] ~ div[class]")].filter(i=>i instanceof HTMLElement);o=o.filter(i=>parseFloat(getComputedStyle(i).getPropertyValue("padding-top"))>=20||parseFloat(getComputedStyle(i).getPropertyValue("margin-top"))>=20||parseFloat(getComputedStyle(i).getPropertyValue("margin-bottom"))>=12.5),o=o.filter(i=>{let c=[...i.querySelectorAll("*")].filter(s=>s instanceof HTMLElement);return c.filter(s=>parseFloat(getComputedStyle(s).getPropertyValue("padding-top"))>=5&&parseFloat(getComputedStyle(s).getPropertyValue("border-bottom-width"))>=.1).length===1?!0:c.filter(s=>(s instanceof HTMLTableElement||s instanceof HTMLTableCellElement)&&parseFloat(getComputedStyle(s).getPropertyValue("padding-top"))>=5&&parseFloat(getComputedStyle(s).getPropertyValue("padding-bottom"))>=5).length>=2}),o=o.filter(i=>![...i.querySelectorAll("*")].filter(s=>s instanceof HTMLElement).some(s=>parseFloat(getComputedStyle(s).getPropertyValue("margin-bottom"))>=10&&parseFloat(getComputedStyle(s).getPropertyValue("padding-bottom"))>=1&&parseFloat(getComputedStyle(s).getPropertyValue("padding-top"))>=1&&parseFloat(getComputedStyle(s).getPropertyValue("border-top-width"))>=.25&&parseFloat(getComputedStyle(s).getPropertyValue("border-bottom-width"))>=.25)),o=o.filter(i=>{let c=[...i.querySelectorAll("*")].filter(s=>s instanceof HTMLElement);return c=c.filter(s=>parseFloat(getComputedStyle(s).getPropertyValue("padding-right"))>=10&&parseFloat(getComputedStyle(s).getPropertyValue("padding-bottom"))>=10),c=c.filter(s=>parseFloat(getComputedStyle(s).getPropertyValue("margin-left"))>=2.5),c.length===0}),o=await l(o),o.forEach(i=>o.push(...new Set([...i.querySelectorAll("*")].filter(c=>c instanceof HTMLElement)))),o=[...new Set(o)];let g=o.filter(i=>parseFloat(getComputedStyle(i).getPropertyValue("padding-left"))>=5&&parseFloat(getComputedStyle(i).getPropertyValue("border-right-width"))>=.1);console.debug(`[${r}] vue:settled RealTargeted`,g),g.forEach(i=>{i.style.setProperty("display","none","important")});let p=o.filter(i=>!(i instanceof HTMLElement)||!(i instanceof HTMLTableElement)?!1:[...i.querySelectorAll("*")].filter(s=>s instanceof HTMLElement).some(s=>parseFloat(getComputedStyle(s).getPropertyValue("padding-top"))>=5&&parseFloat(getComputedStyle(s).getPropertyValue("padding-bottom"))>=5));console.debug(`[${r}] vue:settled RealTabletTargeted`,p),p.forEach(i=>{i.style.setProperty("display","none","important")});let f=new Set([...g,...p]);f.forEach(i=>{[...d(i)].filter(s=>s.innerText.trim().length===0).forEach(s=>f.add(s))}),console.debug(`[${r}] vue:settled PlaceHolderCandidated`,f),[...f].forEach(i=>{i.style.setProperty("display","none","important")})}),["https://fonts.googleapis.com/css2?family=Nanum Gothic&display=swap"].forEach(o=>{let g=e.document.createElement("link");g.rel="stylesheet",g.href=o,e.document.head.appendChild(g)})}q(I);})();
25
+ (()=>{function v(e,r={}){let n=r.QuietMs??120,t=r.EventName??"vue:settled",a=r.ChangeEventName??"vue:dom-changed";if(!(e instanceof HTMLElement))throw new TypeError("TargetEl must be an HTMLElement");let c=-1,l=0,d=!1,u=performance.now(),g=i=>{e.dispatchEvent(new CustomEvent(a,{detail:{Seq:l,At:u,MutationCount:i.length,Mutations:i}}))},h=()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{d||e.dispatchEvent(new CustomEvent(t,{detail:{Seq:l,QuietMs:n,SettledAt:performance.now(),ElapsedSinceLastMutation:performance.now()-u,Target:e}}))})})},S=()=>{clearTimeout(c),c=setTimeout(h,n)},m=new MutationObserver(i=>{l+=1,u=performance.now(),g(i),i.length>=25&&S()});return m.observe(e,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),S(),{Disconnect(){d=!0,clearTimeout(c),m.disconnect(),e.dispatchEvent(new CustomEvent("vue:observer-disconnected",{detail:{Target:e}}))}}}function b(e,r=document.documentElement){return new Promise(n=>{let t=r.querySelector(e);if(t&&t instanceof HTMLElement){n(t);return}let a=new MutationObserver(()=>{let c=r.querySelector(e);c&&c instanceof HTMLElement&&(a.disconnect(),n(c))});a.observe(r,{subtree:!0,childList:!0,attributes:!0})})}function R(e){let r=e.trim();if(!r||r==="none")return null;let n=r.match(/^url\((.*)\)$/i);if(!n)return null;let t=n[1].trim();return(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))&&(t=t.slice(1,-1)),t}function C(e,r){let n=r;for(;n;){let t=e.getComputedStyle(n).backgroundColor;if(t&&t!=="transparent"&&t!=="rgba(0, 0, 0, 0)")return t;n=n.parentElement}return"rgb(255, 255, 255)"}function T(e,r,n){let t=new Set;function a(l){l&&(l==="transparent"||l==="rgba(0, 0, 0, 0)"||t.add(l))}a(n);let c=e.getComputedStyle(r);if(a(c.backgroundColor),a(c.color),a(e.getComputedStyle(e.document.documentElement).backgroundColor),e.document.body){let l=e.getComputedStyle(e.document.body);a(l.backgroundColor),a(l.color)}return a("rgb(255, 255, 255)"),a("rgb(0, 0, 0)"),[...t]}function H(e,r){if(r instanceof e.HTMLImageElement)return r.currentSrc||r.src||""||null;let n=e.getComputedStyle(r).backgroundImage;return R(n)}function P(e,r){let n=0,t=new Map;r.addEventListener("message",d=>{let u=d.data;if(!u||!("RequestId"in u))return;let g=t.get(u.RequestId);if(g){if(t.delete(u.RequestId),u.Kind==="detect-result"){g.Resolve(u.Result);return}g.Reject(new Error(u.Error))}});function a(d){let u=`ocr-${Date.now()}-${n++}`,g={Kind:"detect",RequestId:u,...d};return new Promise((h,S)=>{t.set(u,{Resolve:h,Reject:S}),r.postMessage(g)})}async function c(d,u){let g=H(e,d);if(!g)return null;let h=await w(e,d,g),S=C(e,d),m=T(e,d,S);return a({ImageData:h,BackgroundCandidates:m,FontCandidates:u?.FontCandidates,ScoreThreshold:u?.ScoreThreshold})}async function l(d){let u=await w(e,d.HostElement,d.SourceUrl),g=C(e,d.HostElement),h=T(e,d.HostElement,g);return a({ImageData:u,BackgroundCandidates:h,FontCandidates:d.FontCandidates,ScoreThreshold:d.ScoreThreshold})}return{DetectFromElement:c,DetectFromSource:l,Terminate(){for(let d of t.values())d.Reject(new Error("OCR worker terminated"));t.clear(),r.terminate()}}}function F(e){return/^data:image\/svg\+xml(?:[;,]|$)/i.test(e)}function x(e,r){let n=e.atob(r),t=new Uint8Array(n.length);for(let a=0;a<n.length;a++)t[a]=n.charCodeAt(a);return new TextDecoder().decode(t)}function D(e,r){let n=r.indexOf(",");if(n<0)throw new Error("Invalid SVG data URL");let t=r.slice(0,n).toLowerCase(),a=r.slice(n+1);return t.includes(";base64")?x(e,a):decodeURIComponent(a)}function k(e,r,n,t){let c=new e.DOMParser().parseFromString(r,"image/svg+xml");if(c.querySelector("parsererror"))throw new Error("Failed to parse SVG markup");let l=c.documentElement;if(!l||l.nodeName.toLowerCase()!=="svg")throw new Error("SVG root element not found");return l.getAttribute("xmlns")||l.setAttribute("xmlns","http://www.w3.org/2000/svg"),l.getAttribute("width")||l.setAttribute("width",String(n)),l.getAttribute("height")||l.setAttribute("height",String(t)),new e.XMLSerializer().serializeToString(c)}function I(e){return e.complete&&e.naturalWidth>0?Promise.resolve():new Promise((r,n)=>{function t(){e.removeEventListener("load",a),e.removeEventListener("error",c)}function a(){t(),r()}function c(){t(),n(new Error("Failed to load SVG image"))}e.addEventListener("load",a),e.addEventListener("error",c)})}async function q(e,r){let n=new e.Image;n.decoding="async",n.src=r;try{if(await n.decode(),n.naturalWidth>0)return n}catch{}return await I(n),n}function M(e){return typeof e=="string"&&/^image\/svg\+xml(?:\s*;|$)/i.test(e)}function A(e,r){let n=r.getBoundingClientRect(),t=Math.max(1,e.devicePixelRatio||1);return{Width:Math.max(1,Math.round((n.width||r.clientWidth||96)*t)),Height:Math.max(1,Math.round((n.height||r.clientHeight||32)*t))}}async function L(e,r,n){let{Width:t,Height:a}=A(e,r),c=k(e,n,t,a),l=e.URL.createObjectURL(new e.Blob([c],{type:"image/svg+xml"}));try{let d=await q(e,l),u=e.document.createElement("canvas");u.width=t,u.height=a;let g=u.getContext("2d",{willReadFrequently:!0});if(!g)throw new Error("2D context unavailable");return g.clearRect(0,0,t,a),g.drawImage(d,0,0,t,a),g.getImageData(0,0,t,a)}finally{e.URL.revokeObjectURL(l)}}async function V(e,r){let n=await e.createImageBitmap(r);try{let t=e.document.createElement("canvas");t.width=n.width,t.height=n.height;let a=t.getContext("2d",{willReadFrequently:!0});if(!a)throw new Error("2D context unavailable");return a.drawImage(n,0,0),a.getImageData(0,0,t.width,t.height)}finally{n.close()}}async function w(e,r,n){if(F(n)){let a=D(e,n);return await L(e,r,a)}let t=await new Promise((a,c)=>{GM.xmlHttpRequest({url:n,method:"GET",responseType:"blob",onload:l=>{if(l.status<200||l.status>=300){c(new Error(`Failed to fetch image: ${l.status} ${l.statusText}`));return}let d=l.response;if(!(d instanceof Blob)){c(new Error("Failed to fetch image: invalid blob response"));return}let u=l.responseHeaders.match(/^content-type:\s*(.+)$/im),g=u?u[1].trim():null;a({BlobData:d,ContentTypeHeader:g})},onerror:c,ontimeout:c})});if(M(t.BlobData.type)||M(t.ContentTypeHeader)){let a=await t.BlobData.text();return await L(e,r,a)}return await V(e,t.BlobData)}var _=typeof unsafeWindow<"u"?unsafeWindow:window;async function O(e,r="NamuLink"){let n=e.Reflect.apply,t=[[/\( *\) *=> *{ *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]+ *\) *\] *\(\) *;/]];e.setTimeout=new Proxy(e.setTimeout,{apply(m,i,f){let y=String(f[0]);return t.filter(E=>E.filter(o=>o.test(y)).length>=1).length===1?(console.debug(`[${r}]: setTimeout called for PowerLink Skeleton:`,f[0]),n(m,i,[()=>{},0])):n(m,i,f)}});let a=await b("#app",e.document);v(a,{QuietMs:75,EventName:"vue:settled",ChangeEventName:"vue:change"});let d=P(e,new Worker(URL.createObjectURL(new Blob(['(()=>{var b=["\\uD30C\\uC6CC\\uB9C1\\uD06C","\\uAD11\\uACE0","\\uAD11\\uACE0\\uB4F1\\uB85D"],k=["Pretendard JP, sans-serif","Pretendard, sans-serif","system-ui, sans-serif","Apple SD Gothic Neo, sans-serif","Nanum Gothic, sans-serif","Noto Sans KR, sans-serif","Arial, sans-serif"],H=new Map;function T(t,n){return new OffscreenCanvas(Math.max(1,Math.floor(t)),Math.max(1,Math.floor(n)))}function C(t){let n=t.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("2D context unavailable");return n}function Y(t){let n=C(t),{width:a,height:e}=t,r=n.getImageData(0,0,a,e).data,o=new Uint8ClampedArray(a*e);for(let i=0,s=0;i<r.length;i+=4,s++){let l=r[i],h=r[i+1],g=r[i+2];o[s]=Math.round(.299*l+.587*h+.114*g)}return{Width:a,Height:e,Data:o}}function A(t){let n=new Uint32Array(256);for(let l=0;l<t.Data.length;l++)n[t.Data[l]]++;let a=t.Data.length,e=0;for(let l=0;l<256;l++)e+=l*n[l];let r=0,o=0,i=-1,s=127;for(let l=0;l<256;l++){if(o+=n[l],o===0)continue;let h=a-o;if(h===0)break;r+=l*n[l];let g=r/o,d=(e-r)/h,c=o*h*(g-d)*(g-d);c>i&&(i=c,s=l)}return s}function M(t){let n=A(t),a=0,e=0;for(let i=0;i<t.Data.length;i++)t.Data[i]<n?a++:e++;let r=a<e,o=new Uint8Array(t.Width*t.Height);for(let i=0;i<t.Data.length;i++){let s=r?t.Data[i]<n:t.Data[i]>n;o[i]=s?1:0}return{Width:t.Width,Height:t.Height,Data:o}}function O(t){let n=new Uint8Array(t.Width*t.Height);for(let a=1;a<t.Height-1;a++)for(let e=1;e<t.Width-1;e++){let r=1;for(let o=-1;o<=1&&r;o++)for(let i=-1;i<=1;i++)if(t.Data[(a+o)*t.Width+(e+i)]===0){r=0;break}n[a*t.Width+e]=r}return{Width:t.Width,Height:t.Height,Data:n}}function w(t){let n=new Uint8Array(t.Width*t.Height);for(let a=1;a<t.Height-1;a++)for(let e=1;e<t.Width-1;e++){let r=0;for(let o=-1;o<=1&&!r;o++)for(let i=-1;i<=1;i++)if(t.Data[(a+o)*t.Width+(e+i)]===1){r=1;break}n[a*t.Width+e]=r}return{Width:t.Width,Height:t.Height,Data:n}}function N(t){return w(O(w(t)))}function v(t,n=20){let a=new Uint8Array(t.Width*t.Height),e=[],r=new Int32Array(t.Width*t.Height),o=new Int32Array(t.Width*t.Height);for(let i=0;i<t.Height;i++)for(let s=0;s<t.Width;s++){let l=i*t.Width+s;if(a[l]||t.Data[l]===0)continue;let h=0,g=0;r[g]=s,o[g]=i,g++,a[l]=1;let d=s,c=i,u=s,f=i,X=0;for(;h<g;){let m=r[h],D=o[h];h++,X++,m<d&&(d=m),D<c&&(c=D),m>u&&(u=m),D>f&&(f=D);for(let I=-1;I<=1;I++)for(let y=-1;y<=1;y++){if(y===0&&I===0)continue;let W=m+y,B=D+I;if(W<0||B<0||W>=t.Width||B>=t.Height)continue;let x=B*t.Width+W;a[x]||t.Data[x]===0||(a[x]=1,r[g]=W,o[g]=B,g++)}}X>=n&&e.push({X:d,Y:c,Width:u-d+1,Height:f-c+1})}return e}function U(t,n=8,a=4){let e=[...t],r=!0;function o(i,s){let l=i.X+i.Width,h=i.Y+i.Height,g=s.X+s.Width,d=s.Y+s.Height;return!(l+n<s.X||g+n<i.X||h+a<s.Y||d+a<i.Y)}for(;r;){r=!1;t:for(let i=0;i<e.length;i++)for(let s=i+1;s<e.length;s++){if(!o(e[i],e[s]))continue;let l=e[i],h=e[s];e[i]={X:Math.min(l.X,h.X),Y:Math.min(l.Y,h.Y),Width:Math.max(l.X+l.Width,h.X+h.Width)-Math.min(l.X,h.X),Height:Math.max(l.Y+l.Height,h.Y+h.Height)-Math.min(l.Y,h.Y)},e.splice(s,1),r=!0;break t}}return e}function R(t,n){let a=new Uint8Array(n.Width*n.Height);for(let e=0;e<n.Height;e++)for(let r=0;r<n.Width;r++)a[e*n.Width+r]=t.Data[(n.Y+e)*t.Width+(n.X+r)];return{Width:n.Width,Height:n.Height,Data:a}}function E(t){let n=t.Width,a=t.Height,e=-1,r=-1;for(let o=0;o<t.Height;o++)for(let i=0;i<t.Width;i++)t.Data[o*t.Width+i]!==0&&(i<n&&(n=i),o<a&&(a=o),i>e&&(e=i),o>r&&(r=o));return e<n||r<a?{Width:1,Height:1,Data:new Uint8Array([0])}:R(t,{X:n,Y:a,Width:e-n+1,Height:r-a+1})}function P(t,n,a){let e=new Uint8Array(n*a);for(let r=0;r<a;r++)for(let o=0;o<n;o++){let i=Math.min(t.Width-1,Math.floor(o/n*t.Width)),s=Math.min(t.Height-1,Math.floor(r/a*t.Height));e[r*n+o]=t.Data[s*t.Width+i]}return{Width:n,Height:a,Data:e}}function p(t,n=64){let a=E(t),e=Math.max(a.Width,a.Height),r=new Uint8Array(e*e),o=Math.floor((e-a.Width)/2),i=Math.floor((e-a.Height)/2);for(let s=0;s<a.Height;s++)for(let l=0;l<a.Width;l++)r[(s+i)*e+(l+o)]=a.Data[s*a.Width+l];return P({Width:e,Height:e,Data:r},n,n)}function F(t,n){if(t.Width!==n.Width||t.Height!==n.Height)throw new Error("Image size mismatch");let a=0;for(let e=0;e<t.Data.length;e++)t.Data[e]!==n.Data[e]&&a++;return a/t.Data.length}function K(t,n){let a=`${t}__${n}`,e=H.get(a);if(e)return e;let r=256,o=96,i=T(r,o),s=C(i);s.fillStyle="white",s.fillRect(0,0,r,o);let l=Math.floor(o*.72);for(;l>8;){s.clearRect(0,0,r,o),s.fillStyle="white",s.fillRect(0,0,r,o),s.fillStyle="black",s.textAlign="center",s.textBaseline="middle",s.font=`700 ${l}px ${n}`;let g=s.measureText(t),d=g.width,c=(g.actualBoundingBoxAscent||l*.8)+(g.actualBoundingBoxDescent||l*.2);if(d<=r*.9&&c<=o*.9){s.fillText(t,r/2,o/2);let u=Y(i),f=p(M(u));return H.set(a,f),f}l--}s.font=`700 12px ${n}`,s.fillStyle="black",s.textAlign="center",s.textBaseline="middle",s.fillText(t,r/2,o/2);let h=p(M(Y(i)));return H.set(a,h),h}function V(t,n,a){let e=p(t),r=Number.POSITIVE_INFINITY;for(let o of a){let i=K(n,o),s=F(e,i);s<r&&(r=s)}return r}function z(t){let n=v(t,16);return U(n,10,6).filter(e=>{if(e.Width<8||e.Height<8)return!1;let r=e.Width/e.Height;return r>.5&&r<12})}async function $(t){let a=q(t.ImageData)?t.BackgroundCandidates:t.BackgroundCandidates.slice(0,1),e=t.FontCandidates??k,r=t.ScoreThreshold??.32,o=null;for(let i of a){let s=_(t.ImageData,i),l=G(s),h=N(M(l)),g=z(h);if(g.length!==0)for(let d of g){let c=R(h,d);for(let u of b){let f=V(c,u,e);(!o||f<o.Score)&&(o={Label:u,Score:f,Box:d})}}}return!o||o.Score>r?null:o}function G(t){let{width:n,height:a,data:e}=t,r=new Uint8ClampedArray(n*a);for(let o=0,i=0;o<e.length;o+=4,i++){let s=e[o],l=e[o+1],h=e[o+2];r[i]=Math.round(.299*s+.587*l+.114*h)}return{Width:n,Height:a,Data:r}}function q(t){let n=t.data;for(let a=3;a<n.length;a+=4)if(n[a]<255)return!0;return!1}function _(t,n){let a=T(t.width,t.height),e=C(a);return e.fillStyle=n,e.fillRect(0,0,t.width,t.height),e.putImageData(t,0,0),e.getImageData(0,0,t.width,t.height)}self.addEventListener("message",t=>{(async()=>{let n=t.data;if(!(!n||n.Kind!=="detect"))try{let a=await $(n),e={Kind:"detect-result",RequestId:n.RequestId,Result:a};self.postMessage(e)}catch(a){let e=a instanceof Error?a.message:String(a),r={Kind:"detect-error",RequestId:n.RequestId,Error:e};self.postMessage(r)}})()});})();\n'],{type:"application/javascript"}))));async function u(m){let i=[];for(let f of m){let y=[...f.querySelectorAll("*")].filter(o=>o instanceof HTMLElement).filter(o=>o instanceof HTMLImageElement||getComputedStyle(o).backgroundImage!=="none").filter(o=>parseFloat(getComputedStyle(o).getPropertyValue("width"))>=5&&parseFloat(getComputedStyle(o).getPropertyValue("height"))>=5).filter(o=>parseFloat(getComputedStyle(o).getPropertyValue("width"))<=50&&parseFloat(getComputedStyle(o).getPropertyValue("height"))<=50),E=0;for(let o of y)if(await d.DetectFromElement(o,{ScoreThreshold:.32})!==null&&(E+=1),E>=1){i.push(f);break}}return i}function g(m){let i=new Set([m]);for(let f=0;;f++){let y=[...i][f].parentElement;if(y===null)break;i.add(y)}return i}async function h(m){let i=[...document.querySelectorAll("#app div[class] div[class] ~ div[class]")].filter(o=>o instanceof HTMLElement);i=i.filter(o=>parseFloat(getComputedStyle(o).getPropertyValue("padding-top"))>=20||parseFloat(getComputedStyle(o).getPropertyValue("margin-top"))>=20||parseFloat(getComputedStyle(o).getPropertyValue("margin-bottom"))>=12.5),i=i.filter(o=>{let p=[...o.querySelectorAll("*")].filter(s=>s instanceof HTMLElement);return p.filter(s=>parseFloat(getComputedStyle(s).getPropertyValue("padding-top"))>=5&&parseFloat(getComputedStyle(s).getPropertyValue("border-bottom-width"))>=.1).length===1?!0:p.filter(s=>(s instanceof HTMLTableElement||s instanceof HTMLTableCellElement)&&parseFloat(getComputedStyle(s).getPropertyValue("padding-top"))>=5&&parseFloat(getComputedStyle(s).getPropertyValue("padding-bottom"))>=5).length>=2}),i=i.filter(o=>![...o.querySelectorAll("*")].filter(s=>s instanceof HTMLElement).some(s=>parseFloat(getComputedStyle(s).getPropertyValue("margin-bottom"))>=10&&parseFloat(getComputedStyle(s).getPropertyValue("padding-bottom"))>=1&&parseFloat(getComputedStyle(s).getPropertyValue("padding-top"))>=1&&parseFloat(getComputedStyle(s).getPropertyValue("border-top-width"))>=.25&&parseFloat(getComputedStyle(s).getPropertyValue("border-bottom-width"))>=.25)),i=i.filter(o=>{let p=[...o.querySelectorAll("*")].filter(s=>s instanceof HTMLElement);return p=p.filter(s=>parseFloat(getComputedStyle(s).getPropertyValue("padding-right"))>=10&&parseFloat(getComputedStyle(s).getPropertyValue("padding-bottom"))>=10),p=p.filter(s=>parseFloat(getComputedStyle(s).getPropertyValue("margin-left"))>=2.5),p.length===0}),i=await u(i),i.forEach(o=>i.push(...new Set([...o.querySelectorAll("*")].filter(p=>p instanceof HTMLElement)))),i=[...new Set(i)];let f=i.filter(o=>parseFloat(getComputedStyle(o).getPropertyValue("padding-left"))>=5&&parseFloat(getComputedStyle(o).getPropertyValue("border-right-width"))>=.1);console.debug(`[${r}] ${m.type} RealTargeted`,f,m),f.forEach(o=>{o.style.setProperty("display","none","important")});let y=i.filter(o=>!(o instanceof HTMLElement)||!(o instanceof HTMLTableElement)?!1:[...o.querySelectorAll("*")].filter(s=>s instanceof HTMLElement).some(s=>parseFloat(getComputedStyle(s).getPropertyValue("padding-top"))>=5&&parseFloat(getComputedStyle(s).getPropertyValue("padding-bottom"))>=5));console.debug(`[${r}] ${m.type} RealTabletTargeted`,y,m),y.forEach(o=>{o.style.setProperty("display","none","important")});let E=new Set([...f,...y]);E.forEach(o=>{[...g(o)].filter(s=>s.innerText.trim().length===0).forEach(s=>E.add(s))}),console.debug(`[${r}] ${m.type} PlaceHolderCandidated`,E,m),[...E].forEach(o=>{o.style.setProperty("display","none","important")})}a.addEventListener("vue:settled",m=>h(m)),["https://fonts.googleapis.com/css2?family=Nanum Gothic&display=swap"].forEach(m=>{let i=e.document.createElement("link");i.rel="stylesheet",i.href=m,e.document.head.appendChild(i)})}O(_);})();
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
@@ -31,10 +31,12 @@ export async function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'Nam
31
31
  }
32
32
  });
33
33
  const ArticleHTMLElement = await WaitForElement('#app', BrowserWindow.document);
34
+ const EventName = 'vue:settled';
35
+ const ChangeEventName = 'vue:change';
34
36
  AttachVueSettledEvents(ArticleHTMLElement, {
35
- QuietMs: 250,
36
- EventName: 'vue:settled',
37
- ChangeEventName: 'vue:change'
37
+ QuietMs: 75,
38
+ EventName: EventName,
39
+ ChangeEventName: ChangeEventName
38
40
  });
39
41
  const OCRInstance = CreateOcrWorkerClient(BrowserWindow, new Worker(URL.createObjectURL(new Blob([__OCR_WORKER_CODE__], { type: 'application/javascript' }))));
40
42
  async function ExecuteOCR(Targeted) {
@@ -72,7 +74,7 @@ export async function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'Nam
72
74
  }
73
75
  return SetHTMLElement;
74
76
  }
75
- ArticleHTMLElement.addEventListener('vue:settled', async () => {
77
+ async function Handler(EventParameter) {
76
78
  let Targeted = [...document.querySelectorAll('#app div[class] div[class] ~ div[class]')].filter(Ele => Ele instanceof HTMLElement);
77
79
  Targeted = Targeted.filter(Ele => parseFloat(getComputedStyle(Ele).getPropertyValue('padding-top')) >= 20 ||
78
80
  parseFloat(getComputedStyle(Ele).getPropertyValue('margin-top')) >= 20 ||
@@ -104,7 +106,7 @@ export async function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'Nam
104
106
  Targeted.forEach(Ele => Targeted.push(...new Set([...Ele.querySelectorAll('*')].filter(Child => Child instanceof HTMLElement))));
105
107
  Targeted = [...new Set(Targeted)];
106
108
  let RealTargeted = Targeted.filter(Ele => parseFloat(getComputedStyle(Ele).getPropertyValue('padding-left')) >= 5 && parseFloat(getComputedStyle(Ele).getPropertyValue('border-right-width')) >= 0.1);
107
- console.debug(`[${UserscriptName}] vue:settled RealTargeted`, RealTargeted);
109
+ console.debug(`[${UserscriptName}] ${EventParameter.type} RealTargeted`, RealTargeted, EventParameter);
108
110
  RealTargeted.forEach(Ele => {
109
111
  Ele.style.setProperty('display', 'none', 'important');
110
112
  });
@@ -114,7 +116,7 @@ export async function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'Nam
114
116
  let Children = [...Ele.querySelectorAll('*')].filter(Child => Child instanceof HTMLElement);
115
117
  return Children.some(Child => parseFloat(getComputedStyle(Child).getPropertyValue('padding-top')) >= 5 && parseFloat(getComputedStyle(Child).getPropertyValue('padding-bottom')) >= 5);
116
118
  });
117
- console.debug(`[${UserscriptName}] vue:settled RealTabletTargeted`, RealTabletTargeted);
119
+ console.debug(`[${UserscriptName}] ${EventParameter.type} RealTabletTargeted`, RealTabletTargeted, EventParameter);
118
120
  RealTabletTargeted.forEach(Ele => {
119
121
  Ele.style.setProperty('display', 'none', 'important');
120
122
  });
@@ -124,11 +126,12 @@ export async function RunNamuLinkUserscript(BrowserWindow, UserscriptName = 'Nam
124
126
  let Parents = [...AllParents(PlaceHolder)].filter(Ele => Ele.innerText.trim().length === 0);
125
127
  Parents.forEach(Ele => PlaceHolderCandidated.add(Ele));
126
128
  });
127
- console.debug(`[${UserscriptName}] vue:settled PlaceHolderCandidated`, PlaceHolderCandidated);
129
+ console.debug(`[${UserscriptName}] ${EventParameter.type} PlaceHolderCandidated`, PlaceHolderCandidated, EventParameter);
128
130
  [...PlaceHolderCandidated].forEach(Ele => {
129
131
  Ele.style.setProperty('display', 'none', 'important');
130
132
  });
131
- });
133
+ }
134
+ ArticleHTMLElement.addEventListener('vue:settled', (EventParameter) => Handler(EventParameter));
132
135
  // init Naver Nanum fonts
133
136
  const FontAddr = [
134
137
  'https://fonts.googleapis.com/css2?family=Nanum Gothic&display=swap',
@@ -45,7 +45,9 @@ export function AttachVueSettledEvents(TargetEl, Options = {}) {
45
45
  Seq += 1;
46
46
  LastMutationAt = performance.now();
47
47
  EmitChange(Mutations);
48
- ArmSettledTimer();
48
+ if (Mutations.length >= 25) {
49
+ ArmSettledTimer();
50
+ }
49
51
  });
50
52
  Observer.observe(TargetEl, {
51
53
  subtree: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@filteringdev/namulink",
3
- "version": "20.1.2",
3
+ "version": "20.1.3",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "scripts": {