Advertisement
TheTintin

BLGO Quizz Full Tricherie

Nov 20th, 2021
1,309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function loadQuestions() {
  2.     const questions = {}
  3.  
  4.     dayJSONs.forEach(month => {
  5.         month.days.forEach(day => {
  6.             if (!day.questions) return
  7.  
  8.             day.questions.forEach(question => {
  9.                 questions[question.title] = question.greatAnswer
  10.             })
  11.         })
  12.     })
  13.  
  14.     return questions
  15. }
  16.  
  17. function processQuestions(questions) {
  18.     const title = document.getElementById('questionTitle')
  19.     if (!title) {
  20.         console.log('No question')
  21.         return
  22.     }
  23.  
  24.     const answer = questions[title.textContent]
  25.  
  26.     console.log('Question :', title.textContent)
  27.     console.log('Réponse :', answer)
  28.  
  29.     const answers = {}
  30.     document.querySelectorAll('#AnswersDiv .answerButton').forEach((answerButton) => {
  31.         const answerValue = answerButton.querySelector('#aValue')
  32.         answers[answerValue.textContent] = answerButton
  33.     })
  34.  
  35.     answers[answer].click()
  36.  
  37.     if (document.getElementById('finalScoreScreen').style.display !== 'none') {
  38.         console.log('Done !')
  39.         const score = document.getElementById('finalScore').textContent
  40.         console.log('Score :', score)
  41.         return
  42.     }
  43.  
  44.     setTimeout(() => {
  45.         processQuestions(questions)
  46.     }, 200)
  47. }
  48.  
  49. function play() {
  50.     const questions = loadQuestions()
  51.  
  52.     const startButton = document.getElementById('StartButton')
  53.     if (!startButton) {
  54.         console.log('No start button')
  55.         return
  56.     }
  57.  
  58.     startButton.click()
  59.  
  60.     processQuestions(questions)
  61. }
  62.  
  63. play()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement