您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
An efficient Blooket overhaul with blookedex integrations.
当前为
// ==UserScript== // @name Blookedex Integration // @namespace http://tampermonkey.net/ // @version 2025-05-18-2 // @description An efficient Blooket overhaul with blookedex integrations. // @author fsscooter // @match https://*.blooket.com/* // @icon https://www.google.com/s2/favicons?sz=64&domain=blooket.com // @grant none // @license GNU GPLv3 // ==/UserScript== (function() { 'use strict'; //w3schools minfied cookie managers function setCookie(e,t,o){let i=new Date;i.setTime(i.getTime()+864e5*o);let n="expires="+i.toUTCString();document.cookie=`${e}=${encodeURIComponent(t)}; ${n}; path=/; domain=.blooket.com; secure; samesite=Lax`}function getCookie(e){let t=e+"=",o=decodeURIComponent(document.cookie),i=o.split(";");for(let n of i){for(;" "===n.charAt(0);)n=n.substring(1);if(0===n.indexOf(t))return n.substring(t.length,n.length)}return null} const themes = [ { name: "sunset", primary: "#E44C51", secondary: "#FFA41B", background: ["#5d87e3", "#ff3b8c"] }, { name: "forest", primary: "#2E8B57", secondary: "#A3C586", background: ["#1B512D", "#A4DE02"] }, { name: "ocean", primary: "#0077B6", secondary: "#90E0EF", background: ["#00B4D8", "#03045E"] }, { name: "midnight", primary: "#1C1C2E", secondary: "#3E3E55", background: ["#3A3A7C", "#0F0F2D"] }, { name: "sunrise", primary: "#FFA07A", secondary: "#FFD700", background: ["#FFDEE9", "#B5FFFC"] }, { name: "desert", primary: "#D97B0D", secondary: "#F5CBA7", background: ["#F2E6D8", "#C97C5D"] }, { name: "aurora", primary: "#7F00FF", secondary: "#00FF87", background: ["#00FFC3", "#3E1E68"] }, { name: "space", primary: "#4B0082", secondary: "#9370DB", background: ["#1F2833", "#0B0C10"] }, { name: "peach", primary: "#FFADAD", secondary: "#FFD6A5", background: ["#FFEACD", "#FFDAC1"] }, { name: "ice", primary: "#A0E9FD", secondary: "#CAF0F8", background: ["#B2EBF2", "#E0F7FA"] }, { name: "coral", primary: "#148cdf", secondary: "#ee7de9", background: ["#ef1284", "#00b898"] }, { name: "charcoal", primary: "#111a24", secondary: "#f8ee00", background: ["#aba400", "#1f3042"] }, { name: "cotton candy", primary: "#ffcbcb", secondary: "#c9fdff", background: ["#9db1ea", "#e47e98"] }, { name: "minecraft", primary: "#61371f", secondary: "#70b237", background: ["#3c44aa", "#3ab3da"] }, { name: "easter", primary: "#F8DC8A", secondary: "#F4A8CF", background: ["#B6E7B9", "#93DE8B"] }, { name: "halloween", primary: "#F86D01", secondary: "#18e810", background: ["#A805F7", "#DA03F6"] }, { name: "usa", primary: "#424173", secondary: "#B52A3A", background: "repeating-linear-gradient(-5deg,#dbdbdb,#dbdbdb 60px,#B52A3A 60px,#B52A3A 120px);" }, { name: "summer", primary: "#72D6E4", secondary: "#D8A93F", background: ["#89CDDA", "#FBDCA5"] }, { name: "autumn", primary: "#C16A19", secondary: "#DFA628", background: ["#AD3B2D", "#D8284D"] }, { name: "winter", primary: "#96CEFE", secondary: "#6C80BE", background: ["#A4F4FF", "#75A5C3"] }, { name: "christmas", primary: "#C9001C", secondary: "#1FB34F", background: "radial-gradient(ellipse at bottom, #4e9a51 0%, #3d7b42 40%, #2f5e34 100%);" }, { name: "marti gras", primary: "#A016FC", secondary: "#27DA3B", background: "linear-gradient(45deg,rgba(47, 163, 75, 1) 0%, rgba(140, 71, 151, 1) 50%, rgba(255, 204, 40, 1) 100%);" } ]; // { name: "halloween", primary: "", secondary: "", background: ["", ""] } if (getCookie("blxdextheme") == null) { setCookie("blxdextheme", "5") } const theme = Number(getCookie("blxdextheme")) let background = "#fff" if (Array.isArray(themes[theme].background)) { background = 'linear-gradient('+themes[theme].background[0]+', '+themes[theme].background[1]+')'; } else { background = themes[theme].background; } console.log(background) console.log("Blooket extension initialized"); const style = document.createElement('style'); style.innerHTML = ` :root { --purple: ${themes[theme].primary}; } `; document.head.appendChild(style); const applyBackground = () => { // Try primary selector let bgGradient = document.querySelector("div[data-sentry-component='Blooks']")?.children[0]; // If not found, try fallback if (!bgGradient) { if (window.app?.children?.[0]?.children?.[0]?.children?.[6]) { bgGradient = window.app.children[0].children[0].children[6]; } }; if (!bgGradient) return; if (!bgGradient.className.includes('background')) return; bgGradient.style = "background: "+background console.log(bgGradient.style) }; const correctColor = (el) => { const style = getComputedStyle(el); ['color', 'backgroundColor', 'borderColor'].forEach(prop => { const val = style[prop]; if (val === 'rgb(154, 73, 170)' || val === 'rgb(64, 17, 95)') { el.style[prop] = themes[theme].primary; } if (val === 'rgb(11, 194, 207)' || val === 'rgb(122, 3, 157)') { el.style[prop] = themes[theme].secondary; } if (val === 'rgb(154, 73, 170)' && el.className.includes("statContainer")) { el.style[prop] = themes[theme].secondary; } }); }; const insertTab = (sideBar) => { if (typeof sideBar == 'undefined' || !sideBar.className.includes('sidebar') || sideBar.dataset.injected == "true") return; let clonedNode = sideBar.children[Math.min(3,sideBar.children.length-2)].cloneNode(true); if (sideBar.tagName == 'NAV') { clonedNode = sideBar.children[0].children[2].children[sideBar.children.length - 1].children[0].cloneNode(true); } clonedNode.href = "/my-sets?blookedex=true"; clonedNode.children[0].classList.remove("fa-suitcase") clonedNode.classList.forEach(c => c.includes('pageSelected') && clonedNode.classList.remove(c)); clonedNode.children[0].classList.add("fa-adjust") clonedNode.children[1].textContent = "Blookedex" clonedNode.onclick = function() { console.log("sucess") } if (sideBar.tagName == 'NAV') { (function(){if(!document.querySelector('link[href*="font-awesome"],link[href*="fontawesome"]')){let l=document.createElement('link');l.rel='stylesheet';l.href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css';document.head.appendChild(l);}})(); clonedNode.children[0].remove() const icon = document.createElement('i') icon.className = "fas fa-adjust" icon.style = "font-size:22px;width:26px;text-align:center;" clonedNode.prepend(icon) const newElem = document.createElement('ul') newElem.appendChild(clonedNode) sideBar.children[0].children[2].appendChild(newElem) return; } if (window.location.href.includes("blookedex=true")) clonedNode.className = window.app.dataset.selectedClasses; sideBar.insertBefore(clonedNode, sideBar.childNodes[sideBar.children.length-1]) sideBar.dataset.injected = "true" }; const createCustomPage = () => { const body = window.app.children[0].children[0].children[6].cloneNode(false); window.app.children[0].children[0].children[6].style.display = "none"; body.style = "display:flex;align-items:center;justify-content:center"; body.innerHTML = '<div style="background:'+background+';position:fixed;width:100%;height:100%;left:0;top:0;overflow:hidden;"><div style="background-image: url("https://ac.blooket.com/dashclassic/assets/BlookCheckers-BykpA7vd.png");position: absolute;width: 200%;height: 200%;top: 50%;left: 50%;background-size: 550px;background-position: -100px -100px;opacity: .1;transform: translate(-50%,-50%) rotate(15deg)"></div></div>'; const themeSection = document.createElement("div") themeSection.style = "position:relative;background-color:#efefef22;backdrop-filter:blur(10px);border:1px solid rgb(108, 117, 125);border-radius:20px;width:50rem;padding:20px;" themeSection.innerHTML = "<div style='font-family: Titan One;font-size: 44px;font-weight: 700;margin: 15px 5% 10px;color: #efefef;text-shadow:0 0 10px rgba(0,0,0,0.2);'>Select a Theme</div>" const themesContainer = document.createElement("div") themesContainer.style = "display: flex;flex-wrap: wrap;gap: 10px;width:100%;justify-content:center;"; for (let i = 0;i < themes.length;i++) { let background = "#fff" if (Array.isArray(themes[i].background)) { background = 'linear-gradient('+themes[i].background[0]+', '+themes[i].background[1]+')'; } else { background = themes[i].background; } const themeBox = document.createElement("div") themeBox.onclick = function() {setCookie("blxdextheme", String(i));window.location.reload();} themeBox.style = "width:120px;height:100px;border:2px solid "+((theme == i) ? "#0377fc" : "#e4e8ec33")+";border-radius:10px;background:#efefef22;--primary:"+themes[i].primary+";--secondary:"+themes[i].secondary+";--bgGradient:"+background+";"; const previewBG = document.createElement("div"); previewBG.style = "width:100%;height:80%;background:var(--bgGradient);border-radius:10px;cursor:pointer;overflow:hidden;position:relative;" const previewBar = document.createElement("div"); previewBar.style = "position:absolute;left:0;top:0;height:100%;background:var(--primary);width:20px;box-shadow: 0 0 10px rgba(0,0,0,0.2), inset -3px 0 0 rgba(0,0,0,0.05);display:flex;flex-direction:column;gap:5px;padding:5px;align-items:center;" previewBar.innerHTML = "<div style='height:3px;width:15px;background:#efefefee;border-radius:10px;'></div><div style='height:8px;width:18px;background:"+themes[i].secondary+";border-radius:2px;'></div><div style='height:2px;width:10px;background:#efefefee;border-radius:10px;'></div><div style='height:2px;width:13px;background:#efefefee;border-radius:10px;'></div><div style='height:2px;width:15px;background:#efefefee;border-radius:10px;'></div><div style='height:2px;width:10px;background:#efefefee;border-radius:10px;'></div><div style='height:2px;width:8px;background:#efefefee;border-radius:10px;'></div><div style='height:2px;width:13px;background:#efefefee;border-radius:10px;'></div>" previewBG.appendChild(previewBar) themeBox.appendChild(previewBG) const themeName = document.createElement("div") themeName.textContent = themes[i].name themeName.style = "margin-left:7px;" themeBox.appendChild(themeName) themesContainer.appendChild(themeBox) } themeSection.appendChild(themesContainer) body.appendChild(themeSection) window.app.children[0].children[0].appendChild(body) const sidebar = window.app.children[0].children[0].children[0] const mo = new MutationObserver(() => { if (sidebar.children.length === 10) { mo.disconnect(); insertTab(sidebar); } }); mo.observe(sidebar, { childList: true }); }; const walkAndFix = (node) => { if (node.nodeType === Node.ELEMENT_NODE) { correctColor(node); if (typeof node.className == 'string' && node.className.includes("background")) { applyBackground(); console.log(node) } if (typeof node.className == 'string' && (node.className.includes("bottomRow") || node.className.includes("Sidebar_footerWrapper"))) { try { insertTab([...document.querySelectorAll('*')].find(e => String(e.className).includes('sidebar'))); } catch (err) {} } if (typeof node.className == 'string' && (node.className.includes("spacer") && node.parentNode.className.includes("profileBody")) && window.location.href.includes("blookedex=true")) { createCustomPage(); } if (typeof node.className == 'string' && (node.className.includes("topFolderButton") || node.className.includes("searchBar")) && window.location.href.includes("blookedex=true")) { node.style.display = "none"; } if (typeof node.className == 'string' && node.className.includes("profileBody") && !window.location.href.includes("blookedex=true") && (window.location.pathname != "/stats" || window.location.pathname != "/blooks")) { window.app.children[0].children[0].classList.add("blookedex-bgInject"); if (window.app.dataset.backgroundInjected == "true") document.getElementById("blookedex-customStyles").remove(); const style = document.createElement('style'); style.id = "blookedex-customStyles" style.innerHTML = ` .blookedex-bgInject { background-image: ${background}; } .blookedex-bgInject::before { content: "";display:block;position:fixed; background-image: url(https://ac.blooket.com/dashclassic/assets/BlookCheckers-BykpA7vd.png);width: 200%;height: 200%;top: 50%;left: 50%;background-size: 550px;background-position: -100px -100px;opacity: .1;transform: translate(-50%,-50%) rotate(15deg); } .${[...node.querySelectorAll('*')].find(e => String(e.className).includes('header'))?.className}, .${[...node.querySelectorAll('*')].find(e => String(e.className).includes('subheader'))?.className} { font-family: Titan One; color:white; text-shadow: 3px 3px 0 rgba(0,0,0,0.4); } `; document.head.appendChild(style); window.app.dataset.backgroundInjected = "true" } if (typeof node.className == 'string' && node.className.includes("pageSelected") && window.location.href.includes("blookedex=true") && node.href == "https://dashboard.blooket.com/my-sets") { window.app.dataset.selectedClasses = node.className node.classList.forEach(c => c.includes('pageSelected') && node.classList.remove(c)); node.style = "" node.addEventListener('click', function() { window.location.href = "/my-sets"; }); node.childrenNodes[0].style = "" node.childrenNodes[1].style = "" } if (node.children.length) { Array.from(node.children).forEach(walkAndFix); } } }; const observer = new MutationObserver(mutations => { for (const mutation of mutations) { mutation.addedNodes.forEach(walkAndFix); } }); observer.observe(document.body, { childList: true, subtree: true }); // Initial run on current elements document.querySelectorAll('*').forEach(correctColor); applyBackground(); })();