优化东币下载功能

This commit is contained in:
Ember 2024-09-02 23:25:03 +08:00
parent 543f399c92
commit 001a9aff08
10 changed files with 104 additions and 25 deletions

File diff suppressed because it is too large Load Diff

9
js/coin.min.js vendored
View File

@ -1,8 +1,13 @@
function loadCoinSystem(){function l(e){var t=document.getElementById("coin-content");t.innerHTML=`<p>当前东币数:${e.coins}</p>`;let n=document.createElement("table");n.insertRow().innerHTML="<th>时间</th><th>明细</th><th>操作</th>",e.transactions.forEach(e=>{n.insertRow().innerHTML=`
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="<th>时间</th><th>明细</th><th>操作</th>",a.appendChild(t)),e.forEach(e=>{t.insertRow().innerHTML=`
<td>${e.date}</td>
<td>${"credit"===e.type?"+":"-"}${e.amount}</td>
<td>${e.description}</td>
`}),t.appendChild(n)}function o(){let s=document.getElementById("verification-modal"),o=(s.style.display="block",document.getElementById("send-code-btn")),a=document.getElementById("verify-btn"),i=document.getElementById("phone-number"),c=document.getElementById("verification-code"),d=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)?(d.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?(d.innerText="验证码已发送。若未收到2分钟后可重新发送。",sessionStorage.setItem("phoneNumber",e)):(d.innerText="发送失败!请稍后再试。",o.disabled=!1,o.textContent="发送验证码"))}catch(e){d.innerText="发送验证码时出错,请稍后重试。",o.disabled=!1,o.textContent="发送验证码"}else d.innerText="请输入有效的11位手机号码"}),a.addEventListener("click",async()=>{var e=sessionStorage.getItem("phoneNumber"),t=c.value.trim();if(d.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?(d.innerText="验证通过,请稍后……",a.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()=>{s.style.display="none";var e={userEmail:curemail,coins:20,transactions:[{type:"credit",amount:20,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),l(e)},2e3)):d.innerText="验证码错误,请重新输入。"}catch(e){d.innerText="验证时出错,请稍后重试。"}else d.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`;l(await(await fetchNoCache(n)).json())}catch(e){console.error("Error in initializeCoinSystem: ",e);{let e=document.getElementById("coin-content"),t=(e.innerHTML=`
`})}a.innerHTML=`
<p><strong>当前东币数${r.coins}</strong></p>
<p>下载某些资源时会花费东币而投稿审核通过后可以获得东币</p>
<p><strong>请注意</strong><strong></strong></p>
<p><strong>每页显示10条东币记录最近的记录将显示在最后</strong></p>
`,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=`
<p>您需要进行手机验证以解锁东币系统下载某些资源时会花费东币而投稿审核通过后可以获得东币</p>
<p><strong>请注意</strong><strong></strong></p>
<button id="first-verify-btn">验证</button>

View File

@ -58,10 +58,17 @@ function d2(e2, k2) {
f1();
document.addEventListener("DOMContentLoaded", function() {
const linkId = "{{ .Get "id" }}";
const objectKey = "{{ .Get "url" }}"; // 使用URL参数作为OSS对象的key
// const linkId = "{{ .Get "id" }}";
// const objectKey = "{{ .Get "url" }}"; // 使用URL参数作为OSS对象的key
// const popupId = "popup-" + linkId;
// const requiredCoins = {{ .Get "coin" | default 0 }}; // 获取需要扣除的金币数默认为0
// const resourceTitle = "{{ .Get "title" }}"; // 获取资源标题
const linkId = "aaa";
const objectKey = "bbb"; // 使用URL参数作为OSS对象的key
const popupId = "popup-" + linkId;
const requiredCoins = {{ .Get "coin" | default 0 }}; // 获取需要扣除的金币数默认为0
const requiredCoins = 666; // 获取需要扣除的金币数默认为0
const resourceTitle = "ccc"
const checkAndDownload = async () => {
const loggedIn = getCookie('loggedIn');
@ -92,7 +99,7 @@ document.addEventListener("DOMContentLoaded", function() {
data.transactions.push({
type: "debit",
amount: requiredCoins,
description: "下载资源",
description: `下载资源:${resourceTitle}`, // 使用资源标题
date: getCurrentTime()
});
const coinBlob = new Blob([JSON.stringify(data)], { type: 'application/json' });

View File

@ -1 +1 @@
let client;function getCookie(t){const n=t+"=";const o=document.cookie.split(";");for(let e=0;e<o.length;e++){let t=o[e];while(t.charAt(0)==" ")t=t.substring(1,t.length);if(t.indexOf(n)==0)return t.substring(n.length,t.length)}return null}async function fetchNoCache(t){const e=(new Date).getTime();const n=`${t}?timestamp=${e}`;return fetch(n)}async function f1(){try{const t=await fetchNoCache("https://download.xn--xhq44jb2fzpc.com/upload/json/s.json");const e=await t.json();const n=e.masterKey;const o=CryptoJS.SHA256(n);const c={region:d2(e.encryptedRegion,o),accessKeyId:d2(e.encryptedKeyId,o),accessKeySecret:d2(e.encryptedKeySecret,o),bucket:d2(e.encryptedBucket,o)};client=new OSS(c)}catch(t){console.error("Failed to fetch or decrypt OSS config:",t)}}function d2(t,e){t=t.replace(/\s/g,"");const n=CryptoJS.enc.Base64.parse(t);const o=CryptoJS.lib.WordArray.create(n.words.slice(0,4));const c=CryptoJS.lib.WordArray.create(n.words.slice(4));const s=CryptoJS.AES.decrypt({ciphertext:c},e,{iv:o,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7});return s.toString(CryptoJS.enc.Utf8)}f1();document.addEventListener("DOMContentLoaded",function(){const i="aaa";const r="bbb";const a="ccc"+i;const l=6666;const t=async()=>{const t=getCookie("loggedIn");const e=getCookie("userEmail");if(!t){alert("请登录后下载!");window.location.href="/submission";return}if(l>0){const n=`https://download.xn--xhq44jb2fzpc.com/user/${e}/coin/list.json`;try{const o=await fetchNoCache(n);if(!o.ok){alert("您还未激活金币系统,请前往激活!");window.location.href="/submission";return}const c=await o.json();if(c.coins<l){alert(`您的金币数量不够!当前资源要求金币数:${l};您的金币数:${c.coins}`);return}else{if(confirm(`当前下载操作花费:${l}金币;您的金币:${c.coins}。是否继续?`)){c.coins-=l;c.transactions.push({type:"debit",amount:l,description:"下载资源",date:getCurrentTime()});const s=new Blob([JSON.stringify(c)],{type:"application/json"});await client.put(`user/${e}/coin/list.json`,s);d(i,a,r)}}}catch(t){console.error("Error handling coins for download:",t);alert("无法处理您的请求,请稍后重试。")}}else{d(i,a,r)}};const d=(t,e,n)=>{let o=3;const c=document.getElementById(e);const s=c.querySelector(".popup-content");if(client){let t=client.signatureUrl(n,{expires:20,response:{"content-disposition":"attachment"}});const i=t.replace("emberimg.oss-cn-beijing.aliyuncs.com","download.xn--xhq44jb2fzpc.com");const r=()=>{if(o>0){s.textContent=`${o}秒后将开始下载...`;o--;setTimeout(r,1e3)}else{c.style.display="none";window.location.href=i}};c.style.display="block";r()}else{console.error("OSS client is not initialized.")}};document.getElementById(i).addEventListener("click",t)});function getCurrentTime(){const t=new Date;const e=new Date(t.getTime()+8*60*60*1e3);return e.toISOString().replace("T"," ").substring(0,19)}
let client;function getCookie(t){const n=t+"=";const o=document.cookie.split(";");for(let e=0;e<o.length;e++){let t=o[e];while(t.charAt(0)==" ")t=t.substring(1,t.length);if(t.indexOf(n)==0)return t.substring(n.length,t.length)}return null}async function fetchNoCache(t){const e=(new Date).getTime();const n=`${t}?timestamp=${e}`;return fetch(n)}async function f1(){try{const t=await fetchNoCache("https://download.xn--xhq44jb2fzpc.com/upload/json/s.json");const e=await t.json();const n=e.masterKey;const o=CryptoJS.SHA256(n);const c={region:d2(e.encryptedRegion,o),accessKeyId:d2(e.encryptedKeyId,o),accessKeySecret:d2(e.encryptedKeySecret,o),bucket:d2(e.encryptedBucket,o)};client=new OSS(c)}catch(t){console.error("Failed to fetch or decrypt OSS config:",t)}}function d2(t,e){t=t.replace(/\s/g,"");const n=CryptoJS.enc.Base64.parse(t);const o=CryptoJS.lib.WordArray.create(n.words.slice(0,4));const c=CryptoJS.lib.WordArray.create(n.words.slice(4));const s=CryptoJS.AES.decrypt({ciphertext:c},e,{iv:o,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7});return s.toString(CryptoJS.enc.Utf8)}f1();document.addEventListener("DOMContentLoaded",function(){const i="{{ .Get "id" }}";const r="{{ .Get "url" }}";const a="popup-"+i;const l={{ .Get "coin" | default 0 }};const d="{{ .Get "title" }}";const t=async()=>{const t=getCookie("loggedIn");const e=getCookie("userEmail");if(!t){alert("请登录后下载!");window.location.href="/submission";return}if(l>0){const n=`https://download.xn--xhq44jb2fzpc.com/user/${e}/coin/list.json`;try{const o=await fetchNoCache(n);if(!o.ok){alert("您还未激活金币系统,请前往激活!");window.location.href="/submission";return}const c=await o.json();if(c.coins<l){alert(`您的金币数量不够!当前资源要求金币数:${l};您的金币数:${c.coins}`);return}else{if(confirm(`当前下载操作花费:${l}金币;您的金币:${c.coins}。是否继续?`)){c.coins-=l;c.transactions.push({type:"debit",amount:l,description:`下载资源:${d}`,date:getCurrentTime()});const s=new Blob([JSON.stringify(c)],{type:"application/json"});await client.put(`user/${e}/coin/list.json`,s);p(i,a,r)}}}catch(t){console.error("Error handling coins for download:",t);alert("无法处理您的请求,请稍后重试。")}}else{p(i,a,r)}};const p=(t,e,n)=>{let o=3;const c=document.getElementById(e);const s=c.querySelector(".popup-content");if(client){let t=client.signatureUrl(n,{expires:20,response:{"content-disposition":"attachment"}});const i=t.replace("emberimg.oss-cn-beijing.aliyuncs.com","download.xn--xhq44jb2fzpc.com");const r=()=>{if(o>0){s.textContent=`${o}秒后将开始下载...`;o--;setTimeout(r,1e3)}else{c.style.display="none";window.location.href=i}};c.style.display="block";r()}else{console.error("OSS client is not initialized.")}};document.getElementById(i).addEventListener("click",t)});function getCurrentTime(){const t=new Date;const e=new Date(t.getTime()+8*60*60*1e3);return e.toISOString().replace("T"," ").substring(0,19)}

View File

@ -4,4 +4,7 @@ uglifyjs submission.js -o submission.min.js -m -c
-o script.min.js指定输出文件名为 script.min.js。
-m启用变量名压缩mangle会将变量名压缩成更短的形式。
-c启用代码压缩compress会对代码进行优化以减少文件体积。
-c启用代码压缩compress会对代码进行优化以减少文件体积。
uglifyjs coin.js -o coin.min.js -m -c
uglifyjs dlwithcoin.js -o dlwithcoin.min.js -m

View File

@ -467,7 +467,7 @@
<div class="popup-content">3秒后将开始下载...</div>
</div>
<script>
let client;function getCookie(t){const n=t+"=";const o=document.cookie.split(";");for(let e=0;e<o.length;e++){let t=o[e];while(t.charAt(0)==" ")t=t.substring(1,t.length);if(t.indexOf(n)==0)return t.substring(n.length,t.length)}return null}async function fetchNoCache(t){const e=(new Date).getTime();const n=`${t}?timestamp=${e}`;return fetch(n)}async function f1(){try{const t=await fetchNoCache("https://download.xn--xhq44jb2fzpc.com/upload/json/s.json");const e=await t.json();const n=e.masterKey;const o=CryptoJS.SHA256(n);const c={region:d2(e.encryptedRegion,o),accessKeyId:d2(e.encryptedKeyId,o),accessKeySecret:d2(e.encryptedKeySecret,o),bucket:d2(e.encryptedBucket,o)};client=new OSS(c)}catch(t){console.error("Failed to fetch or decrypt OSS config:",t)}}function d2(t,e){t=t.replace(/\s/g,"");const n=CryptoJS.enc.Base64.parse(t);const o=CryptoJS.lib.WordArray.create(n.words.slice(0,4));const c=CryptoJS.lib.WordArray.create(n.words.slice(4));const s=CryptoJS.AES.decrypt({ciphertext:c},e,{iv:o,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7});return s.toString(CryptoJS.enc.Utf8)}f1();document.addEventListener("DOMContentLoaded",function(){const i="download-1";const r="resources\/files\/习概\/习近平新时代中国特色社会主义思想概论 (《习近平新时代中国特色社会主义思想概论》编写组).pdf";const a="popup-"+i;const l= 5 ;const t=async()=>{const t=getCookie("loggedIn");const e=getCookie("userEmail");if(!t){alert("请登录后下载!");window.location.href="/submission";return}if(l>0){const n=`https://download.xn--xhq44jb2fzpc.com/user/${e}/coin/list.json`;try{const o=await fetchNoCache(n);if(!o.ok){alert("您还未激活币系统,请前往激活!");window.location.href="/submission";return}const c=await o.json();if(c.coins<l){alert(`您的东币数量不够当前资源要求东币数${l}您的东币数${c.coins}`);return}else{if(confirm(`当前下载操作花费东币数${l}您的东币数${c.coins}是否继续`)){c.coins-=l;c.transactions.push({type:"debit",amount:l,description:"下载资源",date:getCurrentTime()});const s=new Blob([JSON.stringify(c)],{type:"application/json"});await client.put(`user/${e}/coin/list.json`,s);d(i,a,r)}}}catch(t){console.error("Error handling coins for download:",t);alert("无法处理您的请求请稍后重试")}}else{d(i,a,r)}};const d=(t,e,n)=>{let o=3;const c=document.getElementById(e);const s=c.querySelector(".popup-content");if(client){let t=client.signatureUrl(n,{expires:20,response:{"content-disposition":"attachment"}});const i=t.replace("emberimg.oss-cn-beijing.aliyuncs.com","download.xn--xhq44jb2fzpc.com");const r=()=>{if(o>0){s.textContent=`${o}秒后将开始下载...`;o--;setTimeout(r,1e3)}else{c.style.display="none";window.location.href=i}};c.style.display="block";r()}else{console.error("OSS client is not initialized.")}};document.getElementById(i).addEventListener("click",t)});function getCurrentTime(){const t=new Date;const e=new Date(t.getTime()+8*60*60*1e3);return e.toISOString().replace("T"," ").substring(0,19)}
let client;function getCookie(t){const n=t+"=";const o=document.cookie.split(";");for(let e=0;e<o.length;e++){let t=o[e];while(t.charAt(0)==" ")t=t.substring(1,t.length);if(t.indexOf(n)==0)return t.substring(n.length,t.length)}return null}async function fetchNoCache(t){const e=(new Date).getTime();const n=`${t}?timestamp=${e}`;return fetch(n)}async function f1(){try{const t=await fetchNoCache("https://download.xn--xhq44jb2fzpc.com/upload/json/s.json");const e=await t.json();const n=e.masterKey;const o=CryptoJS.SHA256(n);const c={region:d2(e.encryptedRegion,o),accessKeyId:d2(e.encryptedKeyId,o),accessKeySecret:d2(e.encryptedKeySecret,o),bucket:d2(e.encryptedBucket,o)};client=new OSS(c)}catch(t){console.error("Failed to fetch or decrypt OSS config:",t)}}function d2(t,e){t=t.replace(/\s/g,"");const n=CryptoJS.enc.Base64.parse(t);const o=CryptoJS.lib.WordArray.create(n.words.slice(0,4));const c=CryptoJS.lib.WordArray.create(n.words.slice(4));const s=CryptoJS.AES.decrypt({ciphertext:c},e,{iv:o,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7});return s.toString(CryptoJS.enc.Utf8)}f1();document.addEventListener("DOMContentLoaded",function(){const i="download-1";const r="resources\/files\/习概\/习近平新时代中国特色社会主义思想概论 (《习近平新时代中国特色社会主义思想概论》编写组).pdf";const a="popup-"+i;const l= 5 ;const d="《习近平新时代中国特色社会主义思想概论》课本";const t=async()=>{const t=getCookie("loggedIn");const e=getCookie("userEmail");if(!t){alert("请登录后下载!");window.location.href="/submission";return}if(l>0){const n=`https://download.xn--xhq44jb2fzpc.com/user/${e}/coin/list.json`;try{const o=await fetchNoCache(n);if(!o.ok){alert("您还未激活币系统,请前往激活!");window.location.href="/submission";return}const c=await o.json();if(c.coins<l){alert(`您的金币数量不够当前资源要求金币数${l}您的金币数${c.coins}`);return}else{if(confirm(`当前下载操作花费${l}金币您的金币${c.coins}是否继续`)){c.coins-=l;c.transactions.push({type:"debit",amount:l,description:`下载资源:${d}`,date:getCurrentTime()});const s=new Blob([JSON.stringify(c)],{type:"application/json"});await client.put(`user/${e}/coin/list.json`,s);p(i,a,r)}}}catch(t){console.error("Error handling coins for download:",t);alert("无法处理您的请求请稍后重试")}}else{p(i,a,r)}};const p=(t,e,n)=>{let o=3;const c=document.getElementById(e);const s=c.querySelector(".popup-content");if(client){let t=client.signatureUrl(n,{expires:20,response:{"content-disposition":"attachment"}});const i=t.replace("emberimg.oss-cn-beijing.aliyuncs.com","download.xn--xhq44jb2fzpc.com");const r=()=>{if(o>0){s.textContent=`${o}秒后将开始下载...`;o--;setTimeout(r,1e3)}else{c.style.display="none";window.location.href=i}};c.style.display="block";r()}else{console.error("OSS client is not initialized.")}};document.getElementById(i).addEventListener("click",t)});function getCurrentTime(){const t=new Date;const e=new Date(t.getTime()+8*60*60*1e3);return e.toISOString().replace("T"," ").substring(0,19)}
</script>
<hr>

View File

@ -467,7 +467,7 @@
<div class="popup-content">3秒后将开始下载...</div>
</div>
<script>
let client;function getCookie(t){const n=t+"=";const o=document.cookie.split(";");for(let e=0;e<o.length;e++){let t=o[e];while(t.charAt(0)==" ")t=t.substring(1,t.length);if(t.indexOf(n)==0)return t.substring(n.length,t.length)}return null}async function fetchNoCache(t){const e=(new Date).getTime();const n=`${t}?timestamp=${e}`;return fetch(n)}async function f1(){try{const t=await fetchNoCache("https://download.xn--xhq44jb2fzpc.com/upload/json/s.json");const e=await t.json();const n=e.masterKey;const o=CryptoJS.SHA256(n);const c={region:d2(e.encryptedRegion,o),accessKeyId:d2(e.encryptedKeyId,o),accessKeySecret:d2(e.encryptedKeySecret,o),bucket:d2(e.encryptedBucket,o)};client=new OSS(c)}catch(t){console.error("Failed to fetch or decrypt OSS config:",t)}}function d2(t,e){t=t.replace(/\s/g,"");const n=CryptoJS.enc.Base64.parse(t);const o=CryptoJS.lib.WordArray.create(n.words.slice(0,4));const c=CryptoJS.lib.WordArray.create(n.words.slice(4));const s=CryptoJS.AES.decrypt({ciphertext:c},e,{iv:o,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7});return s.toString(CryptoJS.enc.Utf8)}f1();document.addEventListener("DOMContentLoaded",function(){const i="download-1";const r="resources\/files\/公路交通\/公路交通与汽车驾驶完整版PPT.pdf";const a="popup-"+i;const l= 8 ;const t=async()=>{const t=getCookie("loggedIn");const e=getCookie("userEmail");if(!t){alert("请登录后下载!");window.location.href="/submission";return}if(l>0){const n=`https://download.xn--xhq44jb2fzpc.com/user/${e}/coin/list.json`;try{const o=await fetchNoCache(n);if(!o.ok){alert("您还未激活币系统,请前往激活!");window.location.href="/submission";return}const c=await o.json();if(c.coins<l){alert(`您的东币数量不够当前资源要求东币数${l}您的东币数${c.coins}`);return}else{if(confirm(`当前下载操作花费东币数${l}您的东币数${c.coins}是否继续`)){c.coins-=l;c.transactions.push({type:"debit",amount:l,description:"下载资源",date:getCurrentTime()});const s=new Blob([JSON.stringify(c)],{type:"application/json"});await client.put(`user/${e}/coin/list.json`,s);d(i,a,r)}}}catch(t){console.error("Error handling coins for download:",t);alert("无法处理您的请求请稍后重试")}}else{d(i,a,r)}};const d=(t,e,n)=>{let o=3;const c=document.getElementById(e);const s=c.querySelector(".popup-content");if(client){let t=client.signatureUrl(n,{expires:20,response:{"content-disposition":"attachment"}});const i=t.replace("emberimg.oss-cn-beijing.aliyuncs.com","download.xn--xhq44jb2fzpc.com");const r=()=>{if(o>0){s.textContent=`${o}秒后将开始下载...`;o--;setTimeout(r,1e3)}else{c.style.display="none";window.location.href=i}};c.style.display="block";r()}else{console.error("OSS client is not initialized.")}};document.getElementById(i).addEventListener("click",t)});function getCurrentTime(){const t=new Date;const e=new Date(t.getTime()+8*60*60*1e3);return e.toISOString().replace("T"," ").substring(0,19)}
let client;function getCookie(t){const n=t+"=";const o=document.cookie.split(";");for(let e=0;e<o.length;e++){let t=o[e];while(t.charAt(0)==" ")t=t.substring(1,t.length);if(t.indexOf(n)==0)return t.substring(n.length,t.length)}return null}async function fetchNoCache(t){const e=(new Date).getTime();const n=`${t}?timestamp=${e}`;return fetch(n)}async function f1(){try{const t=await fetchNoCache("https://download.xn--xhq44jb2fzpc.com/upload/json/s.json");const e=await t.json();const n=e.masterKey;const o=CryptoJS.SHA256(n);const c={region:d2(e.encryptedRegion,o),accessKeyId:d2(e.encryptedKeyId,o),accessKeySecret:d2(e.encryptedKeySecret,o),bucket:d2(e.encryptedBucket,o)};client=new OSS(c)}catch(t){console.error("Failed to fetch or decrypt OSS config:",t)}}function d2(t,e){t=t.replace(/\s/g,"");const n=CryptoJS.enc.Base64.parse(t);const o=CryptoJS.lib.WordArray.create(n.words.slice(0,4));const c=CryptoJS.lib.WordArray.create(n.words.slice(4));const s=CryptoJS.AES.decrypt({ciphertext:c},e,{iv:o,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7});return s.toString(CryptoJS.enc.Utf8)}f1();document.addEventListener("DOMContentLoaded",function(){const i="download-1";const r="resources\/files\/公路交通\/公路交通与汽车驾驶完整版PPT.pdf";const a="popup-"+i;const l= 8 ;const d="《公路交通与驾驶技术》完整版PPT";const t=async()=>{const t=getCookie("loggedIn");const e=getCookie("userEmail");if(!t){alert("请登录后下载!");window.location.href="/submission";return}if(l>0){const n=`https://download.xn--xhq44jb2fzpc.com/user/${e}/coin/list.json`;try{const o=await fetchNoCache(n);if(!o.ok){alert("您还未激活币系统,请前往激活!");window.location.href="/submission";return}const c=await o.json();if(c.coins<l){alert(`您的金币数量不够当前资源要求金币数${l}您的金币数${c.coins}`);return}else{if(confirm(`当前下载操作花费${l}金币您的金币${c.coins}是否继续`)){c.coins-=l;c.transactions.push({type:"debit",amount:l,description:`下载资源:${d}`,date:getCurrentTime()});const s=new Blob([JSON.stringify(c)],{type:"application/json"});await client.put(`user/${e}/coin/list.json`,s);p(i,a,r)}}}catch(t){console.error("Error handling coins for download:",t);alert("无法处理您的请求请稍后重试")}}else{p(i,a,r)}};const p=(t,e,n)=>{let o=3;const c=document.getElementById(e);const s=c.querySelector(".popup-content");if(client){let t=client.signatureUrl(n,{expires:20,response:{"content-disposition":"attachment"}});const i=t.replace("emberimg.oss-cn-beijing.aliyuncs.com","download.xn--xhq44jb2fzpc.com");const r=()=>{if(o>0){s.textContent=`${o}秒后将开始下载...`;o--;setTimeout(r,1e3)}else{c.style.display="none";window.location.href=i}};c.style.display="block";r()}else{console.error("OSS client is not initialized.")}};document.getElementById(i).addEventListener("click",t)});function getCurrentTime(){const t=new Date;const e=new Date(t.getTime()+8*60*60*1e3);return e.toISOString().replace("T"," ").substring(0,19)}
</script>
<hr>

View File

@ -470,7 +470,7 @@
<div class="popup-content">3秒后将开始下载...</div>
</div>
<script>
let client;function getCookie(t){const n=t+"=";const o=document.cookie.split(";");for(let e=0;e<o.length;e++){let t=o[e];while(t.charAt(0)==" ")t=t.substring(1,t.length);if(t.indexOf(n)==0)return t.substring(n.length,t.length)}return null}async function fetchNoCache(t){const e=(new Date).getTime();const n=`${t}?timestamp=${e}`;return fetch(n)}async function f1(){try{const t=await fetchNoCache("https://download.xn--xhq44jb2fzpc.com/upload/json/s.json");const e=await t.json();const n=e.masterKey;const o=CryptoJS.SHA256(n);const c={region:d2(e.encryptedRegion,o),accessKeyId:d2(e.encryptedKeyId,o),accessKeySecret:d2(e.encryptedKeySecret,o),bucket:d2(e.encryptedBucket,o)};client=new OSS(c)}catch(t){console.error("Failed to fetch or decrypt OSS config:",t)}}function d2(t,e){t=t.replace(/\s/g,"");const n=CryptoJS.enc.Base64.parse(t);const o=CryptoJS.lib.WordArray.create(n.words.slice(0,4));const c=CryptoJS.lib.WordArray.create(n.words.slice(4));const s=CryptoJS.AES.decrypt({ciphertext:c},e,{iv:o,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7});return s.toString(CryptoJS.enc.Utf8)}f1();document.addEventListener("DOMContentLoaded",function(){const i="download-1";const r="resources\/files\/数值分析\/《数值分析》(张铁、邵新慧).pdf";const a="popup-"+i;const l= 10 ;const t=async()=>{const t=getCookie("loggedIn");const e=getCookie("userEmail");if(!t){alert("请登录后下载!");window.location.href="/submission";return}if(l>0){const n=`https://download.xn--xhq44jb2fzpc.com/user/${e}/coin/list.json`;try{const o=await fetchNoCache(n);if(!o.ok){alert("您还未激活币系统,请前往激活!");window.location.href="/submission";return}const c=await o.json();if(c.coins<l){alert(`您的东币数量不够当前资源要求东币数${l}您的东币数${c.coins}`);return}else{if(confirm(`当前下载操作花费东币数${l}您的东币数${c.coins}是否继续`)){c.coins-=l;c.transactions.push({type:"debit",amount:l,description:"下载资源",date:getCurrentTime()});const s=new Blob([JSON.stringify(c)],{type:"application/json"});await client.put(`user/${e}/coin/list.json`,s);d(i,a,r)}}}catch(t){console.error("Error handling coins for download:",t);alert("无法处理您的请求请稍后重试")}}else{d(i,a,r)}};const d=(t,e,n)=>{let o=3;const c=document.getElementById(e);const s=c.querySelector(".popup-content");if(client){let t=client.signatureUrl(n,{expires:20,response:{"content-disposition":"attachment"}});const i=t.replace("emberimg.oss-cn-beijing.aliyuncs.com","download.xn--xhq44jb2fzpc.com");const r=()=>{if(o>0){s.textContent=`${o}秒后将开始下载...`;o--;setTimeout(r,1e3)}else{c.style.display="none";window.location.href=i}};c.style.display="block";r()}else{console.error("OSS client is not initialized.")}};document.getElementById(i).addEventListener("click",t)});function getCurrentTime(){const t=new Date;const e=new Date(t.getTime()+8*60*60*1e3);return e.toISOString().replace("T"," ").substring(0,19)}
let client;function getCookie(t){const n=t+"=";const o=document.cookie.split(";");for(let e=0;e<o.length;e++){let t=o[e];while(t.charAt(0)==" ")t=t.substring(1,t.length);if(t.indexOf(n)==0)return t.substring(n.length,t.length)}return null}async function fetchNoCache(t){const e=(new Date).getTime();const n=`${t}?timestamp=${e}`;return fetch(n)}async function f1(){try{const t=await fetchNoCache("https://download.xn--xhq44jb2fzpc.com/upload/json/s.json");const e=await t.json();const n=e.masterKey;const o=CryptoJS.SHA256(n);const c={region:d2(e.encryptedRegion,o),accessKeyId:d2(e.encryptedKeyId,o),accessKeySecret:d2(e.encryptedKeySecret,o),bucket:d2(e.encryptedBucket,o)};client=new OSS(c)}catch(t){console.error("Failed to fetch or decrypt OSS config:",t)}}function d2(t,e){t=t.replace(/\s/g,"");const n=CryptoJS.enc.Base64.parse(t);const o=CryptoJS.lib.WordArray.create(n.words.slice(0,4));const c=CryptoJS.lib.WordArray.create(n.words.slice(4));const s=CryptoJS.AES.decrypt({ciphertext:c},e,{iv:o,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7});return s.toString(CryptoJS.enc.Utf8)}f1();document.addEventListener("DOMContentLoaded",function(){const i="download-1";const r="resources\/files\/数值分析\/《数值分析》(张铁、邵新慧).pdf";const a="popup-"+i;const l= 10 ;const d="《数值分析》课本";const t=async()=>{const t=getCookie("loggedIn");const e=getCookie("userEmail");if(!t){alert("请登录后下载!");window.location.href="/submission";return}if(l>0){const n=`https://download.xn--xhq44jb2fzpc.com/user/${e}/coin/list.json`;try{const o=await fetchNoCache(n);if(!o.ok){alert("您还未激活币系统,请前往激活!");window.location.href="/submission";return}const c=await o.json();if(c.coins<l){alert(`您的金币数量不够当前资源要求金币数${l}您的金币数${c.coins}`);return}else{if(confirm(`当前下载操作花费${l}金币您的金币${c.coins}是否继续`)){c.coins-=l;c.transactions.push({type:"debit",amount:l,description:`下载资源:${d}`,date:getCurrentTime()});const s=new Blob([JSON.stringify(c)],{type:"application/json"});await client.put(`user/${e}/coin/list.json`,s);p(i,a,r)}}}catch(t){console.error("Error handling coins for download:",t);alert("无法处理您的请求请稍后重试")}}else{p(i,a,r)}};const p=(t,e,n)=>{let o=3;const c=document.getElementById(e);const s=c.querySelector(".popup-content");if(client){let t=client.signatureUrl(n,{expires:20,response:{"content-disposition":"attachment"}});const i=t.replace("emberimg.oss-cn-beijing.aliyuncs.com","download.xn--xhq44jb2fzpc.com");const r=()=>{if(o>0){s.textContent=`${o}秒后将开始下载...`;o--;setTimeout(r,1e3)}else{c.style.display="none";window.location.href=i}};c.style.display="block";r()}else{console.error("OSS client is not initialized.")}};document.getElementById(i).addEventListener("click",t)});function getCurrentTime(){const t=new Date;const e=new Date(t.getTime()+8*60*60*1e3);return e.toISOString().replace("T"," ").substring(0,19)}
</script>
<hr>

View File

@ -480,7 +480,7 @@
<div class="popup-content">3秒后将开始下载...</div>
</div>
<script>
let client;function getCookie(t){const n=t+"=";const o=document.cookie.split(";");for(let e=0;e<o.length;e++){let t=o[e];while(t.charAt(0)==" ")t=t.substring(1,t.length);if(t.indexOf(n)==0)return t.substring(n.length,t.length)}return null}async function fetchNoCache(t){const e=(new Date).getTime();const n=`${t}?timestamp=${e}`;return fetch(n)}async function f1(){try{const t=await fetchNoCache("https://download.xn--xhq44jb2fzpc.com/upload/json/s.json");const e=await t.json();const n=e.masterKey;const o=CryptoJS.SHA256(n);const c={region:d2(e.encryptedRegion,o),accessKeyId:d2(e.encryptedKeyId,o),accessKeySecret:d2(e.encryptedKeySecret,o),bucket:d2(e.encryptedBucket,o)};client=new OSS(c)}catch(t){console.error("Failed to fetch or decrypt OSS config:",t)}}function d2(t,e){t=t.replace(/\s/g,"");const n=CryptoJS.enc.Base64.parse(t);const o=CryptoJS.lib.WordArray.create(n.words.slice(0,4));const c=CryptoJS.lib.WordArray.create(n.words.slice(4));const s=CryptoJS.AES.decrypt({ciphertext:c},e,{iv:o,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7});return s.toString(CryptoJS.enc.Utf8)}f1();document.addEventListener("DOMContentLoaded",function(){const i="download-1";const r="resources\/files\/概率论\/概率论期末考试题及答案.pdf";const a="popup-"+i;const l= 15 ;const t=async()=>{const t=getCookie("loggedIn");const e=getCookie("userEmail");if(!t){alert("请登录后下载!");window.location.href="/submission";return}if(l>0){const n=`https://download.xn--xhq44jb2fzpc.com/user/${e}/coin/list.json`;try{const o=await fetchNoCache(n);if(!o.ok){alert("您还未激活币系统,请前往激活!");window.location.href="/submission";return}const c=await o.json();if(c.coins<l){alert(`您的东币数量不够当前资源要求东币数${l}您的东币数${c.coins}`);return}else{if(confirm(`当前下载操作花费东币数${l}您的东币数${c.coins}是否继续`)){c.coins-=l;c.transactions.push({type:"debit",amount:l,description:"下载资源",date:getCurrentTime()});const s=new Blob([JSON.stringify(c)],{type:"application/json"});await client.put(`user/${e}/coin/list.json`,s);d(i,a,r)}}}catch(t){console.error("Error handling coins for download:",t);alert("无法处理您的请求请稍后重试")}}else{d(i,a,r)}};const d=(t,e,n)=>{let o=3;const c=document.getElementById(e);const s=c.querySelector(".popup-content");if(client){let t=client.signatureUrl(n,{expires:20,response:{"content-disposition":"attachment"}});const i=t.replace("emberimg.oss-cn-beijing.aliyuncs.com","download.xn--xhq44jb2fzpc.com");const r=()=>{if(o>0){s.textContent=`${o}秒后将开始下载...`;o--;setTimeout(r,1e3)}else{c.style.display="none";window.location.href=i}};c.style.display="block";r()}else{console.error("OSS client is not initialized.")}};document.getElementById(i).addEventListener("click",t)});function getCurrentTime(){const t=new Date;const e=new Date(t.getTime()+8*60*60*1e3);return e.toISOString().replace("T"," ").substring(0,19)}
let client;function getCookie(t){const n=t+"=";const o=document.cookie.split(";");for(let e=0;e<o.length;e++){let t=o[e];while(t.charAt(0)==" ")t=t.substring(1,t.length);if(t.indexOf(n)==0)return t.substring(n.length,t.length)}return null}async function fetchNoCache(t){const e=(new Date).getTime();const n=`${t}?timestamp=${e}`;return fetch(n)}async function f1(){try{const t=await fetchNoCache("https://download.xn--xhq44jb2fzpc.com/upload/json/s.json");const e=await t.json();const n=e.masterKey;const o=CryptoJS.SHA256(n);const c={region:d2(e.encryptedRegion,o),accessKeyId:d2(e.encryptedKeyId,o),accessKeySecret:d2(e.encryptedKeySecret,o),bucket:d2(e.encryptedBucket,o)};client=new OSS(c)}catch(t){console.error("Failed to fetch or decrypt OSS config:",t)}}function d2(t,e){t=t.replace(/\s/g,"");const n=CryptoJS.enc.Base64.parse(t);const o=CryptoJS.lib.WordArray.create(n.words.slice(0,4));const c=CryptoJS.lib.WordArray.create(n.words.slice(4));const s=CryptoJS.AES.decrypt({ciphertext:c},e,{iv:o,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7});return s.toString(CryptoJS.enc.Utf8)}f1();document.addEventListener("DOMContentLoaded",function(){const i="download-1";const r="resources\/files\/概率论\/概率论期末考试题及答案.pdf";const a="popup-"+i;const l= 15 ;const d="《概率论与数理统计》期末真题合集";const t=async()=>{const t=getCookie("loggedIn");const e=getCookie("userEmail");if(!t){alert("请登录后下载!");window.location.href="/submission";return}if(l>0){const n=`https://download.xn--xhq44jb2fzpc.com/user/${e}/coin/list.json`;try{const o=await fetchNoCache(n);if(!o.ok){alert("您还未激活币系统,请前往激活!");window.location.href="/submission";return}const c=await o.json();if(c.coins<l){alert(`您的金币数量不够当前资源要求金币数${l}您的金币数${c.coins}`);return}else{if(confirm(`当前下载操作花费${l}金币您的金币${c.coins}是否继续`)){c.coins-=l;c.transactions.push({type:"debit",amount:l,description:`下载资源:${d}`,date:getCurrentTime()});const s=new Blob([JSON.stringify(c)],{type:"application/json"});await client.put(`user/${e}/coin/list.json`,s);p(i,a,r)}}}catch(t){console.error("Error handling coins for download:",t);alert("无法处理您的请求请稍后重试")}}else{p(i,a,r)}};const p=(t,e,n)=>{let o=3;const c=document.getElementById(e);const s=c.querySelector(".popup-content");if(client){let t=client.signatureUrl(n,{expires:20,response:{"content-disposition":"attachment"}});const i=t.replace("emberimg.oss-cn-beijing.aliyuncs.com","download.xn--xhq44jb2fzpc.com");const r=()=>{if(o>0){s.textContent=`${o}秒后将开始下载...`;o--;setTimeout(r,1e3)}else{c.style.display="none";window.location.href=i}};c.style.display="block";r()}else{console.error("OSS client is not initialized.")}};document.getElementById(i).addEventListener("click",t)});function getCurrentTime(){const t=new Date;const e=new Date(t.getTime()+8*60*60*1e3);return e.toISOString().replace("T"," ").substring(0,19)}
</script>
<hr>

View File

@ -463,7 +463,7 @@
<div class="popup-content">3秒后将开始下载...</div>
</div>
<script>
let client;function getCookie(t){const n=t+"=";const o=document.cookie.split(";");for(let e=0;e<o.length;e++){let t=o[e];while(t.charAt(0)==" ")t=t.substring(1,t.length);if(t.indexOf(n)==0)return t.substring(n.length,t.length)}return null}async function fetchNoCache(t){const e=(new Date).getTime();const n=`${t}?timestamp=${e}`;return fetch(n)}async function f1(){try{const t=await fetchNoCache("https://download.xn--xhq44jb2fzpc.com/upload/json/s.json");const e=await t.json();const n=e.masterKey;const o=CryptoJS.SHA256(n);const c={region:d2(e.encryptedRegion,o),accessKeyId:d2(e.encryptedKeyId,o),accessKeySecret:d2(e.encryptedKeySecret,o),bucket:d2(e.encryptedBucket,o)};client=new OSS(c)}catch(t){console.error("Failed to fetch or decrypt OSS config:",t)}}function d2(t,e){t=t.replace(/\s/g,"");const n=CryptoJS.enc.Base64.parse(t);const o=CryptoJS.lib.WordArray.create(n.words.slice(0,4));const c=CryptoJS.lib.WordArray.create(n.words.slice(4));const s=CryptoJS.AES.decrypt({ciphertext:c},e,{iv:o,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7});return s.toString(CryptoJS.enc.Utf8)}f1();document.addEventListener("DOMContentLoaded",function(){const i="download-1";const r="resources\/files\/马原\/马克思主义基本原理(2023版) (本书编写组).pdf";const a="popup-"+i;const l= 5 ;const t=async()=>{const t=getCookie("loggedIn");const e=getCookie("userEmail");if(!t){alert("请登录后下载!");window.location.href="/submission";return}if(l>0){const n=`https://download.xn--xhq44jb2fzpc.com/user/${e}/coin/list.json`;try{const o=await fetchNoCache(n);if(!o.ok){alert("您还未激活币系统,请前往激活!");window.location.href="/submission";return}const c=await o.json();if(c.coins<l){alert(`您的东币数量不够当前资源要求东币数${l}您的东币数${c.coins}`);return}else{if(confirm(`当前下载操作花费东币数${l}您的东币数${c.coins}是否继续`)){c.coins-=l;c.transactions.push({type:"debit",amount:l,description:"下载资源",date:getCurrentTime()});const s=new Blob([JSON.stringify(c)],{type:"application/json"});await client.put(`user/${e}/coin/list.json`,s);d(i,a,r)}}}catch(t){console.error("Error handling coins for download:",t);alert("无法处理您的请求请稍后重试")}}else{d(i,a,r)}};const d=(t,e,n)=>{let o=3;const c=document.getElementById(e);const s=c.querySelector(".popup-content");if(client){let t=client.signatureUrl(n,{expires:20,response:{"content-disposition":"attachment"}});const i=t.replace("emberimg.oss-cn-beijing.aliyuncs.com","download.xn--xhq44jb2fzpc.com");const r=()=>{if(o>0){s.textContent=`${o}秒后将开始下载...`;o--;setTimeout(r,1e3)}else{c.style.display="none";window.location.href=i}};c.style.display="block";r()}else{console.error("OSS client is not initialized.")}};document.getElementById(i).addEventListener("click",t)});function getCurrentTime(){const t=new Date;const e=new Date(t.getTime()+8*60*60*1e3);return e.toISOString().replace("T"," ").substring(0,19)}
let client;function getCookie(t){const n=t+"=";const o=document.cookie.split(";");for(let e=0;e<o.length;e++){let t=o[e];while(t.charAt(0)==" ")t=t.substring(1,t.length);if(t.indexOf(n)==0)return t.substring(n.length,t.length)}return null}async function fetchNoCache(t){const e=(new Date).getTime();const n=`${t}?timestamp=${e}`;return fetch(n)}async function f1(){try{const t=await fetchNoCache("https://download.xn--xhq44jb2fzpc.com/upload/json/s.json");const e=await t.json();const n=e.masterKey;const o=CryptoJS.SHA256(n);const c={region:d2(e.encryptedRegion,o),accessKeyId:d2(e.encryptedKeyId,o),accessKeySecret:d2(e.encryptedKeySecret,o),bucket:d2(e.encryptedBucket,o)};client=new OSS(c)}catch(t){console.error("Failed to fetch or decrypt OSS config:",t)}}function d2(t,e){t=t.replace(/\s/g,"");const n=CryptoJS.enc.Base64.parse(t);const o=CryptoJS.lib.WordArray.create(n.words.slice(0,4));const c=CryptoJS.lib.WordArray.create(n.words.slice(4));const s=CryptoJS.AES.decrypt({ciphertext:c},e,{iv:o,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7});return s.toString(CryptoJS.enc.Utf8)}f1();document.addEventListener("DOMContentLoaded",function(){const i="download-1";const r="resources\/files\/马原\/马克思主义基本原理(2023版) (本书编写组).pdf";const a="popup-"+i;const l= 5 ;const d="《马克思主义基本原理》课本2023版";const t=async()=>{const t=getCookie("loggedIn");const e=getCookie("userEmail");if(!t){alert("请登录后下载!");window.location.href="/submission";return}if(l>0){const n=`https://download.xn--xhq44jb2fzpc.com/user/${e}/coin/list.json`;try{const o=await fetchNoCache(n);if(!o.ok){alert("您还未激活币系统,请前往激活!");window.location.href="/submission";return}const c=await o.json();if(c.coins<l){alert(`您的金币数量不够当前资源要求金币数${l}您的金币数${c.coins}`);return}else{if(confirm(`当前下载操作花费${l}金币您的金币${c.coins}是否继续`)){c.coins-=l;c.transactions.push({type:"debit",amount:l,description:`下载资源:${d}`,date:getCurrentTime()});const s=new Blob([JSON.stringify(c)],{type:"application/json"});await client.put(`user/${e}/coin/list.json`,s);p(i,a,r)}}}catch(t){console.error("Error handling coins for download:",t);alert("无法处理您的请求请稍后重试")}}else{p(i,a,r)}};const p=(t,e,n)=>{let o=3;const c=document.getElementById(e);const s=c.querySelector(".popup-content");if(client){let t=client.signatureUrl(n,{expires:20,response:{"content-disposition":"attachment"}});const i=t.replace("emberimg.oss-cn-beijing.aliyuncs.com","download.xn--xhq44jb2fzpc.com");const r=()=>{if(o>0){s.textContent=`${o}秒后将开始下载...`;o--;setTimeout(r,1e3)}else{c.style.display="none";window.location.href=i}};c.style.display="block";r()}else{console.error("OSS client is not initialized.")}};document.getElementById(i).addEventListener("click",t)});function getCurrentTime(){const t=new Date;const e=new Date(t.getTime()+8*60*60*1e3);return e.toISOString().replace("T"," ").substring(0,19)}
</script>
<hr>