Free javascript Hosting


myquizjs.js

Uploaded on Nov 02 2021 20:47 by examvishwa

const _0x3ddb = ['floor', 'random', '.total-wrong', '164036dcqVXI', 'length', '47488abnSpW', '.remaining-time', 'undefined', '.correct-answer', '.start-quiz-btn', '.answerBox', '.total-attempt', 'Ok,\x20But\x20You\x20Need\x20To\x20Do\x20Better.', 'toFixed', 'push', 'children', '417333wIHRFc', '14GAAMsO', '\x20/\x20', '.quiz-box', 'onclick', '.go-home-btn', '213pphNTF', 'remove', 'Good,\x20Don\x27t\x20Stop\x20Studying.', 'already-answered', 'description', '.percentage', 'Not\x20good,\x20You\x20Need\x20To\x20Do\x20Better\x20!', 'innerHTML', 'animationDelay', '149725zzCKpl', '.answer-description', 'Very\x20good,\x20Don\x27t\x20Stop\x20Studying.', 'show', 'Excellent\x20,\x20You\x20Have\x20Really\x20Good\x20Knowledge\x20.', '.question-text', '.start-again-quiz-btn', 'question', 'classList', 'click', 'createElement', '.next-question-btn', 'div', 'add', 'answer', 'option', '206078WVMbbS', 'options', 'show-correct', 'addEventListener', '.apuRM', '.quiz-over-box', '373EuQAnQ', '11023RGfNXO', 'setAttribute', '.time-up-text', '.total-questions', '.current-question-num', 'style', 'correct', 'querySelector', 'wrong'];
const _0x24848a = _0x40d6;
(function(_0x168950, _0x29fdef) {
const _0x3f7445 = _0x40d6;
while (!![]) {
try {
const _0x3d74c4 = parseInt(_0x3f7445(0x20b)) * -parseInt(_0x3f7445(0x1f1)) + -parseInt(_0x3f7445(0x1ff)) + -parseInt(_0x3f7445(0x219)) + -parseInt(_0x3f7445(0x229)) + parseInt(_0x3f7445(0x1fd)) + parseInt(_0x3f7445(0x210)) * parseInt(_0x3f7445(0x1f0)) + parseInt(_0x3f7445(0x20a));
if (_0x3d74c4 === _0x29fdef) break;
else _0x168950['push'](_0x168950['shift']());
} catch (_0x3d88dc) {
_0x168950['push'](_0x168950['shift']());
}
}
}(_0x3ddb, 0x19325));
const questionText = document[_0x24848a(0x1f8)](_0x24848a(0x21e)),
optionBox = document['querySelector'](_0x24848a(0x204)),
currentQuestionNum = document['querySelector'](_0x24848a(0x1f5)),
answerDescription = document[_0x24848a(0x1f8)](_0x24848a(0x21a)),
nextQuestionBtn = document[_0x24848a(0x1f8)](_0x24848a(0x224)),
correctAnswers = document[_0x24848a(0x1f8)](_0x24848a(0x202)),
seeResultBtn = document[_0x24848a(0x1f8)]('.see-result-btn'),
remainingTime = document[_0x24848a(0x1f8)](_0x24848a(0x200)),
timeUpText = document['querySelector'](_0x24848a(0x1f3)),
quizHomeBox = document['querySelector']('.quiz-home-box'),
quizBox = document[_0x24848a(0x1f8)](_0x24848a(0x20d)),
quizOverBox = document[_0x24848a(0x1f8)](_0x24848a(0x1ef)),
startAgainQuizBtn = document[_0x24848a(0x1f8)](_0x24848a(0x21f)),
goHomeBtn = document[_0x24848a(0x1f8)](_0x24848a(0x20f)),
startQuizBtn = document[_0x24848a(0x1f8)](_0x24848a(0x203));
let attempt = 0x0,
questionIndex = 0x0,
score = 0x0,
number = 0x0,
myArray = [],
interval;

function load() {
const _0x544d66 = _0x24848a;
number++, questionText['innerHTML'] = qBook[questionIndex][_0x544d66(0x220)], creatOptions(), scoreBoard(), currentQuestionNum['innerHTML'] = number + _0x544d66(0x20c) + qBook['length'];
}

function creatOptions() {
const _0x365260 = _0x24848a;
optionBox[_0x365260(0x217)] = '';
let _0xa4492d = 0.2;
for (let _0x4bce69 = 0x0; _0x4bce69 < qBook[questionIndex][_0x365260(0x22a)][_0x365260(0x1fe)]; _0x4bce69++) {
const _0x18343c = document[_0x365260(0x223)](_0x365260(0x225));
_0x18343c[_0x365260(0x217)] = qBook[questionIndex]['options'][_0x4bce69], _0x18343c[_0x365260(0x221)][_0x365260(0x226)](_0x365260(0x228)), _0x18343c['id'] = _0x4bce69, _0x18343c[_0x365260(0x1f6)][_0x365260(0x218)] = _0xa4492d + 's', _0xa4492d = _0xa4492d + 0.2, _0x18343c[_0x365260(0x1f2)](_0x365260(0x20e), 'check(this)'), optionBox['appendChild'](_0x18343c);
}
}

