Blooket Utilities

Some Useful Blooket Hacks.

// ==UserScript==
// @name         Blooket Utilities
// @namespace    https://github.com/tungdo0602/Blooket-stuffs
// @version      1.2.9
// @description  Some Useful Blooket Hacks.
// @author       tungdo0602 (https://github.com/tungdo0602)
// @match        *://*.blooket.com/*
// @match        *://blooket.com/*
// @icon         data:image/svg+xml;base64,PHN2ZyBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMzAwIDM0NSI+PGRlZnM+PHN0eWxlPi5jbHMtMXtmaWxsOnVybCgjbGluZWFyLWdyYWRpZW50KTt9LmNscy0ye2ZpbGw6dXJsKCNsaW5lYXItZ3JhZGllbnQtMik7fS5jbHMtM3tmaWxsOiM5MDY4YWQ7fS5jbHMtNHtmaWxsOiMwMGMwZjM7fS5jbHMtNXtmaWxsOiNmZmY7fS5jbHMtNntmaWxsOiNmZmNkMDU7fS5jbHMtMTIsLmNscy03e2ZpbGw6bm9uZTt9LmNscy03e3N0cm9rZTojY2Q4ZTJhO3N0cm9rZS13aWR0aDo4Ljk5cHg7fS5jbHMtMTIsLmNscy0xOCwuY2xzLTd7c3Ryb2tlLW1pdGVybGltaXQ6MTA7fS5jbHMtOHtmaWxsOiNmYWJjMmU7fS5jbHMtOXtmaWxsOiM0MTQwNDI7fS5jbHMtMTB7ZmlsbDojNjY0MDJkO30uY2xzLTExe2ZpbGw6IzJmMmMzODt9LmNscy0xMntzdHJva2U6IzJmMmMzODtzdHJva2Utd2lkdGg6NnB4O30uY2xzLTEze29wYWNpdHk6MC44O30uY2xzLTE0e2ZpbGw6IzdjYTFkNTt9LmNscy0xNXtmaWxsOiM5ZGM2ZWE7fS5jbHMtMTZ7ZmlsbDojNTUzMTkyO30uY2xzLTE3e2ZpbGw6IzYxNDU5Y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PSJjbHMtMTYiIGN4PSIxNy44MSIgY3k9IjE1OC4yNiIgcj0iOS4yOCIvPjxyZWN0IGNsYXNzPSJjbHMtMTkiIHg9IjguNzciIHk9IjExMC4zMyIgd2lkdGg9IjE4LjA5IiBoZWlnaHQ9IjkuODEiIHJ4PSIzLjgxIi8+PHBhdGggY2xhc3M9ImNscy0yMCIgZD0iTTIzNi43NSw5OC42YTE5Ljg0LDE5Ljg0LDAsMCwxLDE5LjgyLDE5LjgyVjI0MC41OGExOS44NCwxOS44NCwwLDAsMS0xOS44MiwxOS44Mkg2My4xYTE5Ljg0LDE5Ljg0LDAsMCwxLTE5LjgyLTE5LjgyVjExOC40MkExOS44NCwxOS44NCwwLDAsMSw2My4xLDk4LjZIMjM2Ljc1bTAtOEg2My4xYTI3LjgsMjcuOCwwLDAsMC0yNy44MSwyNy44VjI0MC41OGEyNy44LDI3LjgsMCwwLDAsMjcuODEsMjcuOEgyMzYuNzVhMjcuOCwyNy44LDAsMCwwLDI3LjgxLTI3LjhWMTE4LjQyYTI3LjgsMjcuOCwwLDAsMC0yNy44MS0yNy44WiIvPjxwYXRoIGNsYXNzPSJjbHMtMjEiIGQ9Ik0yMzYuNzUsOTEuNmExOS44NCwxOS44NCwwLDAsMSwxOS44MiwxOS44MlYyMzMuNThhMTkuODQsMTkuODQsMCwwLDEtMTkuODIsMTkuODJINjMuMWExOS44NCwxOS44NCwwLDAsMS0xOS44Mi0xOS44MlYxMTEuNDJBMTkuODQsMTkuODQsMCwwLDEsNjMuMSw5MS42SDIzNi43NW0wLThINjMuMWEyNy44LDI3LjgsMCwwLDAtMjcuODEsMjcuOFYyMzMuNThhMjcuOCwyNy44LDAsMCwwLDI3LjgxLDI3LjhIMjM2Ljc1YTI3LjgsMjcuOCwwLDAsMCwyNy44MS0yNy44VjExMS40MmEyNy44LDI3LjgsMCwwLDAtMjcuODEtMjcuOFoiLz48L2c+PC9zdmc+
// @grant        none
// @run-at       document-end
// @supportURL   https://github.com/tungdo0602/Blooket-stuffs/issues
// @license      MIT
// @source       https://github.com/tungdo0602/Blooket-stuffs/blob/main/userscripts/blooketUtilities.js
// ==/UserScript==

