Highlight Answers

View All The Correct Answers on Blooket

  1. // ==UserScript==
  2. // @name Highlight Answers
  3. // @namespace http://greasyfork.org/
  4. // @version 13
  5. // @description View All The Correct Answers on Blooket
  6. // @author You
  7. // @match https://*.blooket.com/*
  8. // @exclude https://play.blooket.com/play
  9. // @icon https://res.cloudinary.com/blooket/image/upload/v1613003832/Blooks/purpleAstronaut.svg
  10. // @grant none
  11. // @license MIT
  12. // ==/UserScript==
  13. (() => {
  14. const cheat = (async () => {
  15. setInterval(() => {
  16. const { stateNode: { state, props } } = Object.values((function react(r = document.querySelector("body>div")) { return Object.values(r)[1]?.children?.[0]?._owner.stateNode ? r : react(r.querySelector(":scope>div")) })())[1].children[0]._owner;
  17. [...document.querySelectorAll(`[class*="answerContainer"]`)].forEach((answer, i) => {
  18. if ((state.question || props.client.question).correctAnswers.includes((state.question || props.client.question).answers[i])) answer.style.backgroundColor = "rgb(0, 207, 119)";
  19. else answer.style.backgroundColor = "rgb(189, 15, 38)";
  20. });
  21. });
  22. });
  23. let img = new Image;
  24. img.src = "https://raw.githubusercontent.com/05Konz/Blooket-Cheats/main/autoupdate/timestamps/global/intervals/highlightAnswers.png?" + Date.now();
  25. img.crossOrigin = "Anonymous";
  26. img.onload = function() {
  27. const c = document.createElement("canvas");
  28. const ctx = c.getContext("2d");
  29. ctx.drawImage(img, 0, 0, this.width, this.height);
  30. let { data } = ctx.getImageData(0, 0, this.width, this.height), decode = "", last;
  31. for (let i = 0; i < data.length; i += 4) {
  32. let char = String.fromCharCode(data[i + 1] * 256 + data[i + 2]);
  33. decode += char;
  34. if (char == "/" && last == "*") break;
  35. last = char;
  36. }
  37. const [_, time, error] = decode.match(/LastUpdated: (.+?); ErrorMessage: "([\s\S]+?)"/);
  38. if (parseInt(time) <= 1708817191528) cheat();
  39. }
  40. img.onerror = img.onabort = () => {
  41. img.onerror = img.onabort = null;
  42. cheat();
  43. }
  44. })();