function generateRandomQuestion() {
const _0x2bf244 = _0x24848a,
_0x24b502 = Math[_0x2bf244(0x1fa)](Math[_0x2bf244(0x1fb)]() * qBook['length']);
let _0x1be593 = 0x0;
if (myArray['length'] == 0x0) questionIndex = _0x24b502;
else {
for (let _0xf2ec1 = 0x0; _0xf2ec1 < myArray[_0x2bf244(0x1fe)]; _0xf2ec1++) {
_0x24b502 == myArray[_0xf2ec1] && (_0x1be593 = 0x1);
}
if (_0x1be593 == 0x1) {
generateRandomQuestion();
return;
} else questionIndex = _0x24b502;
}
myArray[_0x2bf244(0x208)](_0x24b502), load();
}

function check(_0x352e7b) {
const _0x2ba6ab = _0x24848a,
_0x1ce4f0 = _0x352e7b['id'];
if (_0x1ce4f0 == qBook[questionIndex][_0x2ba6ab(0x227)]) _0x352e7b['classList'][_0x2ba6ab(0x226)](_0x2ba6ab(0x1f7)), score++, scoreBoard();
else {
_0x352e7b[_0x2ba6ab(0x221)][_0x2ba6ab(0x226)](_0x2ba6ab(0x1f9));
for (let _0x2bc157 = 0x0; _0x2bc157 < optionBox['children'][_0x2ba6ab(0x1fe)]; _0x2bc157++) {
optionBox['children'][_0x2bc157]['id'] == qBook[questionIndex]['answer'] && optionBox['children'][_0x2bc157][_0x2ba6ab(0x221)][_0x2ba6ab(0x226)]('show-correct');
}
}
attempt++, disableOptions(), showAnswerDescription(), showNextQuestionBtn(), stopTimer(), number == qBook[_0x2ba6ab(0x1fe)] && quizOver();
}

function timeIsUp() {
const _0x1444a6 = _0x24848a;
showTimeUpText();
for (let _0x5ef475 = 0x0; _0x5ef475 < optionBox[_0x1444a6(0x209)][_0x1444a6(0x1fe)]; _0x5ef475++) {
optionBox[_0x1444a6(0x209)][_0x5ef475]['id'] == qBook[questionIndex][_0x1444a6(0x227)] && optionBox['children'][_0x5ef475]['classList'][_0x1444a6(0x226)](_0x1444a6(0x1ec));
}
disableOptions(), showAnswerDescription(), showNextQuestionBtn(), number == qBook[_0x1444a6(0x1fe)] && quizOver();
}

function disableOptions() {
const _0x5e18c1 = _0x24848a;
for (let _0x181631 = 0x0; _0x181631 < optionBox[_0x5e18c1(0x209)][_0x5e18c1(0x1fe)]; _0x181631++) {
optionBox[_0x5e18c1(0x209)][_0x181631][_0x5e18c1(0x221)][_0x5e18c1(0x226)](_0x5e18c1(0x213));
}
}

function showAnswerDescription() {
const _0x124e80 = _0x24848a;
typeof qBook[questionIndex][_0x124e80(0x214)] !== _0x124e80(0x201) && (answerDescription['classList'][_0x124e80(0x226)](_0x124e80(0x21c)), answerDescription[_0x124e80(0x217)] = qBook[questionIndex][_0x124e80(0x214)]);
}

function hideAnswerDescription() {
const _0x14d12f = _0x24848a;
answerDescription[_0x14d12f(0x221)][_0x14d12f(0x211)](_0x14d12f(0x21c)), answerDescription['innerHTML'] = '';
}

function showNextQuestionBtn() {
const _0xb35a44 = _0x24848a;
nextQuestionBtn[_0xb35a44(0x221)][_0xb35a44(0x226)](_0xb35a44(0x21c));
}

function _0x40d6(_0x446d02, _0x3396a2) {
return _0x40d6 = function(_0x3ddb45, _0x40d642) {
_0x3ddb45 = _0x3ddb45 - 0x1ec;
let _0x39292c = _0x3ddb[_0x3ddb45];
return _0x39292c;
}, _0x40d6(_0x446d02, _0x3396a2);
}

function hideNextQuestionBtn() {
const _0x44e9ef = _0x24848a;
nextQuestionBtn[_0x44e9ef(0x221)][_0x44e9ef(0x211)]('show');
}

function showTimeUpText() {
const _0x18fb7a = _0x24848a;
timeUpText[_0x18fb7a(0x221)]['add'](_0x18fb7a(0x21c));
}

function hideTimeUpText() {
const _0x5f33ec = _0x24848a;
timeUpText[_0x5f33ec(0x221)][_0x5f33ec(0x211)](_0x5f33ec(0x21c));
}

function scoreBoard() {
const _0x26477c = _0x24848a;
correctAnswers[_0x26477c(0x217)] = score;
}
nextQuestionBtn['addEventListener'](_0x24848a(0x222), nextQuestion);

function nextQuestion() {
generateRandomQuestion(), hideNextQuestionBtn(), hideAnswerDescription(), hideTimeUpText(), addTimer();
}

function quizResult() {
const _0x2ba5a3 = _0x24848a;
document['querySelector'](_0x2ba5a3(0x1f4))[_0x2ba5a3(0x217)] = qBook[_0x2ba5a3(0x1fe)], document[_0x2ba5a3(0x1f8)](_0x2ba5a3(0x205))[_0x2ba5a3(0x217)] = attempt, document[_0x2ba5a3(0x1f8)]('.total-correct')['innerHTML'] = score, document[_0x2ba5a3(0x1f8)](_0x2ba5a3(0x1fc))[_0x2ba5a3(0x217)] = attempt - score;
const _0x307855 = score / qBook[_0x2ba5a3(0x1fe)] * 0x64,
_0x459176 = _0x307855[_0x2ba5a3(0x207)](0x2);
document['querySelector'](_0x2ba5a3(0x215))[_0x2ba5a3(0x217)] = _0x459176 + '%';
const _0x199066 = document[_0x2ba5a3(0x1f8)](_0x2ba5a3(0x1ee));
if (_0x459176 >= 0x64) _0x199066['innerHTML'] = _0x2ba5a3(0x21d);
else {
if (_0x459176 >= 0x5a) _0x199066['innerHTML'] = 'Nice,\x20You\x20Have\x20Really\x20Good\x20Knowledge\x20.';
else {
if (_0x459176 >= 0x3c) _0x199066[_0x2ba5a3(0x217)] = _0x2ba5a3(0x21b);
else {
if (_0x459176 >= 0x28) _0x199066[_0x2ba5a3(0x217)] = _0x2ba5a3(0x212);
else _0x459176 >= 0x14 ? _0x199066[_0x2ba5a3(0x217)] = _0x2ba5a3(0x206) : _0x199066[_0x2ba5a3(0x217)] = _0x2ba5a3(0x216);
}
}
}
}

function resetQuiz() {
attempt = 0x0, score = 0x0, number = 0x0, myArray = [];
}

function quizOver() {
const _0x227109 = _0x24848a;
nextQuestionBtn['classList']['remove'](_0x227109(0x21c)), seeResultBtn[_0x227109(0x221)][_0x227109(0x226)](_0x227109(0x21c));
}
seeResultBtn[_0x24848a(0x1ed)]('click', () => {
const _0x318847 = _0x24848a;
quizBox['classList'][_0x318847(0x211)](_0x318847(0x21c)), seeResultBtn[_0x318847(0x221)][_0x318847(0x211)]('show'), quizOverBox[_0x318847(0x221)][_0x318847(0x226)](_0x318847(0x21c)), quizResult();
}), startAgainQuizBtn[_0x24848a(0x1ed)]('click', () => {
const _0x547385 = _0x24848a;
quizBox['classList'][_0x547385(0x226)](_0x547385(0x21c)), quizOverBox[_0x547385(0x221)]['remove']('show'), resetQuiz(), nextQuestion();
}), goHomeBtn['addEventListener'](_0x24848a(0x222), () => {
const _0x387c9e = _0x24848a;
quizOverBox[_0x387c9e(0x221)][_0x387c9e(0x211)](_0x387c9e(0x21c)), quizHomeBox[_0x387c9e(0x221)][_0x387c9e(0x226)]('show'), resetQuiz();
}), startQuizBtn[_0x24848a(0x1ed)](_0x24848a(0x222), () => {
const _0x478055 = _0x24848a;
quizHomeBox[_0x478055(0x221)][_0x478055(0x211)]('show'), quizBox['classList']['add'](_0x478055(0x21c)), nextQuestion();
});

function addTimer() {
let timeLimit = 30;
remainingTime.innerHTML = timeLimit;
remainingTime.classList.remove("less-time");
interval = setInterval(() => {
timeLimit--;
if (timeLimit < 10) {
timeLimit = "0" + timeLimit;
}
if (timeLimit < 10) {
remainingTime.classList.add("less-time");
}
remainingTime.innerHTML = timeLimit;
if (timeLimit == 0) {
clearInterval(interval);
timeIsUp();
}
}, 1000)
}

function stopTimer() {
clearInterval(interval);
}

Back to list