function loadCoinSystem(){function d(r){let a=document.getElementById("coin-content"),s=1;function c(e){e=10*(e-1),e=r.transactions.slice(e,10+e);let t=a.querySelector("table");t?t.innerHTML=t.rows[0].innerHTML:((t=document.createElement("table")).insertRow().innerHTML="
当前东币数:${r.coins}
下载某些资源时会花费东币,而投稿审核通过后可以获得东币。
请注意:由于下载同一份文件两次,从服务器流出的下行流量也会计算两次,因此当您多次下载同一个需要东币的资源时,东币也会多次扣除。我们建议您减少不必要的重复下载。
每页显示10条东币记录,最近的记录将显示在最后。
`,c(s),function t(){var n=Math.ceil(r.transactions.length/10),o=document.createElement("div"),e=(o.className="pagination",document.createElement("span"));o.appendChild(e);for(let e=1;e<=n;e++){var i=document.createElement("button");i.textContent=e,i.className="page-link",i.style.margin="0 5px",i.style.fontWeight=e===s?"bold":"normal",i.disabled=e===s,i.addEventListener("click",()=>{c(s=e),t()}),o.appendChild(i)}e=a.querySelector(".pagination");e&&a.removeChild(e),a.appendChild(o)}()}function o(){let a=document.getElementById("verification-modal"),o=(a.style.display="block",document.getElementById("send-code-btn")),s=document.getElementById("verify-btn"),i=document.getElementById("phone-number"),c=document.getElementById("verification-code"),l=document.getElementById("modal-message");o.addEventListener("click",async()=>{var e=i.value.trim();if(/^\d{11}$/.test(e)&&"1"===e.charAt(0))try{var t,n=CryptoJS.SHA256(e).toString();(await(await fetchNoCache("https://download.xn--xhq44jb2fzpc.com/user/pn.json")).json()).includes(n)?(l.innerText="此手机号已被验证过!",o.disabled=!1,o.textContent="发送验证码"):(o.disabled=!0,o.textContent="禁用中...",setTimeout(()=>{o.disabled=!1,o.textContent="发送验证码"},12e4),await(t=await fetch("https://sms.xn--xhq44jb2fzpc.com/send-code",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({phoneNumber:e})})).json(),t.ok?(l.innerText="验证码已发送。若未收到,2分钟后可重新发送。",sessionStorage.setItem("phoneNumber",e)):(l.innerText="发送失败!请稍后再试。",o.disabled=!1,o.textContent="发送验证码"))}catch(e){l.innerText="发送验证码时出错,请稍后重试。",o.disabled=!1,o.textContent="发送验证码"}else l.innerText="请输入有效的11位手机号码!"}),s.addEventListener("click",async()=>{var e=sessionStorage.getItem("phoneNumber"),t=c.value.trim();if(l.innerText="",t&&e)try{var n,o,i=await fetch("https://sms.xn--xhq44jb2fzpc.com/verify-code",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({phoneNumber:e,verificationCode:t})}),r=await i.json();i.ok&&r.verified?(l.innerText="验证通过,请稍后……",s.disabled=!0,c.disabled=!0,n=CryptoJS.SHA256(e).toString(),(o=await(await fetchNoCache("https://download.xn--xhq44jb2fzpc.com/user/pn.json")).json()).push(n),await client.put("user/pn.json",new Blob([JSON.stringify(o)],{type:"application/json"})),await client.put(`user/${curemail}/pn.json`,new Blob([JSON.stringify({phoneNumber:e})],{type:"application/json"})),setTimeout(async()=>{a.style.display="none";var e={userEmail:curemail,coins:50,transactions:[{type:"credit",amount:50,description:"初始东币奖励",date:(e=new Date,new Date(e.getTime()+288e5).toISOString().replace("T"," ").substring(0,19))}]},t=new Blob([JSON.stringify(!0)],{type:"application/json"}),t=(await client.put(`user/${curemail}/coin/verify.json`,t),new Blob([JSON.stringify(e)],{type:"application/json"}));await client.put(`user/${curemail}/coin/list.json`,t),d(e)},2e3)):l.innerText="验证码错误,请重新输入。"}catch(e){l.innerText="验证时出错,请稍后重试。"}else l.innerText="请输入手机号和验证码。"})}document.getElementById("cancel-btn").addEventListener("click",function(){document.getElementById("verification-modal").style.display="none"}),async function(){try{var e=`https://download.xn--xhq44jb2fzpc.com/user/${curemail}/coin/verify.json`,t=await(await fetchNoCache(e)).json();if(console.log("Verify Response: ",t),!0!==t)throw new Error("Verification required");var n=`https://download.xn--xhq44jb2fzpc.com/user/${curemail}/coin/list.json`;d(await(await fetchNoCache(n)).json())}catch(e){console.error("Error in initializeCoinSystem: ",e);{let e=document.getElementById("coin-content"),t=(e.innerHTML=`您需要进行手机验证以解锁东币系统。下载某些资源时会花费东币,而投稿审核通过后可以获得东币。
请注意:由于下载同一份文件两次,从服务器流出的下行流量也会计算两次,因此当您多次下载同一个需要东币的资源时,东币也会多次扣除。我们建议您减少不必要的重复下载。
`,document.getElementById("first-verify-btn"));t.style.display="block",t.style.margin="0 auto",t.style.padding="10px 20px",t.style.backgroundColor="#007BFF",t.style.color="#fff",t.style.border="none",t.style.borderRadius="4px",t.style.cursor="pointer",t.style.textAlign="center",t.onmouseover=function(){t.style.backgroundColor="#0056b3"},t.onmouseout=function(){t.style.backgroundColor="#007BFF"},t.onmousedown=function(){t.style.backgroundColor="#003f7f"},document.body.classList.contains("dark")&&(t.style.backgroundColor="#444",t.style.color="#fff");t.addEventListener("click",o);return}}}()}