trackkun-dom 1.11.3 → 1.11.4

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.11.3",
4
+ "version": "1.11.4",
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 T(e,t){let n;return()=>{n&&clearTimeout(n),n=setTimeout(()=>{e(),n=void 0},t)}}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:t,transform:n,filter:o,handler:i,onTimeout:r,timeout:a,once:s}){return new Promise(c=>{e(k);const l=()=>s===!0&&t(k),b=a?setTimeout(()=>{l(),c(void 0),r?.()},a):void 0;async function k(d,...L){d=n?n(d):d,d!==void 0&&(!o||o(d,...L))&&(l(),c(d),i?.(d,...L),b&&clearTimeout(b))}})}async function E(e){return(await C({addListener:t=>window.addEventListener("message",t),removeListener:t=>window.removeEventListener("message",t),...e}))?.data}function H({event:e,filter:t,handler:n,senderWindow:o,targetOrigin:i}){E({filter:r=>r.data?.event===e&&!!r.data?.reqId&&(!t||t(r)),handler:async r=>{const a=await n?.(r);(o||window).postMessage({resId:r.data.reqId,result:a},i??"*")}})}async function m(e,t,n){const o=await n(()=>{e=0});if(o!==void 0)return o;if(!(e<=0))return await new Promise(i=>{setTimeout(async()=>{const r=await m(e-1,t,n);i(r)},t)})}function M(){const e={delay:{loading:!0}};let t=location.pathname,n={...e};async function o(i,r){if(!r.headers.get("Content-Type")?.includes("application/json")){delete n[i];return}n[i]={res:r.clone()}}window.fetch=new Proxy(window.fetch,{apply:async(i,r,a)=>{t!==location.pathname&&(t=location.pathname,n={...e});const[s,c]=a;return c?.method&&c.method.toLowerCase?.()!=="get"?await i.apply(r,a):(n[s]={loading:!0},delete n.delay,await i.apply(r,[s,c]).then(l=>(o(s,l),l)).catch(l=>{throw delete n[s],l}))}}),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(()=>n,r,a.filter(s=>typeof s=="string"||typeof s?.isAny=="boolean"))}})}function A(e,t,n){const o=Object.keys(e).find(i=>_(i,t,n));return o?{url:o,result:e[o]}:void 0}function _(e,t,n){const o=e.replace(location.origin,""),i=t.replace(location.origin,"");if(!o.startsWith(i))return!1;const r=o.replace(i,"").split("?")[0].split("#")[0].split("/").filter(Boolean);return r.length===n.length&&n.every((a,s)=>a?.isAny||a===r[s])}function I(e,t,n){let o=15;return m(150,100,async i=>{const r=A(e(),t,n);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:t,parsed:n,loading:o}=e;if(!o)return e.parsed=n??await t?.json().catch(async()=>JSON.parse(await t.text())).catch(()=>{}),delete e.res,e.parsed}const h=!navigator.userAgent.toLowerCase().includes("android"),y=location.hostname.includes("mangafire");let w;window.top===window&&(O(),j(),D(),M(),q());function j(){let e=!1,t=0;const n=()=>{if(!(e||p(document)))if(e=!0,t++,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",n),document.addEventListener("readystatechange",o=>{o.target.readyState!=="loading"?n():t<=1&&(e=!1)})}function D(){e(()=>!p(document)&&u("tk:spaNav"));function e(t){let n=location.pathname;const o=T(()=>{n!==location.pathname&&(h&&y&&window.webkit&&(w=window.webkit,window.webkit=void 0),n=location.pathname,t())},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(!h||!y)return P();window.addEventListener("DOMContentLoaded",()=>{w=window.webkit,window.webkit=void 0;const e={log:console.log,debug:console.debug,error:console.error,info:console.info,warn:console.warn};for(const t in e)console[t]=function(...n){try{e[t].call(null,n)}catch{}};window.flutter_inappwebview.callHandler=function(...t){const n=window._flutter_inappwebview_windowId,o=setTimeout(function(){});return w?.messageHandlers.callHandler.postMessage({handlerName:t[0],_callHandlerID:o,args:JSON.stringify(Array.prototype.slice.call(t,1)),_windowId:n}),new Promise(function(i,r){window.flutter_inappwebview[o]={resolve:i,reject:r}})}})}function P(){let e=window.webkit,t=0;const n=setInterval(()=>{if(e===window.webkit){++t>=300&&clearInterval(n);return}e===void 0||typeof window.webkit=="object"?(t=0,e=window.webkit):window.webkit=e},10)}function W(){let e=0;const t=setInterval(()=>{if(e++,e===10){clearInterval(t);return}g()||(clearInterval(t),u("tk:transparentChanged",!1))},200)}function g(){return v(document.documentElement)&&v(document.body)}function v(e){const t=getComputedStyle(e).backgroundColor;return!t||t==="rgba(0, 0, 0, 0)"}function q(){let e;const t=()=>({});window._lstClckDetails=t,document.addEventListener("touchstart",n=>{const o=n.target;if(!(o instanceof HTMLElement)||!o.isConnected)return;const i=n.touches[0];window._lstClckDetails=()=>x(o,location.pathname,i.pageX,i.pageY),clearTimeout(e),o&&(e=setTimeout(()=>{window._lstClckDetails=t},500))})}function x(e,t,n,o){if(location.pathname!==t)return;const i=(e.isConnected?N(e,a=>a instanceof HTMLAnchorElement||a instanceof HTMLButtonElement):void 0)??Array.from(document.elementsFromPoint(n,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:t,offsetHeight:n}=e;return t>=1&&t<window.innerWidth*.9||n>=1&&n>window.innerHeight*.9}function N(e,t){let n=e;for(;n&&n!==document.body;){if(t(n))return n;n=n.parentElement}}function u(e,t){window.flutter_inappwebview?.callHandler?.(e,t===void 0?{}:t)}})();
1
+ (function(){"use strict";function C(e,t){let n;return()=>{n&&clearTimeout(n),n=setTimeout(()=>{e(),n=void 0},t)}}function m(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 T({addListener:e,removeListener:t,transform:n,filter:o,handler:i,onTimeout:r,timeout:a,once:s}){return new Promise(c=>{e(k);const l=()=>s===!0&&t(k),b=a?setTimeout(()=>{l(),c(void 0),r?.()},a):void 0;async function k(d,...L){d=n?n(d):d,d!==void 0&&(!o||o(d,...L))&&(l(),c(d),i?.(d,...L),b&&clearTimeout(b))}})}async function E(e){return(await T({addListener:t=>window.addEventListener("message",t),removeListener:t=>window.removeEventListener("message",t),...e}))?.data}function H({event:e,filter:t,handler:n,senderWindow:o,targetOrigin:i}){E({filter:r=>r.data?.event===e&&!!r.data?.reqId&&(!t||t(r)),handler:async r=>{const a=await n?.(r);(o||window).postMessage({resId:r.data.reqId,result:a},i??"*")}})}async function h(e,t,n){const o=await n(()=>{e=0});if(o!==void 0)return o;if(!(e<=0))return await new Promise(i=>{setTimeout(async()=>{const r=await h(e-1,t,n);i(r)},t)})}function M(){const e={delay:{loading:!0}};let t=location.pathname,n={...e};async function o(i,r){if(!r.headers.get("Content-Type")?.includes("application/json")){delete n[i];return}n[i]={res:r.clone()}}window.fetch=new Proxy(window.fetch,{apply:async(i,r,a)=>{t!==location.pathname&&(t=location.pathname,n={...e});const[s,c]=a;return c?.method&&c.method.toLowerCase?.()!=="get"?await i.apply(r,a):(n[s]={loading:!0},delete n.delay,await i.apply(r,[s,c]).then(l=>(o(s,l),l)).catch(l=>{throw delete n[s],l}))}}),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(()=>n,r,a.filter(s=>typeof s=="string"||typeof s?.isAny=="boolean"))}})}function A(e,t,n){const o=Object.keys(e).find(i=>_(i,t,n));return o?{url:o,result:e[o]}:void 0}function _(e,t,n){const o=e.replace(location.origin,""),i=t.replace(location.origin,"");if(!o.startsWith(i))return!1;const r=o.replace(i,"").split("?")[0].split("#")[0].split("/").filter(Boolean);return r.length===n.length&&n.every((a,s)=>a?.isAny||a===r[s])}function I(e,t,n){let o=15;return h(150,100,async i=>{const r=A(e(),t,n);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:t,parsed:n,loading:o}=e;if(!o)return e.parsed=n??await t?.json().catch(async()=>JSON.parse(await t.text())).catch(()=>{}),delete e.res,e.parsed}const w=!navigator.userAgent.toLowerCase().includes("android"),y=location.hostname.includes("mangafire"),j=location.hostname.includes("mangahub");let f;window.top===window&&(w&&j&&(navigator.serviceWorker={addEventListener:()=>{}}),P(),D(),O(),M(),x());function D(){let e=!1,t=0;const n=()=>{if(!(e||m(document)))if(e=!0,t++,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&&q()}};document.addEventListener("DOMContentLoaded",n),document.addEventListener("readystatechange",o=>{o.target.readyState!=="loading"?n():t<=1&&(e=!1)})}function O(){e(()=>!m(document)&&u("tk:spaNav"));function e(t){let n=location.pathname;const o=C(()=>{n!==location.pathname&&(w&&y&&window.webkit&&(f=window.webkit,window.webkit=void 0),n=location.pathname,t())},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 P(){if(!w||!y)return W();window.addEventListener("DOMContentLoaded",()=>{f=window.webkit,window.webkit=void 0;const e={log:console.log,debug:console.debug,error:console.error,info:console.info,warn:console.warn};for(const t in e)console[t]=function(...n){try{e[t].call(null,n)}catch{}};window.flutter_inappwebview.callHandler=function(...t){const n=window._flutter_inappwebview_windowId,o=setTimeout(function(){});return f?.messageHandlers.callHandler.postMessage({handlerName:t[0],_callHandlerID:o,args:JSON.stringify(Array.prototype.slice.call(t,1)),_windowId:n}),new Promise(function(i,r){window.flutter_inappwebview[o]={resolve:i,reject:r}})}})}function W(){let e=window.webkit,t=0;const n=setInterval(()=>{if(e===window.webkit){++t>=300&&clearInterval(n);return}e===void 0||typeof window.webkit=="object"?(t=0,e=window.webkit):window.webkit=e},10)}function q(){let e=0;const t=setInterval(()=>{if(e++,e===10){clearInterval(t);return}g()||(clearInterval(t),u("tk:transparentChanged",!1))},200)}function g(){return v(document.documentElement)&&v(document.body)}function v(e){const t=getComputedStyle(e).backgroundColor;return!t||t==="rgba(0, 0, 0, 0)"}function x(){let e;const t=()=>({});window._lstClckDetails=t,document.addEventListener("touchstart",n=>{const o=n.target;if(!(o instanceof HTMLElement)||!o.isConnected)return;const i=n.touches[0];window._lstClckDetails=()=>N(o,location.pathname,i.pageX,i.pageY),clearTimeout(e),o&&(e=setTimeout(()=>{window._lstClckDetails=t},500))})}function N(e,t,n,o){if(location.pathname!==t)return;const i=(e.isConnected?$(e,a=>a instanceof HTMLAnchorElement||a instanceof HTMLButtonElement):void 0)??Array.from(document.elementsFromPoint(n,o)).find(a=>a instanceof HTMLAnchorElement&&p(a));if(!i)return e.isConnected&&p(e)?{}:void 0;if(!p(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 p(e){const{offsetWidth:t,offsetHeight:n}=e;return t>=1&&t<window.innerWidth*.9||n>=1&&n>window.innerHeight*.9}function $(e,t){let n=e;for(;n&&n!==document.body;){if(t(n))return n;n=n.parentElement}}function u(e,t){window.flutter_inappwebview?.callHandler?.(e,t===void 0?{}:t)}})();