Advertisement
Pyan

EdpuzzleGetAnswers

Nov 10th, 2020 (edited)
2,789
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. console.log("Edpuzzle Get Answers by Narwhal");var Modal=document.createElement("div");Modal.id="mainModal",Modal.className="mainModal",Modal.style="position: fixed; z-index: 2147483647; left: 0px; top: 0px; width: 100%; height: 100%; overflow: auto; background-color: rgba(0, 0, 0, 0.4); display: none;";var ModalContent=document.createElement("div");ModalContent.className="modal-content",ModalContent.id="ModalContent";var Close=document.createElement("span");Close.className="close",Close.innerHTML="&times;";var btn=document.createElement("button");if(btn.id="ModalButton",btn.innerText="View Answers",btn.onclick=function(){Modal.style.display="block"},Close.onclick=function(){Modal.style.display="none"},window.onclick=function(e){e.target==Modal&&(Modal.style.display="none")},document.getElementsByTagName("body")[0].prepend(btn),ModalContent.appendChild(Close),Modal.appendChild(ModalContent),document.getElementsByClassName("_17lL44O42r _2ni2VNLiK3")[0].appendChild(Modal),document.location.href.includes("edpuzzle.com/assignments/")){let e=document.location.href.search("/assignments/")+13,t=document.location.href.search("/watch"),n="https://edpuzzle.com/api/v3/assignments/"+document.location.href.slice(e,t),o=new XMLHttpRequest;o.open("GET",n,0),o.setRequestHeader("x-edpuzzle-web-version",__EDPUZZLE_DATA__.version),o.setRequestHeader("x-edpuzzle-referrer",document.location.href),o.send(),QuizData=JSON.parse(o.responseText)}else{let e=document.location.href.search("/media/")+7,t=document.location.href.length,n="https://edpuzzle.com/api/v3/media/"+document.location.href.slice(e,t),o=new XMLHttpRequest;o.open("GET",n,0),o.setRequestHeader("x-edpuzzle-web-version",__EDPUZZLE_DATA__.version),o.setRequestHeader("x-edpuzzle-referrer",document.location.href),o.send(),QuizData=JSON.parse(o.responseText)}QuizData.medias[0]&&(QuizData=QuizData.medias[0]);for(let e=0;e<QuizData.questions.length;e++){ModalContent.insertAdjacentHTML("beforeend",`"Question: ${QuizData.questions[e].body[0].html}<br>`);for(let t=0;t<QuizData.questions[e].choices.length;t++)QuizData.questions[e].choices[t].isCorrect&&ModalContent.insertAdjacentHTML("beforeend",`<b>Answer:</b> ${QuizData.questions[e].choices[t].body[0].html} <br><br>`)}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement