diff --git a/404.html b/404.html index 32e4614..a98cc28 100644 --- a/404.html +++ b/404.html @@ -215,15 +215,16 @@ diff --git a/categories/index.html b/categories/index.html index 24183f0..70439b2 100644 --- a/categories/index.html +++ b/categories/index.html @@ -205,15 +205,16 @@ diff --git a/index.html b/index.html index 4a9211e..dfcbd89 100644 --- a/index.html +++ b/index.html @@ -632,15 +632,16 @@ document.querySelector('.wrapper').addEventListener('mouseleave', function() { diff --git a/js/submission.js b/js/submission.js index 625e9af..00b3b95 100644 --- a/js/submission.js +++ b/js/submission.js @@ -86,7 +86,7 @@ async function f1() { }; client = new OSS(c1); - console.log("OSS Client Initialized Successfully with decrypted config", client); + // console.log("OSS Client Initialized Successfully with decrypted config", client); } catch (e1) { console.error('Failed to fetch or decrypt OSS config:', e1); } diff --git a/js/submission.min.js b/js/submission.min.js index 4e5dceb..6d5896e 100644 --- a/js/submission.min.js +++ b/js/submission.min.js @@ -1,7 +1,16 @@ -let client;let s=false;var curemail="";var submitted=0;document.getElementById("loginForm").addEventListener("submit",async function(e){e.preventDefault();const n=document.getElementById("email").value;const t=document.getElementById("password").value;const o=CryptoJS.SHA256(t).toString();const i="user/email.json";const c=`user/${n}/p.json`;try{let e=await client.get(i);let t=JSON.parse(e.content).registeredEmails;if(t.includes(n)){let e=await client.get(c);let t=JSON.parse(e.content);if(t.h[0]===o){s=true;curemail=n;document.getElementById("message").innerText="登录成功!正在加载中...";setTimeout(initializeUserSession,3e3)}else{document.getElementById("message").innerText="密码错误。"}}else{if(confirm("此邮箱没有注册。是否注册?")){t.push(n);const a=JSON.stringify({registeredEmails:t},null,2);await client.put(i,new Blob([a],{type:"application/json"}));const l={h:[o],nickname:"默认昵称",hasAvatar:false};const r=JSON.stringify(l,null,2);await client.put(c,new Blob([r],{type:"application/json"}));s=true;curemail=n;document.getElementById("message").innerText="注册并登录成功!正在加载中...";setTimeout(initializeUserSession,3e3)}}}catch(e){console.error("Error:",e);document.getElementById("message").innerText="发生错误,请稍后重试。"}});function initializeUserSession(){document.getElementById("login").style.display="none";document.getElementById("navContainer").style.display="block";checkAndLoadAvatar();updateUserInfo();checkVerifiedStatus(curemail);checkInvitedStatus(curemail);fetchSubmittedCount(curemail);document.getElementById("userEmail").innerText=curemail}async function f1(){try{const e=await fetchNoCache("https://download.xn--xhq44jb2fzpc.com/upload/json/s.json");const t=await e.json();const n=t.masterKey;const o=CryptoJS.SHA256(n);const i={region:d2(t.encryptedRegion,o),accessKeyId:d2(t.encryptedKeyId,o),accessKeySecret:d2(t.encryptedKeySecret,o),bucket:d2(t.encryptedBucket,o)};client=new OSS(i);console.log("OSS Client Initialized Successfully with decrypted config",client)}catch(e){console.error("Failed to fetch or decrypt OSS config:",e)}}function d2(e,t){e=e.replace(/\s/g,"");const n=CryptoJS.enc.Base64.parse(e);const o=CryptoJS.lib.WordArray.create(n.words.slice(0,4));const i=CryptoJS.lib.WordArray.create(n.words.slice(4));const s=CryptoJS.AES.decrypt({ciphertext:i},t,{iv:o,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7});return s.toString(CryptoJS.enc.Utf8)}document.addEventListener("DOMContentLoaded",function(){f1().then(()=>{if(client){}else{console.error("Failed to initialize OSS client due to decryption error.")}}).catch(e=>{console.log("Error initializing OSS Client:",e)})});const buttons=document.querySelectorAll(".navButton");buttons.forEach(e=>{e.addEventListener("click",function(){buttons.forEach(e=>e.classList.remove("selected"));this.classList.add("selected")})});function showSubmission(){document.getElementById("submission-area").style.display="block";document.getElementById("myinfo").style.display="none";document.getElementById("mysubmission").style.display="none"}function showMyInfo(){document.getElementById("submission-area").style.display="none";document.getElementById("myinfo").style.display="block";document.getElementById("mysubmission").style.display="none"}function showMySubmissions(){document.getElementById("submission-area").style.display="none";document.getElementById("myinfo").style.display="none";fetchSubmissionData(curemail,submitted);document.getElementById("mysubmission").style.display="block"}async function updateUserInfo(){if(!s){console.log("User is not logged in.");return}const e=`https://download.xn--xhq44jb2fzpc.com/user/${curemail}/p.json`;try{const t=await fetchNoCache(e);if(t.ok){const n=await t.json();if(n&&n.nickname){document.getElementById("nickname").innerText=n.nickname;console.log("Nickname has been successfully updated.")}else{document.getElementById("nickname").innerText="Default Nickname";console.log("Default nickname set due to missing 'nickname' field in response.")}}else{throw new Error("p.json not found")}}catch(e){console.error("Error loading p.json:",e);document.getElementById("nickname").innerText="Default Nickname"}}async function checkAndLoadAvatar(){if(!s){console.log("User is not logged in.");return}const e=`https://download.xn--xhq44jb2fzpc.com/user/${curemail}/p.json`;const t=`https://download.xn--xhq44jb2fzpc.com/user/${curemail}/avatar`;const n="https://download.xn--xhq44jb2fzpc.com/avatar/default.png";try{const i=await fetchNoCache(e);if(i.ok){const c=await i.json();if(c.hasAvatar){var o=t+"?t="+Date.now();document.getElementById("myinfoavatar").src=o;console.log("Custom avatar loaded.")}else{document.getElementById("myinfoavatar").src=n;console.log("Default avatar loaded due to `hasAvatar` being false.")}}else{throw new Error("p.json not found")}}catch(e){document.getElementById("myinfoavatar").src=n;console.error("Error loading p.json. Using default avatar:",e)}}function showTooltip(e,t,n){const o=document.getElementById("tooltip");const i=document.getElementById("tooltip-title");const s=document.getElementById("tooltip-content");i.textContent=t;s.textContent=n;o.classList.add("show")}function hideTooltip(){const e=document.getElementById("tooltip");e.classList.remove("show")}document.body.addEventListener("click",e=>{const t=document.getElementById("tooltip");const n=document.getElementById("verified-icon");const o=document.getElementById("invited-icon");if(!n.contains(e.target)&&!o.contains(e.target)&&!t.contains(e.target)){hideTooltip()}});async function checkVerifiedStatus(e){if(!e){console.log("Email not provided, skipping verified status check.");return}const t="https://download.xn--xhq44jb2fzpc.com/upload/verified-email/verified-email.json";const n=document.getElementById("verified-icon");const o="认证作者";try{const i=await fetchNoCache(t);if(i.ok){const s=await i.json();if(s.includes(e)){n.style.display="inline-flex";console.log("Email is verified.");n.addEventListener("mouseenter",()=>fetchVerificationDetails(e,n));n.addEventListener("mouseleave",hideTooltip);n.addEventListener("click",()=>fetchVerificationDetails(e,n))}else{console.log("Email is not verified.")}}else{throw new Error("Failed to fetch verified-email.json")}}catch(e){console.error("Error loading or parsing verified-email.json:",e)}}async function fetchVerificationDetails(e,t){const n=`https://download.xn--xhq44jb2fzpc.com/user/${e}/verified.json`;try{const o=await fetchNoCache(n);if(o.ok){const i=await o.json();showTooltip(t,"认证作者",i.description)}else if(o.status===404){showTooltip(t,"认证作者","本作者为经过网站认证的优质内容分享者。")}}catch(e){console.error("Error fetching verification details:",e);showTooltip(t,"认证作者","本作者为经过网站认证的优质内容分享者。")}}async function checkInvitedStatus(e){if(!e){console.log("Email not provided, skipping invited author status check.");return}const t="https://download.xn--xhq44jb2fzpc.com/upload/invited-email/invited-email.json";const n=document.getElementById("invited-icon");try{const o=await fetchNoCache(t);if(o.ok){const i=await o.json();if(i.includes(e)){n.style.display="inline-flex";console.log("Email is an invited author.");n.addEventListener("mouseenter",()=>fetchInvitedInfo(e,n));n.addEventListener("mouseleave",hideTooltip);n.addEventListener("click",()=>fetchInvitedInfo(e,n))}else{console.log("Email is not an invited author.")}}else{throw new Error("Failed to fetch invited-email.json")}}catch(e){console.error("Error loading or parsing invited-email.json:",e)}}async function fetchInvitedInfo(e,t){const n=`https://download.xn--xhq44jb2fzpc.com/user/${e}/invited.json`;try{const o=await fetchNoCache(n);if(o.ok){const i=await o.json();showTooltip(t,"特邀作者",i.description||"无详细信息")}else{showTooltip(t,"特邀作者","无法获取信息")}}catch(e){console.error("Error fetching invited info:",e);showTooltip(t,"特邀作者","无法加载信息")}}async function editNickname(){if(!s){alert("您尚未登录,请登录后再尝试修改昵称。");return}const e=prompt("请输入新的昵称:");if(e===null){return}if(e.trim()===""){alert("昵称不能为空!");return}const t=`https://download.xn--xhq44jb2fzpc.com/user/${curemail}/p.json`;try{const n=await fetchNoCache(t);if(n.ok){const o=await n.json();o.nickname=e;const i=new Blob([JSON.stringify(o)],{type:"application/json"});await client.put(`user/${curemail}/p.json`,i);console.log("p.json has been successfully updated with new nickname.");setTimeout(()=>{document.getElementById("nickname").innerText=e;console.log("Nickname has been updated on the page.")},1e3)}else{throw new Error("Failed to fetch p.json")}}catch(e){console.error("Error updating nickname:",e)}}document.getElementById("editNicknameBtn").addEventListener("click",editNickname);async function uploadAvatar(e){var t=e.target.files[0];if(t&&t.size<=1048576){if(s===true){var n=`user/${curemail}/p.json`;var o=`user/${curemail}/avatar`;try{const i=await fetchNoCache(`https://download.xn--xhq44jb2fzpc.com/${n}`);let e;if(i.ok){e=await i.json()}else{e={h:[hashedPassword],nickname:"默认昵称",hasAvatar:false}}await client.put(o,t);console.log("Avatar has been successfully uploaded.");if(!e.hasAvatar){e.hasAvatar=true;const c=new Blob([JSON.stringify(e)],{type:"application/json"});await client.put(n,c);console.log("p.json has been successfully uploaded.");setTimeout(()=>{document.getElementById("myinfoavatar").src=`https://download.xn--xhq44jb2fzpc.com/${o}`;console.log("myinfoavatar's src has been updated to the new avatar.")},2e3)}else{setTimeout(()=>{document.getElementById("myinfoavatar").src+="?"+(new Date).getTime();console.log("Forced reload of the existing avatar.")},2e3)}}catch(e){console.error("Failed to upload new avatar or update p.json:",e)}}else{alert("You are not logged in, please log in before attempting to upload an avatar.")}}else{alert("头像必须小于 1MB!")}}document.querySelector(".overlay").addEventListener("click",function(){document.getElementById("fileInput").click()});const input=document.getElementById("input");const preview=document.getElementById("preview");input.addEventListener("input",()=>{const e=input.value;preview.innerHTML=marked.parse(e)});preview.innerHTML=marked.parse("");async function fetchSubmittedCount(e){const t=`https://download.xn--xhq44jb2fzpc.com/upload/${e}/submitted.json`;try{const n=await fetchNoCache(t);if(n.ok){const o=await n.json();submitted=o;console.log("Submitted count updated:",submitted)}else{throw new Error("File not found or access error")}}catch(e){submitted=0;console.log("Error fetching submitted count:",e)}}async function fetchSubmissionData(t,n){let o=` +let client,s=!1;var curemail="",submitted=0;function initializeUserSession(){document.getElementById("login").style.display="none",document.getElementById("navContainer").style.display="block",checkAndLoadAvatar(),updateUserInfo(),checkVerifiedStatus(curemail),checkInvitedStatus(curemail),fetchSubmittedCount(curemail),document.getElementById("userEmail").innerText=curemail}async function f1(){try{var e=await(await fetchNoCache("https://download.xn--xhq44jb2fzpc.com/upload/json/s.json")).json(),t=e.masterKey,n=CryptoJS.SHA256(t),o={region:d2(e.encryptedRegion,n),accessKeyId:d2(e.encryptedKeyId,n),accessKeySecret:d2(e.encryptedKeySecret,n),bucket:d2(e.encryptedBucket,n)};client=new OSS(o)}catch(e){console.error("Failed to fetch or decrypt OSS config:",e)}}function d2(e,t){e=e.replace(/\s/g,"");var e=CryptoJS.enc.Base64.parse(e),n=CryptoJS.lib.WordArray.create(e.words.slice(0,4)),e=CryptoJS.lib.WordArray.create(e.words.slice(4));return CryptoJS.AES.decrypt({ciphertext:e},t,{iv:n,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}).toString(CryptoJS.enc.Utf8)}document.getElementById("loginForm").addEventListener("submit",async function(e){e.preventDefault();var e=document.getElementById("email").value,t=document.getElementById("password").value,t=CryptoJS.SHA256(t).toString(),n="user/email.json",o=`user/${e}/p.json`;try{var a,i,r,l,c=await client.get(n),d=JSON.parse(c.content).registeredEmails;d.includes(e)?(a=await client.get(o),JSON.parse(a.content).h[0]===t?(s=!0,curemail=e,document.getElementById("message").innerText="登录成功!正在加载中...",setTimeout(initializeUserSession,3e3)):document.getElementById("message").innerText="密码错误。"):confirm("此邮箱没有注册。是否注册?")&&(d.push(e),i=JSON.stringify({registeredEmails:d},null,2),await client.put(n,new Blob([i],{type:"application/json"})),r={h:[t],nickname:"默认昵称",hasAvatar:!1},l=JSON.stringify(r,null,2),await client.put(o,new Blob([l],{type:"application/json"})),s=!0,curemail=e,document.getElementById("message").innerText="注册并登录成功!正在加载中...",setTimeout(initializeUserSession,3e3))}catch(e){console.error("Error:",e),document.getElementById("message").innerText="发生错误,请稍后重试。"}}),document.addEventListener("DOMContentLoaded",function(){f1().then(()=>{client||console.error("Failed to initialize OSS client due to decryption error.")}).catch(e=>{console.log("Error initializing OSS Client:",e)})});let buttons=document.querySelectorAll(".navButton");function showSubmission(){document.getElementById("submission-area").style.display="block",document.getElementById("myinfo").style.display="none",document.getElementById("mysubmission").style.display="none"}function showMyInfo(){document.getElementById("submission-area").style.display="none",document.getElementById("myinfo").style.display="block",document.getElementById("mysubmission").style.display="none"}function showMySubmissions(){document.getElementById("submission-area").style.display="none",document.getElementById("myinfo").style.display="none",fetchSubmissionData(curemail,submitted),document.getElementById("mysubmission").style.display="block"}async function updateUserInfo(){if(s){var e=`https://download.xn--xhq44jb2fzpc.com/user/${curemail}/p.json`;try{var t=await fetchNoCache(e);if(!t.ok)throw new Error("p.json not found");var n=await t.json();n&&n.nickname?(document.getElementById("nickname").innerText=n.nickname,console.log("Nickname has been successfully updated.")):(document.getElementById("nickname").innerText="Default Nickname",console.log("Default nickname set due to missing 'nickname' field in response."))}catch(e){console.error("Error loading p.json:",e),document.getElementById("nickname").innerText="Default Nickname"}}else console.log("User is not logged in.")}async function checkAndLoadAvatar(){if(s){var e=`https://download.xn--xhq44jb2fzpc.com/user/${curemail}/p.json`,t=`https://download.xn--xhq44jb2fzpc.com/user/${curemail}/avatar`,n="https://download.xn--xhq44jb2fzpc.com/avatar/default.png";try{var o,a=await fetchNoCache(e);if(!a.ok)throw new Error("p.json not found");(await a.json()).hasAvatar?(o=t+"?t="+Date.now(),document.getElementById("myinfoavatar").src=o,console.log("Custom avatar loaded.")):(document.getElementById("myinfoavatar").src=n,console.log("Default avatar loaded due to `hasAvatar` being false."))}catch(e){document.getElementById("myinfoavatar").src=n,console.error("Error loading p.json. Using default avatar:",e)}}else console.log("User is not logged in.")}function showTooltip(e,t,n){var o=document.getElementById("tooltip"),a=document.getElementById("tooltip-title"),i=document.getElementById("tooltip-content");a.textContent=t,i.textContent=n,o.classList.add("show")}function hideTooltip(){document.getElementById("tooltip").classList.remove("show")}async function checkVerifiedStatus(t){if(t){let e=document.getElementById("verified-icon");try{var n=await fetchNoCache("https://download.xn--xhq44jb2fzpc.com/upload/verified-email/verified-email.json");if(!n.ok)throw new Error("Failed to fetch verified-email.json");(await n.json()).includes(t)?(e.style.display="inline-flex",console.log("Email is verified."),e.addEventListener("mouseenter",()=>fetchVerificationDetails(t,e)),e.addEventListener("mouseleave",hideTooltip),e.addEventListener("click",()=>fetchVerificationDetails(t,e))):console.log("Email is not verified.")}catch(e){console.error("Error loading or parsing verified-email.json:",e)}}else console.log("Email not provided, skipping verified status check.")}async function fetchVerificationDetails(e,t){e=`https://download.xn--xhq44jb2fzpc.com/user/${e}/verified.json`;try{var n=await fetchNoCache(e);n.ok?showTooltip(t,"认证作者",(await n.json()).description):404===n.status&&showTooltip(t,"认证作者","本作者为经过网站认证的优质内容分享者。")}catch(e){console.error("Error fetching verification details:",e),showTooltip(t,"认证作者","本作者为经过网站认证的优质内容分享者。")}}async function checkInvitedStatus(t){if(t){let e=document.getElementById("invited-icon");try{var n=await fetchNoCache("https://download.xn--xhq44jb2fzpc.com/upload/invited-email/invited-email.json");if(!n.ok)throw new Error("Failed to fetch invited-email.json");(await n.json()).includes(t)?(e.style.display="inline-flex",console.log("Email is an invited author."),e.addEventListener("mouseenter",()=>fetchInvitedInfo(t,e)),e.addEventListener("mouseleave",hideTooltip),e.addEventListener("click",()=>fetchInvitedInfo(t,e))):console.log("Email is not an invited author.")}catch(e){console.error("Error loading or parsing invited-email.json:",e)}}else console.log("Email not provided, skipping invited author status check.")}async function fetchInvitedInfo(e,t){e=`https://download.xn--xhq44jb2fzpc.com/user/${e}/invited.json`;try{var n=await fetchNoCache(e);n.ok?showTooltip(t,"特邀作者",(await n.json()).description||"无详细信息"):showTooltip(t,"特邀作者","无法获取信息")}catch(e){console.error("Error fetching invited info:",e),showTooltip(t,"特邀作者","无法加载信息")}}async function editNickname(){if(s){let e=prompt("请输入新的昵称:");if(null!==e)if(""===e.trim())alert("昵称不能为空!");else{var t=`https://download.xn--xhq44jb2fzpc.com/user/${curemail}/p.json`;try{var n=await fetchNoCache(t);if(!n.ok)throw new Error("Failed to fetch p.json");var o=await n.json(),a=(o.nickname=e,new Blob([JSON.stringify(o)],{type:"application/json"}));await client.put(`user/${curemail}/p.json`,a),console.log("p.json has been successfully updated with new nickname."),setTimeout(()=>{document.getElementById("nickname").innerText=e,console.log("Nickname has been updated on the page.")},1e3)}catch(e){console.error("Error updating nickname:",e)}}}else alert("您尚未登录,请登录后再尝试修改昵称。")}async function uploadAvatar(t){t=t.target.files[0];if(t&&t.size<=1048576)if(!0===s){var n=`user/${curemail}/p.json`,o=`user/${curemail}/avatar`;try{var a,i=await fetchNoCache("https://download.xn--xhq44jb2fzpc.com/"+n);let e;e=i.ok?await i.json():{h:[hashedPassword],nickname:"默认昵称",hasAvatar:!1},await client.put(o,t),console.log("Avatar has been successfully uploaded."),e.hasAvatar?setTimeout(()=>{document.getElementById("myinfoavatar").src+="?"+(new Date).getTime(),console.log("Forced reload of the existing avatar.")},2e3):(e.hasAvatar=!0,a=new Blob([JSON.stringify(e)],{type:"application/json"}),await client.put(n,a),console.log("p.json has been successfully uploaded."),setTimeout(()=>{document.getElementById("myinfoavatar").src="https://download.xn--xhq44jb2fzpc.com/"+o,console.log("myinfoavatar's src has been updated to the new avatar.")},2e3))}catch(e){console.error("Failed to upload new avatar or update p.json:",e)}}else alert("You are not logged in, please log in before attempting to upload an avatar.");else alert("头像必须小于 1MB!")}buttons.forEach(e=>{e.addEventListener("click",function(){buttons.forEach(e=>e.classList.remove("selected")),this.classList.add("selected")})}),document.body.addEventListener("click",e=>{var t=document.getElementById("tooltip"),n=document.getElementById("verified-icon"),o=document.getElementById("invited-icon");n.contains(e.target)||o.contains(e.target)||t.contains(e.target)||hideTooltip()}),document.getElementById("editNicknameBtn").addEventListener("click",editNickname),document.querySelector(".overlay").addEventListener("click",function(){document.getElementById("fileInput").click()});let input=document.getElementById("input"),preview=document.getElementById("preview");async function fetchSubmittedCount(e){e=`https://download.xn--xhq44jb2fzpc.com/upload/${e}/submitted.json`;try{var t=await fetchNoCache(e);if(!t.ok)throw new Error("File not found or access error");var n=await t.json();submitted=n,console.log("Submitted count updated:",submitted)}catch(e){submitted=0,console.log("Error fetching submitted count:",e)}}async function fetchSubmissionData(t,n){let o=` ## 投稿记录 | 标题 | 板块 | 审核状态 | 审核备注 | -|------|------|------|------|`;for(let e=1;e<=n;e++){const i=`https://download.xn--xhq44jb2fzpc.com/upload/${t}/${e}/status.json`;try{const s=await fetchNoCache(i);if(s.ok){const c=await s.json();const{title:a,section:l,status:r,note:d,link:u}=c;let e=a||"无标题";if(r==="已通过"&&u){e=`${e}`}o+=` -| ${e} | ${l||"无板块"} | ${r||"无状态"} | ${d||""} |`}else{console.error(`无法获取 ${i}: ${s.status} ${s.statusText}`)}}catch(e){console.error(`请求 ${i} 时发生错误:`,e)}}if(n===0){o+=` -| 没有投稿记录 | | | |`}document.getElementById("mysubmission").innerHTML=marked.parse(o)}function validateFiles(t){const e=10;const n=2*1024*1024;const o=20*1024*1024;const i=t.target.files;if(i.length>e){alert(`您只能选择最多 ${e} 个文件。`);t.target.value="";return}let s=false;for(let e=0;eo){alert(`压缩文件 "${a}" 超过了大小限制(20MB)。`);t.target.value="";return}}else{if(l>n){alert(`文件 "${a}" 超过了大小限制(2MB)。`);t.target.value="";return}}}if(s&&i.length>1){alert("上传压缩文件时,只能上传一个文件。");t.target.value="";return}}function getBeijingTime(){const e=new Date;const t=e.getTimezoneOffset()*6e4;const n=8*60*60*1e3;const o=new Date(e.getTime()+t+n);return o.toLocaleString("zh-CN",{timeZone:"Asia/Shanghai"})}function displayBeijingTime(){const e=document.getElementById("beijing-time");e.textContent=getBeijingTime()}window.onload=function(){displayBeijingTime()};async function uploadImage(t){const e=t.target.files[0];const n=document.querySelector("input[name='email']").value.trim();if(!s){alert("您还没有登录,请登录后再上传图片!");return}if(!e){alert("请先选择图片文件!");return}if(e.size>2*1024*1024){alert("图片文件大小不能超过2MB!");t.target.value="";return}const o=submitted+1;const i=`upload/${n}/${o}/postimg/${e.name}`;try{const c=await client.put(i,e);const a=`https://download.xn--xhq44jb2fzpc.com/${i}`;const l=`自定义图片文字`;document.getElementById("imageUrl").innerText=l;document.getElementById("imagePreview").src=a;document.getElementById("imagePreview").style.display="block";document.getElementById("copyButton").style.display="inline-block"}catch(e){console.error("图片上传失败:",e);alert("图片上传失败!");t.target.value=""}}function copyImageUrl(){const e=document.getElementById("imageUrl").innerText;const t=document.createElement("textarea");t.value=e;document.body.appendChild(t);t.select();try{const n=document.execCommand("copy");const o=n?"标签已复制到剪贴板!请直接粘贴到 markdown 编辑区中,并根据预览效果调整大小。":"复制失败!";alert(o)}catch(e){alert("复制失败!",e)}document.body.removeChild(t)}document.getElementById("SubmitButton").onclick=function(){const f=document.getElementById("section").value;const y=document.querySelector("input[name='wp']").value.trim();const g=document.querySelector("input[name='wppassword']").value.trim();const e=document.querySelector("input[name='note']").value.trim();const h=document.getElementById("input").value.trim();if(!confirm("请仔细检查后提交,多次提交无关内容将被禁止访问网站!")){return}t();async function t(){if(!s){alert("您还未登录,请登录后再进行投稿。");return}const t=curemail;const n=document.querySelector("input[name='title']").value.trim();if(!n){alert("请填写内容的标题。");return}const o=submitted+1;try{const i=await fetch(`https://download.xn--xhq44jb2fzpc.com/user/${t}/p.json`);if(!i.ok){throw new Error("无法加载用户数据")}const c=await i.json();const a=c.nickname||"未知昵称";const e="";const l="";const r=`时间:${getBeijingTime()}\n内容标题:${n}\n邮箱:${t}\n板块:${f}\n昵称:${a}\n备注:${e}\n网盘外链:${y}\n网盘提取密码:${g}\n资源展示页:\n${h}`;const d=`upload/${t}/${o}/userinfo.txt`;const u=`upload/${t}/${o}/status.json`;const m={title:n,status:"审核中",section:f,note:e,link:l};await client.put(d,new Blob([r],{type:"text/plain"}));await client.put(u,new Blob([JSON.stringify(m)],{type:"application/json"}));const p=document.getElementById("filePicker").files;for(let e=0;e{if(!s){alert("非法操作!请先登录。");return}if(confirm("确认保存草稿吗?如您之前有草稿内容,此操作会覆盖前一次的草稿内容。")){const e=document.getElementById("input").value;const t=submitted+1;const n=`upload/${curemail}/${t}/draft.json`;const o=new Blob([JSON.stringify({content:e},null,2)],{type:"application/json"});try{await client.put(n,o);alert("草稿已保存!")}catch(e){console.error("保存草稿时出错:",e);alert("保存草稿失败,请稍后再试。")}}});document.getElementById("LoadDraft").addEventListener("click",async()=>{if(!s){alert("非法操作!请先登录。");return}const e=submitted+1;const t=`https://download.xn--xhq44jb2fzpc.com/upload/${curemail}/${e}/draft.json`;try{const n=await fetchNoCache(t);if(!n.ok){if(n.status===404){alert("没有草稿记录!")}else{throw new Error("无法加载草稿内容")}}else{const o=await n.json();if(confirm("此操作会覆盖您当前的输入内容,确认加载草稿吗?")){document.getElementById("input").value=o.content;preview.innerHTML=marked.parse(o.content);alert("草稿已加载!")}}}catch(e){console.error("加载草稿时出错:",e);alert("加载草稿失败,请稍后再试。")}}); \ No newline at end of file +|------|------|------|------|`;for(let e=1;e<=n;e++){var a=`https://download.xn--xhq44jb2fzpc.com/upload/${t}/${e}/status.json`;try{var i=await fetchNoCache(a);if(i.ok){var{title:r,section:l,status:s,note:c,link:d}=await i.json();let e=r||"无标题";"已通过"===s&&d&&(e=`${e}`),o+=` +| ${e} | ${l||"无板块"} | ${s||"无状态"} | ${c||""} |`}else console.error(`无法获取 ${a}: ${i.status} `+i.statusText)}catch(e){console.error(`请求 ${a} 时发生错误:`,e)}}0===n&&(o+=` +| 没有投稿记录 | | | |`),document.getElementById("mysubmission").innerHTML=marked.parse(o)}function validateFiles(n){var o=n.target.files;if(10`;document.getElementById("imageUrl").innerText=a,document.getElementById("imagePreview").src=o,document.getElementById("imagePreview").style.display="block",document.getElementById("copyButton").style.display="inline-block"}catch(e){console.error("图片上传失败:",e),alert("图片上传失败!"),t.target.value=""}}else alert("请先选择图片文件!");else alert("您还没有登录,请登录后再上传图片!")}function copyImageUrl(){var e=document.getElementById("imageUrl").innerText,t=document.createElement("textarea");t.value=e,document.body.appendChild(t),t.select();try{var n=document.execCommand("copy");alert(n?"标签已复制到剪贴板!请直接粘贴到 markdown 编辑区中,并根据预览效果调整大小。":"复制失败!")}catch(e){alert("复制失败!",e)}document.body.removeChild(t)}input.addEventListener("input",()=>{var e=input.value;preview.innerHTML=marked.parse(e)}),preview.innerHTML=marked.parse(""),window.onload=function(){displayBeijingTime()},document.getElementById("SubmitButton").onclick=function(){let u=document.getElementById("section").value,m=document.querySelector("input[name='wp']").value.trim(),p=document.querySelector("input[name='wppassword']").value.trim();document.querySelector("input[name='note']").value.trim();let f=document.getElementById("input").value.trim();confirm("请仔细检查后提交,多次提交无关内容将被禁止访问网站!")&&!async function(){if(s){var t=curemail,e=document.querySelector("input[name='title']").value.trim();if(e){var n=submitted+1;try{var o=await fetch(`https://download.xn--xhq44jb2fzpc.com/user/${t}/p.json`);if(!o.ok)throw new Error("无法加载用户数据");var a=(await o.json()).nickname||"未知昵称",i=`时间:${getBeijingTime()} +内容标题:${e} +邮箱:${t} +板块:${u} +昵称:${a} +备注:${""} +网盘外链:${m} +网盘提取密码:${p} +资源展示页: +`+f,r=`upload/${t}/${n}/userinfo.txt`,l=`upload/${t}/${n}/status.json`,c={title:e,status:"审核中",section:u,note:"",link:""},d=(await client.put(r,new Blob([i],{type:"text/plain"})),await client.put(l,new Blob([JSON.stringify(c)],{type:"application/json"})),document.getElementById("filePicker").files);for(let e=0;e{if(s){if(confirm("确认保存草稿吗?如您之前有草稿内容,此操作会覆盖前一次的草稿内容。")){var e=document.getElementById("input").value,t=`upload/${curemail}/${submitted+1}/draft.json`,e=new Blob([JSON.stringify({content:e},null,2)],{type:"application/json"});try{await client.put(t,e),alert("草稿已保存!")}catch(e){console.error("保存草稿时出错:",e),alert("保存草稿失败,请稍后再试。")}}}else alert("非法操作!请先登录。")}),document.getElementById("LoadDraft").addEventListener("click",async()=>{if(s){var e=`https://download.xn--xhq44jb2fzpc.com/upload/${curemail}/${submitted+1}/draft.json`;try{var t=await fetchNoCache(e);if(t.ok){var n=await t.json();confirm("此操作会覆盖您当前的输入内容,确认加载草稿吗?")&&(document.getElementById("input").value=n.content,preview.innerHTML=marked.parse(n.content),alert("草稿已加载!"))}else{if(404!==t.status)throw new Error("无法加载草稿内容");alert("没有草稿记录!")}}catch(e){console.error("加载草稿时出错:",e),alert("加载草稿失败,请稍后再试。")}}else alert("非法操作!请先登录。")}); \ No newline at end of file diff --git a/log/index.html b/log/index.html index 5b2c7b3..42fd43b 100644 --- a/log/index.html +++ b/log/index.html @@ -460,15 +460,16 @@ diff --git a/rapidlinks/快速链接/index.html b/rapidlinks/快速链接/index.html index 8c05677..55f0e3d 100644 --- a/rapidlinks/快速链接/index.html +++ b/rapidlinks/快速链接/index.html @@ -447,15 +447,16 @@ diff --git a/ratings/index.html b/ratings/index.html index de82e42..de50fcb 100644 --- a/ratings/index.html +++ b/ratings/index.html @@ -342,15 +342,16 @@ diff --git a/resources/c语言/index.html b/resources/c语言/index.html index 2b322dd..40dacb3 100644 --- a/resources/c语言/index.html +++ b/resources/c语言/index.html @@ -509,15 +509,16 @@ diff --git a/resources/index.html b/resources/index.html index 3806fd6..115722e 100644 --- a/resources/index.html +++ b/resources/index.html @@ -603,15 +603,16 @@ Edge或Chrome浏览器如果加载不出PDF预览,直接右键PDF区域选择 diff --git a/resources/page/2/index.html b/resources/page/2/index.html index d503a3f..191c102 100644 --- a/resources/page/2/index.html +++ b/resources/page/2/index.html @@ -516,15 +516,16 @@ Edge或Chrome浏览器如果加载不出PDF预览,直接右键PDF区域选择 diff --git a/resources/protocol/index.html b/resources/protocol/index.html index 45d55e4..a1582b3 100644 --- a/resources/protocol/index.html +++ b/resources/protocol/index.html @@ -313,15 +313,16 @@ diff --git a/resources/大化/index.html b/resources/大化/index.html index 096a1a0..bf3d31c 100644 --- a/resources/大化/index.html +++ b/resources/大化/index.html @@ -505,15 +505,16 @@ diff --git a/resources/大物活页/index.html b/resources/大物活页/index.html index 99131d3..cea9d51 100644 --- a/resources/大物活页/index.html +++ b/resources/大物活页/index.html @@ -505,15 +505,16 @@ diff --git a/resources/孙子兵法/index.html b/resources/孙子兵法/index.html index 66f46a7..9aca9b0 100644 --- a/resources/孙子兵法/index.html +++ b/resources/孙子兵法/index.html @@ -490,15 +490,16 @@ diff --git a/resources/工图习题/index.html b/resources/工图习题/index.html index 6793f83..1100dc9 100644 --- a/resources/工图习题/index.html +++ b/resources/工图习题/index.html @@ -486,15 +486,16 @@ diff --git a/resources/数值分析/index.html b/resources/数值分析/index.html index a34eb61..a9f30da 100644 --- a/resources/数值分析/index.html +++ b/resources/数值分析/index.html @@ -565,15 +565,16 @@ diff --git a/resources/新通用教师用书1/index.html b/resources/新通用教师用书1/index.html index 046ac4d..b07ab16 100644 --- a/resources/新通用教师用书1/index.html +++ b/resources/新通用教师用书1/index.html @@ -497,15 +497,16 @@ diff --git a/resources/概率论/index.html b/resources/概率论/index.html index 259113a..b019b28 100644 --- a/resources/概率论/index.html +++ b/resources/概率论/index.html @@ -506,15 +506,16 @@ diff --git a/resources/概率论习题/index.html b/resources/概率论习题/index.html index 516a522..5402242 100644 --- a/resources/概率论习题/index.html +++ b/resources/概率论习题/index.html @@ -505,15 +505,16 @@ diff --git a/resources/毛概复习指南/index.html b/resources/毛概复习指南/index.html index f26a697..c2a48b8 100644 --- a/resources/毛概复习指南/index.html +++ b/resources/毛概复习指南/index.html @@ -490,15 +490,16 @@ diff --git a/resources/画法几何ppt/index.html b/resources/画法几何ppt/index.html index ed8c90b..61663b8 100644 --- a/resources/画法几何ppt/index.html +++ b/resources/画法几何ppt/index.html @@ -486,15 +486,16 @@ diff --git a/resources/线性代数/index.html b/resources/线性代数/index.html index 948fe9b..9332557 100644 --- a/resources/线性代数/index.html +++ b/resources/线性代数/index.html @@ -696,15 +696,16 @@ diff --git a/resources/软测测验/index.html b/resources/软测测验/index.html index 872b189..349c56a 100644 --- a/resources/软测测验/index.html +++ b/resources/软测测验/index.html @@ -513,15 +513,16 @@ diff --git a/resources/食品安全/index.html b/resources/食品安全/index.html index f5fd9f4..9f72780 100644 --- a/resources/食品安全/index.html +++ b/resources/食品安全/index.html @@ -490,15 +490,16 @@ diff --git a/resources/高数/index.html b/resources/高数/index.html index 21960fa..d1afc50 100644 --- a/resources/高数/index.html +++ b/resources/高数/index.html @@ -522,15 +522,16 @@ diff --git a/resources/高数习题/index.html b/resources/高数习题/index.html index 12a0151..00c721c 100644 --- a/resources/高数习题/index.html +++ b/resources/高数习题/index.html @@ -510,15 +510,16 @@ diff --git a/search/index.html b/search/index.html index 102ad77..b01be35 100644 --- a/search/index.html +++ b/search/index.html @@ -373,15 +373,16 @@ document.addEventListener('DOMContentLoaded', function() { diff --git a/strategy/index.html b/strategy/index.html index de2f685..d1c9eaa 100644 --- a/strategy/index.html +++ b/strategy/index.html @@ -331,15 +331,16 @@ diff --git a/strategy/宿舍规格/index.html b/strategy/宿舍规格/index.html index f82680d..d63741b 100644 --- a/strategy/宿舍规格/index.html +++ b/strategy/宿舍规格/index.html @@ -800,15 +800,16 @@ diff --git a/strategy/群/index.html b/strategy/群/index.html index e545830..364b3a4 100644 --- a/strategy/群/index.html +++ b/strategy/群/index.html @@ -592,15 +592,16 @@ diff --git a/submission/index.html b/submission/index.html index 4c5093a..7832b61 100644 --- a/submission/index.html +++ b/submission/index.html @@ -857,7 +857,7 @@ async function fetchNoCache(url) { - + @@ -883,15 +883,16 @@ async function fetchNoCache(url) { diff --git a/submissionsuccess/index.html b/submissionsuccess/index.html index ceccd60..77bfbfe 100644 --- a/submissionsuccess/index.html +++ b/submissionsuccess/index.html @@ -268,15 +268,16 @@ diff --git a/tags/index.html b/tags/index.html index 58bd925..f585dff 100644 --- a/tags/index.html +++ b/tags/index.html @@ -205,15 +205,16 @@