Skip to content

Commit

Permalink
Update api_lite.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Dev-Huang1 authored Oct 5, 2024
1 parent 7493980 commit 340cf42
Showing 1 changed file with 28 additions and 6 deletions.
34 changes: 28 additions & 6 deletions 0/api_lite.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function captcha(){var e;document.getElementById("one-captcha").innerHTML=`
function OneCaptchaInit(){var e;document.getElementById("one-captcha").innerHTML=`
<style>
#captcha-container {
width: 260px;
Expand Down Expand Up @@ -82,13 +82,13 @@ function captcha(){var e;document.getElementById("one-captcha").innerHTML=`
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 300px;
width: 285px;
background-color: #fff;
border: 1px solid #ccc;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
border-radius: 12px;
border-radius: 4px;
overflow: hidden;
padding: 20px;
padding: 15px;
font-family: Arial, sans-serif;
}
#slider-captcha-footer {
Expand All @@ -100,6 +100,19 @@ function captcha(){var e;document.getElementById("one-captcha").innerHTML=`
border-top: 1px solid #e0e0e0;
}
#slider-captcha-header {
height: 65px;
background-color: #0066ff;
color: #fff;
padding: 15px;
border-radius: 4px;
margin-bottom: 17px;
}
#slider-captcha-header-subtext {
font-size: 13px;
}
#slider-captcha-actions a {
text-decoration: none;
display: inline-block;
Expand Down Expand Up @@ -141,7 +154,7 @@ function captcha(){var e;document.getElementById("one-captcha").innerHTML=`
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 10px
border-radius: 4px;
}
#slider {
width: 100%;
Expand Down Expand Up @@ -306,6 +319,15 @@ function captcha(){var e;document.getElementById("one-captcha").innerHTML=`
</div>
<div id="slider-captcha">
<div id="slider-captcha-header">
<span id="slider-captcha-header-text" style="font-weight: bold; display: inline-block;">
Please complete CAPTCHA
</span>
</br>
<span id="slider-captcha-header-text2" style="font-size: 10px;">
If an error occurs, click the Retry button
</span>
</div>
<div id="puzzle-container">
<img id="puzzle-image" src="" alt="img">
<div id="puzzle-piece"></div>
Expand All @@ -326,4 +348,4 @@ function captcha(){var e;document.getElementById("one-captcha").innerHTML=`
</div>
</div>
</div>
`;let t=document.getElementById("verify-checkbox"),i=document.getElementById("slider-captcha"),a=document.getElementById("puzzle-image"),n=document.getElementById("puzzle-piece"),s=document.getElementById("slider-handle"),o=document.getElementById("slider-track"),r=document.getElementById("retry-button");document.getElementById("success-message"),document.getElementById("error-message"),document.getElementById("rate-limit-warning");let l=["image1.jpeg","image2.jpeg","image3.jpg","img018.png","img072.jpg","img102.jpeg","img181.jpeg","img193.jpeg","img273.jpeg","img372.jpeg","img392.jpeg","img398.jpeg","img462.jpg","img482.jpeg","img492.jpeg","img592.jpg","img638.jpg","img639.jpeg","img639.jpg","img648.jpg","img657.jpeg","img857.jpeg","img928.jpeg"],c,d,p=!1,g,$,h=[],y,m,f={en:{captchaLabel:"I'm not a robot",verifyingText:"Verifying...",privacyLink:"Privacy",docsLink:"Docs",successMessage:"Success",errorMessage:"Verification failed. Please try again."},zh:{captchaLabel:"我不是机器人",verifyingText:"验证中...",privacyLink:"隐私",docsLink:"文档",successMessage:"验证成功",errorMessage:"验证失败,请重试"},es:{captchaLabel:"No soy un robot",verifyingText:"Verificando...",privacyLink:"Privacidad",docsLink:"Docs",successMessage:"\xc9xito",errorMessage:"La verificaci\xf3n fall\xf3. Por favor, int\xe9ntelo de nuevo."},fr:{captchaLabel:"Je suis humain",verifyingText:"V\xe9rification...",privacyLink:"La vie priv\xe9e",docsLink:"Docs",successMessage:"Succ\xe8s",errorMessage:"\xc9chec de la v\xe9rification. Veuillez r\xe9essayer."}},u=document.getElementById("one-captcha"),x=u.getAttribute("data-lang");function b(){if(x)return x;let e=navigator.language||navigator.userLanguage;return e.startsWith("zh")?"zh":e.startsWith("es")?"es":e.startsWith("fr")?"fr":e.includes("zh")?"zh":"en"}function v(){c=l[Math.floor(Math.random()*l.length)],a.src=`https://onecaptcha.us.kg/assets/v3/${c}`,a.onload=()=>{let e=a.width-50,t=a.height-50,s=Math.floor(Math.random()*(e-50)+50),o=Math.floor(Math.random()*t);if(!document.getElementById("puzzle-piece")){let r=document.createElement("div");r.id="puzzle-piece",document.getElementById("puzzle-container").appendChild(r),n=r}n.style.left="0px",n.style.top=`${o}px`,n.style.backgroundImage=`url(https://onecaptcha.us.kg/assets/v3/${c})`,n.style.backgroundPosition=`-${s}px -${o}px`,n.style.backgroundSize=`${a.width}px ${a.height}px`,n.style.display="block",n.style.zIndex="1000";let l=document.getElementById("puzzle-hole");l&&l.remove();let p=document.createElement("div");p.id="puzzle-hole",p.style.left=`${s}px`,p.style.top=`${o}px`,p.style.display="block",p.style.zIndex="999",document.getElementById("puzzle-container").appendChild(p),d=s,i.style.display="block",z(),setTimeout(()=>{n.style.display="block",p.style.display="block",i.style.opacity="1"},100)}}function _(e){e.preventDefault(),p=!0,g="mousedown"===e.type?e.clientX:e.touches[0].clientX,$=s.offsetLeft,y=Date.now(),h=[]}function k(e){if(!p)return;e.preventDefault();let t="mousemove"===e.type?e.clientX:e.touches[0].clientX,i=$+t-g;i=Math.max(0,Math.min(i,260)),requestAnimationFrame(()=>{s.style.left=`${i}px`,o.style.width=`${i}px`,n.style.left=`${i}px`}),h.push({x:i,time:Date.now()-y})}function w(){if(!p)return;p=!1;let e=s.offsetLeft;5>Math.abs(e-d)&&function e(){if(h.length<5)return!1;let t=[];for(let i=1;i<h.length;i++){let a=h[i].x-h[i-1].x,n=h[i].time-h[i-1].time;if(n<=0)continue;let s=Math.abs(a/n);t.push(s)}if(t.length<2)return!1;let o=t.reduce((e,t)=>e+t,0)/t.length,r=t.reduce((e,t)=>e+Math.pow(t-o,2),0)/t.length;if(Math.sqrt(r)>.2)return!0;let l=null;for(let c=1;c<t.length;c++){let d=t[c]-t[c-1];if(null!==l&&Math.abs(d-l)>.2)return!0;l=d}return isUneven}()?(function e(){let t=document.getElementById("loading-spinner"),i=document.getElementById("check-mark");t.style.opacity="0",document.getElementById("captcha-label").style.display="none",document.getElementById("success-message").textContent=f[b()].successMessage,document.getElementById("success-message").style.display="inline-block",setTimeout(()=>{t.style.display="none",i.style.display="inline-block",setTimeout(()=>{i.style.opacity="1",i.style.transform="scale(1)"},50)},300)}(),L(),i.style.display="none",document.addEventListener("visibilitychange",B)):(document.getElementById("error-message").style.display="block",E())}function z(){s.style.left="0",o.style.width="0",n.style.left="0"}function E(){let e=document.getElementById("puzzle-hole");e&&e.remove(),v()}function B(){"hidden"===document.visibilityState?m=setTimeout(()=>{t.checked=!1,t.style.display="inline-block",t.style.opacity="1",t.style.transform="scale(1)",document.getElementById("captcha-label").style.display="inline-block",document.getElementById("check-mark").style.display="none",document.getElementById("success-message").style.display="none",i.style.display="none",z(),document.removeEventListener("visibilitychange",B)},15e3):clearTimeout(m)}async function I(e){let t=new TextEncoder,i=t.encode(e),a=await crypto.subtle.digest("SHA-512",i),n=Array.from(new Uint8Array(a)),s=n.map(e=>e.toString(16).padStart(2,"0")).join("");return s}async function L(){let e=function e(){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i="";for(let a=0;a<150;a++)i+=t.charAt(Math.floor(Math.random()*t.length));return i}(),t=await I(e);var i=document.getElementById("one-captcha").getAttribute("data-callback");setTimeout(()=>{"function"==typeof window[i]?window[i](e):console.error("Callback function not found.")},500),function e(t,i,a){let n="";if(a){let s=new Date;s.setTime(s.getTime()+1e3*a),n="; expires="+s.toUTCString()}document.cookie=t+"="+(i||"")+n+"; path=/;"}("OneCaptchaToken",t,150)}t.addEventListener("change",async function(){this.checked&&(this.style.transition="transform 0.3s ease, opacity 0.3s ease",this.style.transform="scale(0)",this.style.opacity="0",setTimeout(()=>{this.style.display="none";let e=document.getElementById("loading-spinner");e.style.display="inline-block",setTimeout(()=>{e.style.opacity="1",i.style.opacity="0",i.style.display="block",v()})},300))}),r.addEventListener("click",function(){E()}),s.addEventListener("mousedown",_),s.addEventListener("touchstart",_),document.addEventListener("mousemove",k),document.addEventListener("touchmove",k),document.addEventListener("mouseup",w),document.addEventListener("touchend",w),e=b(),document.getElementById("captcha-label").textContent=f[e].captchaLabel,document.getElementById("privacy-link").textContent=f[e].privacyLink,document.getElementById("docs-link").textContent=f[e].docsLink,document.getElementById("error-message").textContent=f[e].errorMessage}document.addEventListener("DOMContentLoaded",function(){captcha()});
`;let t=document.getElementById("verify-checkbox"),i=document.getElementById("slider-captcha"),a=document.getElementById("puzzle-image"),n=document.getElementById("puzzle-piece"),r=document.getElementById("slider-handle"),s=document.getElementById("slider-track"),o=document.getElementById("retry-button");document.getElementById("success-message"),document.getElementById("error-message"),document.getElementById("slider-captcha-header-text"),document.getElementById("slider-captcha-header-text2");let l=["image1.jpeg","image2.jpeg","image3.jpg","img018.png","img072.jpg","img102.jpeg","img181.jpeg","img193.jpeg","img273.jpeg","img372.jpeg","img392.jpeg","img398.jpeg","img462.jpg","img482.jpeg","img492.jpeg","img592.jpg","img638.jpg","img639.jpeg","img639.jpg","img648.jpg","img657.jpeg","img857.jpeg","img928.jpeg"],c,d,p=!1,g,h,$=[],y,m,f={en:{captchaLabel:"I'm not a robot",verifyingText:"Verifying...",privacyLink:"Privacy",docsLink:"Docs",successMessage:"Success",errorMessage:"Verification failed. Please try again.",headerText:"Please complete CAPTCHA",smallHeaderText:"If an error occurs, click the Retry button"},zh:{captchaLabel:"我不是机器人",verifyingText:"验证中...",privacyLink:"隐私",docsLink:"文档",successMessage:"验证成功",errorMessage:"验证失败,请重试",headerText:"请完成 CAPTCHA",smallHeaderText:"如果出现错误,请点按重试按钮"},es:{captchaLabel:"No soy un robot",verifyingText:"Verificando...",privacyLink:"Privacidad",docsLink:"Docs",successMessage:"\xc9xito",errorMessage:"La verificaci\xf3n fall\xf3. Por favor, int\xe9ntelo de nuevo.",headerText:"Por favor complete el CAPTCHA",smallHeaderText:"Si se produce un error, haga clic en el bot\xf3n Reintentar"},fr:{captchaLabel:"Je suis humain",verifyingText:"V\xe9rification...",privacyLink:"La vie priv\xe9e",docsLink:"Docs",successMessage:"Succ\xe8s",errorMessage:"\xc9chec de la v\xe9rification. Veuillez r\xe9essayer.",headerText:"Veuillez compl\xe9ter le CAPTCHA",smallHeaderText:"Si une erreur se produit, cliquez sur le bouton R\xe9essayer"}},u=document.getElementById("one-captcha"),x=u.getAttribute("data-lang");function b(){if(x)return x;let e=navigator.language||navigator.userLanguage;return e.startsWith("zh")?"zh":e.startsWith("es")?"es":e.startsWith("fr")?"fr":e.includes("zh")?"zh":"en"}function v(){c=l[Math.floor(Math.random()*l.length)],a.src=`https://onecaptcha.us.kg/assets/v3/${c}`,a.onload=()=>{let e=a.width-50,t=a.height-50,r=Math.floor(Math.random()*(e-50)+50),s=Math.floor(Math.random()*t);if(!document.getElementById("puzzle-piece")){let o=document.createElement("div");o.id="puzzle-piece",document.getElementById("puzzle-container").appendChild(o),n=o}n.style.left="0px",n.style.top=`${s}px`,n.style.backgroundImage=`url(https://onecaptcha.us.kg/assets/v3/${c})`,n.style.backgroundPosition=`-${r}px -${s}px`,n.style.backgroundSize=`${a.width}px ${a.height}px`,n.style.display="block",n.style.zIndex="1000";let l=document.getElementById("puzzle-hole");l&&l.remove();let p=document.createElement("div");p.id="puzzle-hole",p.style.left=`${r}px`,p.style.top=`${s}px`,p.style.display="block",p.style.zIndex="999",document.getElementById("puzzle-container").appendChild(p),d=r,i.style.display="block",z(),setTimeout(()=>{n.style.display="block",p.style.display="block",i.style.opacity="1"},100)}}function _(e){e.preventDefault(),p=!0,g="mousedown"===e.type?e.clientX:e.touches[0].clientX,h=r.offsetLeft,y=Date.now(),$=[]}function k(e){if(!p)return;e.preventDefault();let t="mousemove"===e.type?e.clientX:e.touches[0].clientX,i=h+t-g;i=Math.max(0,Math.min(i,260)),requestAnimationFrame(()=>{r.style.left=`${i}px`,s.style.width=`${i}px`,n.style.left=`${i}px`}),$.push({x:i,time:Date.now()-y})}function w(){if(!p)return;p=!1;let e=r.offsetLeft;5>Math.abs(e-d)&&function e(){if($.length<5)return!1;let t=[];for(let i=1;i<$.length;i++){let a=$[i].x-$[i-1].x,n=$[i].time-$[i-1].time;if(n<=0)continue;let r=Math.abs(a/n);t.push(r)}if(t.length<2)return!1;let s=t.reduce((e,t)=>e+t,0)/t.length,o=t.reduce((e,t)=>e+Math.pow(t-s,2),0)/t.length;if(Math.sqrt(o)>.2)return!0;let l=null;for(let c=1;c<t.length;c++){let d=t[c]-t[c-1];if(null!==l&&Math.abs(d-l)>.2)return!0;l=d}return isUneven}()?(function e(){let t=document.getElementById("loading-spinner"),i=document.getElementById("check-mark");t.style.opacity="0",document.getElementById("captcha-label").style.display="none",document.getElementById("success-message").textContent=f[b()].successMessage,document.getElementById("success-message").style.display="inline-block",setTimeout(()=>{t.style.display="none",i.style.display="inline-block",setTimeout(()=>{i.style.opacity="1",i.style.transform="scale(1)"},50)},300)}(),C(),i.style.display="none",document.addEventListener("visibilitychange",I)):(document.getElementById("error-message").style.display="block",E())}function z(){r.style.left="0",s.style.width="0",n.style.left="0"}function E(){let e=document.getElementById("puzzle-hole");e&&e.remove(),v()}function I(){"hidden"===document.visibilityState?m=setTimeout(()=>{t.checked=!1,t.style.display="inline-block",t.style.opacity="1",t.style.transform="scale(1)",document.getElementById("captcha-label").style.display="inline-block",document.getElementById("check-mark").style.display="none",document.getElementById("success-message").style.display="none",i.style.display="none",z(),document.removeEventListener("visibilitychange",I)},15e3):clearTimeout(m)}async function B(e){let t=new TextEncoder,i=t.encode(e),a=await crypto.subtle.digest("SHA-512",i),n=Array.from(new Uint8Array(a)),r=n.map(e=>e.toString(16).padStart(2,"0")).join("");return r}async function C(){let e=function e(){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i="";for(let a=0;a<150;a++)i+=t.charAt(Math.floor(Math.random()*t.length));return i}(),t=await B(e);var i=document.getElementById("one-captcha").getAttribute("data-callback");setTimeout(()=>{"function"==typeof window[i]?window[i](e):console.error("Callback function not found.")},500),function e(t,i,a){let n="";if(a){let r=new Date;r.setTime(r.getTime()+1e3*a),n="; expires="+r.toUTCString()}document.cookie=t+"="+(i||"")+n+"; path=/;"}("OneCaptchaToken",t,150)}t.addEventListener("change",async function(){this.checked&&(this.style.transition="transform 0.3s ease, opacity 0.3s ease",this.style.transform="scale(0)",this.style.opacity="0",setTimeout(()=>{this.style.display="none";let e=document.getElementById("loading-spinner");e.style.display="inline-block",setTimeout(()=>{e.style.opacity="1",i.style.opacity="0",i.style.display="block",v()})},300))}),o.addEventListener("click",function(){E()}),r.addEventListener("mousedown",_),r.addEventListener("touchstart",_),document.addEventListener("mousemove",k),document.addEventListener("touchmove",k),document.addEventListener("mouseup",w),document.addEventListener("touchend",w),e=b(),document.getElementById("captcha-label").textContent=f[e].captchaLabel,document.getElementById("privacy-link").textContent=f[e].privacyLink,document.getElementById("docs-link").textContent=f[e].docsLink,document.getElementById("error-message").textContent=f[e].errorMessage,document.getElementById("slider-captcha-header-text").textContent=f[e].headerText,document.getElementById("slider-captcha-header-text2").textContent=f[e].smallHeaderText}document.addEventListener("DOMContentLoaded",function(){OneCaptchaInit()});

0 comments on commit 340cf42

Please sign in to comment.