trackkun-dom 1.8.0 → 1.8.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/webview.js +1 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "trackkun-dom",
3
3
  "author": "endyquang",
4
- "version": "1.8.0",
4
+ "version": "1.8.1",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Trkun DOM parser",
7
7
  "main": "index.js",
package/webview.js CHANGED
@@ -1 +1 @@
1
- (function(){"use strict";function k(e,n){let t;return()=>{t&&clearTimeout(t),t=setTimeout(()=>{e(),t=void 0},n)}}function p(e){return e.title==="Just a moment..."||e.title==="Access denied"||e.title=="Attention Required! | Cloudflare"||!!e.querySelector('body.no-js #challenge-running, body.no-js noscript, link[href$="/styles/challenges.css"]')}async function L({addListener:e,removeListener:n,transform:t,filter:o,handler:i,onTimeout:r,timeout:a,once:s}){return new Promise(c=>{e(v);const d=()=>s===!0&&n(v),g=a?setTimeout(()=>{d(),c(void 0),r?.()},a):void 0;async function v(l,...b){l=t?t(l):l,l!==void 0&&(!o||o(l,...b))&&(d(),c(l),i?.(l,...b),g&&clearTimeout(g))}})}async function T(e){return(await L({addListener:n=>window.addEventListener("message",n),removeListener:n=>window.removeEventListener("message",n),...e}))?.data}function C({event:e,filter:n,handler:t,senderWindow:o,targetOrigin:i}){T({filter:r=>r.data?.event===e&&!!r.data?.reqId&&(!n||n(r)),handler:async r=>{const a=await t?.(r);(o||window).postMessage({resId:r.data.reqId,result:a},i??"*")}})}async function m(e,n,t){const o=await t(()=>{e=0});if(o!==void 0)return o;if(!(e<=0))return await new Promise(i=>{setTimeout(async()=>{const r=await m(e-1,n,t);i(r)},n)})}function E(){const e={delay:{loading:!0}};let n=location.pathname,t={...e};async function o(i,r){if(!r.headers.get("Content-Type")?.includes("application/json")){delete t[i];return}t[i]={res:r.clone()}}window.fetch=new Proxy(window.fetch,{apply:async(i,r,a)=>{n!==location.pathname&&(n=location.pathname,t={...e});const[s,c]=a;return c?.method&&c.method.toLowerCase?.()!=="get"?await i.apply(r,a):(t[s]={loading:!0},delete t.delay,await i.apply(r,[s,c]).then(d=>(o(s,d),d)).catch(d=>{throw delete t[s],d}))}}),C({event:"tk:fetchResult",async handler(i){if(i.origin!==location.origin)return;const{baseUrl:r,segments:a}=i.data.args||{};return!Array.isArray(a)||typeof r!="string"?void 0:await A(()=>t,r,a.filter(s=>typeof s=="string"||typeof s?.isAny=="boolean"))}})}function H(e,n,t){const o=Object.keys(e).find(i=>M(i,n,t));return o?{url:o,result:e[o]}:void 0}function M(e,n,t){const o=e.replace(location.origin,""),i=n.replace(location.origin,"");if(!o.startsWith(i))return!1;const r=o.replace(i,"").split("?")[0].split("#")[0].split("/").filter(Boolean);return r.length===t.length&&t.every((a,s)=>a?.isAny||a===r[s])}function A(e,n,t){let o=15;return m(150,100,async i=>{const r=H(e(),n,t);if(!r){const s=Object.values(e());!(!s.length||s.some(c=>c.loading))&&!--o&&i();return}const a=await _(r.result);return a?{url:r.url,value:a}:void 0})}async function _(e){const{res:n,parsed:t,loading:o}=e;if(!o)return e.parsed=t??await n?.json().catch(async()=>JSON.parse(await n.text())).catch(()=>{}),delete e.res,e.parsed}const I=!navigator.userAgent.toLowerCase().includes("android"),S=location.hostname.includes("mangafire");let w;window.top===window&&(O(),j(),D(),E(),q());function j(){let e=!1,n=0;const t=()=>{if(!(e||p(document)))if(e=!0,n++,location.protocol==="chrome-error:")u("tk:error",document.title),document.body.style.setProperty("display","none");else{const o=h();u("tk:DOMContentLoaded",{isDocTransparent:o}),o&&W()}};document.addEventListener("DOMContentLoaded",t),document.addEventListener("readystatechange",o=>{o.target.readyState!=="loading"?t():n<=1&&(e=!1)})}function D(){e(()=>!p(document)&&u("tk:spaNav"));function e(n){let t=location.pathname;const o=k(()=>{t!==location.pathname&&(window.webkit&&(w=window.webkit,window.webkit=void 0),t=location.pathname,n())},50),i=(r,a,s)=>(o(),r.apply(a,s));window.addEventListener("popstate",o),window.history.pushState=new Proxy(window.history.pushState,{apply:i}),window.history.replaceState=new Proxy(window.history.replaceState,{apply:i})}}function O(){if(!I||!S)return P();window.addEventListener("DOMContentLoaded",()=>{w=window.webkit,window.webkit=void 0,window.flutter_inappwebview.callHandler=function(...e){const n=window._flutter_inappwebview_windowId,t=setTimeout(function(){});return w?.messageHandlers.callHandler.postMessage({handlerName:e[0],_callHandlerID:t,args:JSON.stringify(Array.prototype.slice.call(e,1)),_windowId:n}),new Promise(function(o,i){window.flutter_inappwebview[t]={resolve:o,reject:i}})}})}function P(){let e=window.webkit,n=0;const t=setInterval(()=>{if(e===window.webkit){++n>=300&&clearInterval(t);return}e===void 0||typeof window.webkit=="object"?(n=0,e=window.webkit):window.webkit=e},10)}function W(){let e=0;const n=setInterval(()=>{if(e++,e===10){clearInterval(n);return}h()||(clearInterval(n),u("tk:transparentChanged",!1))},200)}function h(){return y(document.documentElement)&&y(document.body)}function y(e){const n=getComputedStyle(e).backgroundColor;return!n||n==="rgba(0, 0, 0, 0)"}function q(){let e;const n=()=>({});window._lstClckDetails=n,document.addEventListener("touchstart",t=>{const o=t.target;if(!(o instanceof HTMLElement)||!o.isConnected)return;const i=t.touches[0];window._lstClckDetails=()=>x(o,location.pathname,i.pageX,i.pageY),clearTimeout(e),o&&(e=setTimeout(()=>{window._lstClckDetails=n},500))})}function x(e,n,t,o){if(location.pathname!==n)return;const i=(e.isConnected?N(e,a=>a instanceof HTMLAnchorElement||a instanceof HTMLButtonElement):void 0)??Array.from(document.elementsFromPoint(t,o)).find(a=>a instanceof HTMLAnchorElement&&f(a));if(!i)return e.isConnected&&f(e)?{}:void 0;if(!f(i))return;if(!(i instanceof HTMLAnchorElement))return i.children.length?{}:void 0;const r=i.href;if(!r||r.includes("javascript:")||r[0]==="#")return{};try{return{href:new URL(r,location.href).toString(),isBlank:i.target==="_blank"}}catch{return{}}}function f(e){const{offsetWidth:n,offsetHeight:t}=e;return n>=1&&n<window.innerWidth*.9||t>=1&&t>window.innerHeight*.9}function N(e,n){let t=e;for(;t&&t!==document.body;){if(n(t))return t;t=t.parentElement}}function u(e,n){window.flutter_inappwebview?.callHandler?.(e,n===void 0?{}:n)}})();
1
+ (function(){"use strict";function T(e,n){let t;return()=>{t&&clearTimeout(t),t=setTimeout(()=>{e(),t=void 0},n)}}function p(e){return e.title==="Just a moment..."||e.title==="Access denied"||e.title=="Attention Required! | Cloudflare"||!!e.querySelector('body.no-js #challenge-running, body.no-js noscript, link[href$="/styles/challenges.css"]')}async function C({addListener:e,removeListener:n,transform:t,filter:o,handler:i,onTimeout:r,timeout:a,once:s}){return new Promise(c=>{e(k);const d=()=>s===!0&&n(k),b=a?setTimeout(()=>{d(),c(void 0),r?.()},a):void 0;async function k(l,...L){l=t?t(l):l,l!==void 0&&(!o||o(l,...L))&&(d(),c(l),i?.(l,...L),b&&clearTimeout(b))}})}async function E(e){return(await C({addListener:n=>window.addEventListener("message",n),removeListener:n=>window.removeEventListener("message",n),...e}))?.data}function H({event:e,filter:n,handler:t,senderWindow:o,targetOrigin:i}){E({filter:r=>r.data?.event===e&&!!r.data?.reqId&&(!n||n(r)),handler:async r=>{const a=await t?.(r);(o||window).postMessage({resId:r.data.reqId,result:a},i??"*")}})}async function m(e,n,t){const o=await t(()=>{e=0});if(o!==void 0)return o;if(!(e<=0))return await new Promise(i=>{setTimeout(async()=>{const r=await m(e-1,n,t);i(r)},n)})}function M(){const e={delay:{loading:!0}};let n=location.pathname,t={...e};async function o(i,r){if(!r.headers.get("Content-Type")?.includes("application/json")){delete t[i];return}t[i]={res:r.clone()}}window.fetch=new Proxy(window.fetch,{apply:async(i,r,a)=>{n!==location.pathname&&(n=location.pathname,t={...e});const[s,c]=a;return c?.method&&c.method.toLowerCase?.()!=="get"?await i.apply(r,a):(t[s]={loading:!0},delete t.delay,await i.apply(r,[s,c]).then(d=>(o(s,d),d)).catch(d=>{throw delete t[s],d}))}}),H({event:"tk:fetchResult",async handler(i){if(i.origin!==location.origin)return;const{baseUrl:r,segments:a}=i.data.args||{};return!Array.isArray(a)||typeof r!="string"?void 0:await I(()=>t,r,a.filter(s=>typeof s=="string"||typeof s?.isAny=="boolean"))}})}function A(e,n,t){const o=Object.keys(e).find(i=>_(i,n,t));return o?{url:o,result:e[o]}:void 0}function _(e,n,t){const o=e.replace(location.origin,""),i=n.replace(location.origin,"");if(!o.startsWith(i))return!1;const r=o.replace(i,"").split("?")[0].split("#")[0].split("/").filter(Boolean);return r.length===t.length&&t.every((a,s)=>a?.isAny||a===r[s])}function I(e,n,t){let o=15;return m(150,100,async i=>{const r=A(e(),n,t);if(!r){const s=Object.values(e());!(!s.length||s.some(c=>c.loading))&&!--o&&i();return}const a=await S(r.result);return a?{url:r.url,value:a}:void 0})}async function S(e){const{res:n,parsed:t,loading:o}=e;if(!o)return e.parsed=t??await n?.json().catch(async()=>JSON.parse(await n.text())).catch(()=>{}),delete e.res,e.parsed}const y=!navigator.userAgent.toLowerCase().includes("android"),h=location.hostname.includes("mangafire");let w;window.top===window&&(O(),j(),D(),M(),q());function j(){let e=!1,n=0;const t=()=>{if(!(e||p(document)))if(e=!0,n++,location.protocol==="chrome-error:")u("tk:error",document.title),document.body.style.setProperty("display","none");else{const o=g();u("tk:DOMContentLoaded",{isDocTransparent:o}),o&&W()}};document.addEventListener("DOMContentLoaded",t),document.addEventListener("readystatechange",o=>{o.target.readyState!=="loading"?t():n<=1&&(e=!1)})}function D(){e(()=>!p(document)&&u("tk:spaNav"));function e(n){let t=location.pathname;const o=T(()=>{t!==location.pathname&&(y&&h&&window.webkit&&(w=window.webkit,window.webkit=void 0),t=location.pathname,n())},50),i=(r,a,s)=>(o(),r.apply(a,s));window.addEventListener("popstate",o),window.history.pushState=new Proxy(window.history.pushState,{apply:i}),window.history.replaceState=new Proxy(window.history.replaceState,{apply:i})}}function O(){if(!y||!h)return P();window.addEventListener("DOMContentLoaded",()=>{w=window.webkit,window.webkit=void 0,window.flutter_inappwebview.callHandler=function(...e){const n=window._flutter_inappwebview_windowId,t=setTimeout(function(){});return w?.messageHandlers.callHandler.postMessage({handlerName:e[0],_callHandlerID:t,args:JSON.stringify(Array.prototype.slice.call(e,1)),_windowId:n}),new Promise(function(o,i){window.flutter_inappwebview[t]={resolve:o,reject:i}})}})}function P(){let e=window.webkit,n=0;const t=setInterval(()=>{if(e===window.webkit){++n>=300&&clearInterval(t);return}e===void 0||typeof window.webkit=="object"?(n=0,e=window.webkit):window.webkit=e},10)}function W(){let e=0;const n=setInterval(()=>{if(e++,e===10){clearInterval(n);return}g()||(clearInterval(n),u("tk:transparentChanged",!1))},200)}function g(){return v(document.documentElement)&&v(document.body)}function v(e){const n=getComputedStyle(e).backgroundColor;return!n||n==="rgba(0, 0, 0, 0)"}function q(){let e;const n=()=>({});window._lstClckDetails=n,document.addEventListener("touchstart",t=>{const o=t.target;if(!(o instanceof HTMLElement)||!o.isConnected)return;const i=t.touches[0];window._lstClckDetails=()=>x(o,location.pathname,i.pageX,i.pageY),clearTimeout(e),o&&(e=setTimeout(()=>{window._lstClckDetails=n},500))})}function x(e,n,t,o){if(location.pathname!==n)return;const i=(e.isConnected?N(e,a=>a instanceof HTMLAnchorElement||a instanceof HTMLButtonElement):void 0)??Array.from(document.elementsFromPoint(t,o)).find(a=>a instanceof HTMLAnchorElement&&f(a));if(!i)return e.isConnected&&f(e)?{}:void 0;if(!f(i))return;if(!(i instanceof HTMLAnchorElement))return i.children.length?{}:void 0;const r=i.href;if(!r||r.includes("javascript:")||r[0]==="#")return{};try{return{href:new URL(r,location.href).toString(),isBlank:i.target==="_blank"}}catch{return{}}}function f(e){const{offsetWidth:n,offsetHeight:t}=e;return n>=1&&n<window.innerWidth*.9||t>=1&&t>window.innerHeight*.9}function N(e,n){let t=e;for(;t&&t!==document.body;){if(n(t))return t;t=t.parentElement}}function u(e,n){window.flutter_inappwebview?.callHandler?.(e,n===void 0?{}:n)}})();