0% found this document useful (0 votes)
33 views

Quiz Izz

Uploaded by

Camilo Gc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Quiz Izz

Uploaded by

Camilo Gc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

var x = document.

createElement("link");
x.rel = 'stylesheet';
x.type = 'text/css'
x.href = "https://cdn.jsdelivr.net/gh/EastArctica/JS-
Plugins@master/KahootModal.css"
document.head.appendChild(x);

var xhttp = new XMLHttpRequest()


var URL = window.location.href
var found = URL.search("https://quizizz.com/join/game/");
if (found == 0) { found = true }
if (found) {
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 = "×"
var btn = document.createElement("button")
btn.id = "ModalButton"
btn.innerText = "View Answers"
btn.onclick = function() {
Modal.style.display = "block";
}
Close.onclick = function() {
Modal.style.display = "none";
}
window.onclick = function(event) {
if (event.target == Modal) {
Modal.style.display = "none";
}
}
document.getElementsByClassName("actions-container")[0].appendChild(btn)
ModalContent.appendChild(Close)
Modal.appendChild(ModalContent)
document.getElementsByClassName("root-bootstrapper-container")
[0].prepend(Modal)
if (!window.idiidk) {
window.idiidk = function() {
const offset = 33;
class Encoding {
static encode(t, e, o = 2) {
const s = this.encodeRaw(e, !0);
return `${s}${this.encodeRaw(t,!1,e)}$
{String.fromCharCode(33+s.length)}${o}`
}
static encodeRaw(t, e, o = "quizizz.com") {
let s = 0;
s = e ? o.charCodeAt(0) : o.charCodeAt(0) +
o.charCodeAt(o.length - 1);
const r = [];
for (let o = 0; o < t.length; o++) {
const n = t[o].charCodeAt(0),
c = e ? this.safeAdd(n, s) :
this.addOffset(n, s, o, 2);
r.push(String.fromCharCode(c))
}
return r.join("")
}
static decode(t, e = !1) {
if (e) {
const e = this.extractHeader(t);
return this.decodeRaw(e, !0)
} {
const e = this.decode(this.extractHeader(t), !
0),
o = this.extractData(t);
return this.decodeRaw(o, !1, e)
}
}
static decodeRaw(t, e, o = "quizizz.com") {
const s = this.extractVersion(t);
let r = 0;
r = e ? o.charCodeAt(0) : o.charCodeAt(0) +
o.charCodeAt(o.length - 1), r = -r;
const n = [];
for (let o = 0; o < t.length; o++) {
const c = t[o].charCodeAt(0),
a = e ? this.safeAdd(c, r) :
this.addOffset(c, r, o, s);
n.push(String.fromCharCode(a))
}
return n.join("")
}
static addOffset(t, e, o, s) {
return 2 === s ? this.verifyCharCode(t) ?
this.safeAdd(t, o % 2 == 0 ? e : -e) : t : this.safeAdd(t, o % 2 == 0 ? e : -e)
}
static extractData(t) {
const e = t.charCodeAt(t.length - 2) - 33;
return t.slice(e, -2)
}
static extractHeader(t) {
const e = t.charCodeAt(t.length - 2) - 33;
return t.slice(0, e)
}
static extractVersion(t) {
if ("string" == typeof t && t[t.length - 1]) {
const e = parseInt(t[t.length - 1], 10);
if (!isNaN(e)) return e
}
return null
}
static safeAdd(t, e) {
const o = t + e;
return o > 65535 ? o - 65535 + 0 - 1 : o < 0 ? 65535
- (0 - o) + 1 : o
}
static verifyCharCode(t) {
if ("number" == typeof t) return !(t >= 55296 && t <=
56319 || t >= 56320 && t <= 57343)
}
static generateIdentifier(t, e, o = 1, s = (new
Date).getTime()) {
let r = e;
return "function" == typeof e && (r = e()),
"".concat(t, ".").concat(r, "|").concat(o, ".").concat(s)
}
}
var URL = window.location.href
var GameType = URL.slice(URL.search("gameType=")+9, URL.length)
const prevConx = localStorage.getItem("previousContext"),
parsedConx = JSON.parse(prevConx),
encodedRoomHash = parsedConx.game.roomHash,
roomHash = Encoding.decode(encodedRoomHash.split("-")[1]),
data = {
roomHash: roomHash,
type: GameType
};
fetch("https://game.quizizz.com/play-api/v3/getQuestions", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(data)
}).then(t => t.json()).then(t => {
let e = 0;
for (const o of Object.keys(t.questions)) {
e++;
const s = t.questions[o],
r = s.structure.kind,
n = s.structure.answer,
c = Encoding.decode(n);
ModalContent.insertAdjacentHTML( 'beforeend',
`<b>Question: </b>`)
ModalContent.insertAdjacentHTML( 'beforeend',
`${s.structure.query.text}<br>`)
if (c[0] == "[") {
newc = c.slice(1, c.length-1)
newc = newc.split(",");
// c has been turned into an array :)

ModalContent.insertAdjacentHTML( 'beforeend', `<b>Answers:</b><br>`)


for (let i = 0; i < newc.length; i++) {

ModalContent.insertAdjacentHTML( 'beforeend', `$
{s.structure.options[Number(newc[i])].text ||
s.structure.options[Number(newc[i])].media[0].url} <br>`)
}

ModalContent.insertAdjacentHTML( 'beforeend', `<br>`)


} else {
//console.log(s.structure)

ModalContent.insertAdjacentHTML( 'beforeend', `<b>Answer:</b> $


{s.structure.options[c].text || s.structure.options[c].media[0].url} <br><br>`)
}
}
});
}
window.idiidk();
} else {
window.idiidk();
}
}

You might also like