/
za-hax for zearn (2)
1 lines (1 loc) · 1.83 KB
/
za-hax for zearn (2)
1
javascript:fetch("https://www.zearn.org/").then(e=>e.text()).then(e=>new DOMParser().parseFromString(e,"text/html")).then(e=>Array.from(e.querySelectorAll("script")).filter(e=>e.textContent.includes("gon={}"))[0]).then(e=>eval(e.textContent)).then(function(){if(!gon.current_user){alert("You need to log in for the hacks to work!");return;}if(!Dent.constants.NO_HACK){window.confirm = undefined;async function makeRequest(e,t){return fetch("https://www.zearn.org/"+e,{headers:{"x-csrf-token":document.querySelector("meta[name='csrf-token']").content,"content-type": "application/json"},body:JSON.stringify(t),method:"POST",credentials:"include"})}window.p=window.p?window.p:gon.posts[0];var p=window.p,type=p.assets.category;if("fluency"===type)makeRequest("activity_completions.json",{activitiable_type:p.assets.link.includes("number_gym_activities")?"NumberGymActivity":"Fluency",activitiable_id:p.postable_id,success:!0}).then((e=>{window.location.reload()}));else{var result={};fetch(window.location.origin+p.assets.link).then((e=>e.text())).then((e=>{const t=new RegExp("\\/\\/<!\\[CDATA\\[(.*?)\\/\\/\\]\\]>","s");return e.match(t)[1]})).then((code=>eval(code))).then(function(){var e,t;switch(p.assets.type){default:e="GuidedPractice",t={id:"temp2",is_complete:!0,taskable_id:gon.checkpoints[gon.checkpoints.length-1].id,taskable_type:"Checkpoint"};break;case"learning-lab":e="GuidedPractice",t={id:"temp2",is_complete:!0,taskable_id:gon.lab_sections[gon.lab_sections.length-1].id,taskable_type:"LabSection"};break;case"tower":var i=gon.stages[gon.stages.length-1];t={id:"temp2",is_complete:!0,stage_id:i.id,taskable_id:i.problem.id,taskable_type:"Problem"},e="Tower"}makeRequest("results.json",t).then(makeRequest("activity_completions.json",{activitiable_type:e,activitiable_id:p.postable_id})).then(e=>{window.location.reload()})})}}else{alert("Patched!");}});