(function() {
    'use strict';
(function(){
    function getStateNode(){
        for(let i of Object.keys(document.querySelector("#app>div>div"))){
            if(i.toString().includes("__reactEventHandlers")){
                for(let p of Object.values(document.querySelector("#app>div>div")[i].children.filter(n=>n))){
                    if(p._owner&&p._owner.stateNode)return p._owner.stateNode
                }
            }
        }
    }
    function bypass(){
        let _bypass = document.createElement("iframe");
        _bypass.style.display = 'none';
        document.body.appendChild(_bypass);
        return {window: _bypass.contentWindow, document: _bypass.contentDocument}
    }
    function findByProp(prop,first=true){
        const wp = Object.values(window.webpackJsonp.push([
            [], {
                ['']: (_, a, b) => {
                    a.cache = b.c
                },
            },
            [
                ['']
            ],
        ]).cache);
        if(first){
            return wp.find((x)=>x.exports&&x.exports.a&&x.exports.a[prop]).exports.a;
        }else{
            return wp.filter(x=>x.exports?.a&&x.exports?.a[prop]).map(n=>n.exports.a)
        }
    }
    function addReward(){
        return findByProp("post").post("https://play.blooket.com/api/playersessions/solo", {
            gameMode: "Defense"
        }).then(x=>{
            return findByProp("put").put("https://play.blooket.com/api/users/add-rewards", {
                addedTokens: 500,
                addedXp: 500,
                t: x.data.t
            }).then((res)=>{
                return res.status;
            });
        });
    }
    if(location.host==="play.blooket.com"){
        let tmr = new Date();
        tmr.setDate(tmr.getDate()+1);
        let ls = bypass().window.localStorage;
        findByProp("get").get("https://play.blooket.com/api/users/me").then(res=>{
            if(res.data){
                if(ls.getItem("nextReward")){
                    if((new Date().getDate())>=Number(ls.getItem("nextReward"))){
                        ls.setItem("nextReward", tmr.getDate());
                        console.log("[Logger] You're not claim reward yet.");
                        addReward().then(e=>{
                            if(e===200){
                                console.log("[Logger] Successfully added reward | " + e);
                            }else{
                                console.log("[Logger] Failed to add reward | " + e);
                            }
                        });
                    }else{
                        console.log("[Logger] You already claimed today.");
                    }
                }else{
                    ls.setItem("nextReward", tmr.getDate());
                    addReward();
                }
            }else{
                console.log("[Logger] You're not login yet.");
            }
        });
        window.setInterval(()=>{
            try{
                if(location.href.toLowerCase().includes("/lobby")){
                    getStateNode().state.unlocks = Object.keys(findByProp("Astronaut"));
                }else if(location.href.toLowerCase().includes("/register")){
                    Array.from(document.querySelectorAll("input")).map(n=>n.maxLength = 120);
                }else if(location.href.toLowerCase().includes("/host")){
                    getStateNode().props.user.data.plan = 'Plus Flex';
                    getStateNode().state.isBen = getStateNode().state.plus = getStateNode().state.canPlusHost = true;
                }
            }catch{}
            getStateNode().forceUpdate();
        });
    }else if(location.host==="dashboard.blooket.com"){
        window.setInterval(()=>{
            if(location.href.toLowerCase().includes("my-sets")){
                if(!document.querySelector("#folderColorPicker")){
                    try{
                        document.querySelector("div[class*='colorsHolder']").innerHTML = `<input id="folderColorPicker" style="margin: 0 auto;" type="color">`
                        document.querySelector("#folderColorPicker").onchange = function(e){
                            getStateNode().setState({folderColor: e.target.value})
                        }
                    }catch{}
                }
                Array.from(document.querySelectorAll("div")).filter(x=>x.className.includes("FolderButton")).map(x=>x[Object.keys(x).filter(x=>x.includes("EventHandler"))]).map(x=>x.onClick=function(){
                    getStateNode().setState({
                        creatingFolder: true
                    });
                });
            }
        })
    }
    window["blooket"] = {
        bypass: bypass,
        getStateNode: getStateNode,
        findByProp: findByProp,
    }
})();
})();