-
Notifications
You must be signed in to change notification settings - Fork 1
/
min.js
1 lines (1 loc) · 3 KB
/
min.js
1
(async()=>{let[t,e]=Array.from(document.querySelector("table tbody").children).slice(3,5).map((t=>t.lastElementChild.textContent.trim()));t=t.split("/").shift(),e=e.toLowerCase().includes("am")?"1":"2";let s,n=t+"s"+e,o={"27s1":"https://json.extendsclass.com/bin/ad0b26002978","27s2":"https://json.extendsclass.com/bin/fefdb99829ed","29s1":"https://json.extendsclass.com/bin/904f0d88131c","29s2":"https://json.extendsclass.com/bin/46c43bba08a8","30s1":"https://json.extendsclass.com/bin/81f6b0ed9c31","30s2":"https://json.extendsclass.com/bin/ef17bbd48072","31s1":"https://json.extendsclass.com/bin/4c2836982021","31s2":"https://json.extendsclass.com/bin/a6a0bd4c830b","01s1":"https://json.extendsclass.com/bin/2902b9729668","01s2":"https://json.extendsclass.com/bin/d2ba75006751","04s1":"https://json.extendsclass.com/bin/e02a72e68a41","04s2":"https://json.extendsclass.com/bin/d45bb3017d92","05s1":"https://json.extendsclass.com/bin/f0a2446e7f12","05s2":"https://json.extendsclass.com/bin/9a5213793a4e","06s1":"https://json.extendsclass.com/bin/2508ed9bac9a","06s2":"https://json.extendsclass.com/bin/b3f147fa1f70","08s1":"https://json.extendsclass.com/bin/497e7d9b9d04","08s2":"https://json.extendsclass.com/bin/a54406466af0","09s1":"https://json.extendsclass.com/bin/59f50c0b8bf4","09s2":"https://json.extendsclass.com/bin/760b804b0fd8"};try{s=await fetch(o[n]),s=await s.json()}catch(t){console.error(t),console.error("FAILED to fetch answer keys. Most probably because keys are yet to be uploaded.")}let c=[];for(let t of document.querySelectorAll("table.menu-tbl > tbody")){let e=t.children,n=Array.from(e).map((t=>t.lastChild.textContent.trim())),o="MCQ"===n[0],a=t.parentNode.parentElement.firstChild.firstChild.lastChild.lastChild.textContent.trim(),l=o?"--"===n[7]:"--"===a;a=o?l?null:n.slice(2,6)[parseInt(n[7])-1]:l?null:a,c.push({type:n[0],id:n[1],opts:o?n.slice(2,6):[],marked:a,score:s[n[1]]===a?4:l?0:-1})}let a=0,l=0,d=0,i=0,[r,b]=j("MAT",0),[m,p]=j("PHY",30),[h,f]=j("CHE",60),x=r+m+h,u=[b,p,f].join("\n\n");function j(t,e){let s=0,n=t;return c.slice(e,e+30).forEach((({score:t},o)=>{s+=t,o%10==0&&(n+="\n"),n+=function(t,e,s){let n=`${t<10?"0":""}${t+1}${e}`;for(;n.length<s;)n+=" ";return n}(o+e,function(t){switch(a++,t){case 4:return d++,"✅";case-1:return i++,"❌";case 0:return a--,l++,"❔"}}(t),5)})),[s,n]}let y=`\n${n}\nTOTAL: ${x}/300\n\nCorrect: ${d}\nIncorrect: ${i}\nAttempted: ${a}\nUnattempted: ${l}\n\nPhysics: ${m}/100\nChemistry: ${h}/100\nMaths: ${r}/100\n\n${u}`,C=document.createElement("div");C.style="background: black; color: white; padding: 1rem; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); box-shadow: 3px 3px 10px #00000055;";let $=document.createElement("pre");$.style="font-family: sans-serif;",$.textContent=y;let w=document.createElement("button");w.addEventListener("click",(t=>{window.navigator.clipboard.writeText(y),t.target.textContent="copied"})),w.style="width: fit-content; display: block; margin: 1rem 0 0 auto;",w.textContent="COPY",C.append($,w),document.body.appendChild(C)})();