您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Blooket hacks menu for enhancing gameplay.
当前为
- // ==UserScript==
- // @name Blooket Hacks
- // @namespace http://tampermonkey.net/
- // @version 1.2
- // @description Blooket hacks menu for enhancing gameplay.
- // @author Jesse Nicolaï
- // @match https://*.blooket.com/*
- // @icon https://ac.blooket.com/play-l/favicon.ico
- // @grant GM_addStyle
- // @license MIT
- // ==/UserScript==
- (function() {
- 'use strict';
- // Create the menu
- const menuContent = document.createElement('div');
- menuContent.id = 'menuContent';
- menuContent.style.cssText = `
- position: fixed;
- top: 1%;
- left: 1%;
- color: #fff;
- background: #1c1c1c;
- padding-top: 1vh;
- padding-bottom: 1vh;
- padding-left: 3vh;
- padding-right: 3vh;
- border-radius: 12px;
- z-index: 9999;
- cursor: move;
- font-size: 14px; /* Adjust font size */
- `;
- menuContent.innerHTML = `
- <h1 style="margin-bottom: 5px; text-align: center;">Blooket Hacks</h1>
- <br>
- <div id="menuList" style="text-align: center;">
- <button id="highlightAnswers" class="menu-button">Highlight Answers: Off</button><br>
- <button id="removeWrongAnswers" class="menu-button">Remove Wrong Answers: Off</button><br>
- <button id="autoAnswer" class="menu-button">Auto Answer: Off</button><br>
- </div>
- <div style="text-align: center; margin-top: 5px;">
- <br>
- <h4 style="margin: 0; padding: 0;">Press q to hide</h4><br><h5 style="margin-top: -2vh; padding: 0;">Made By Jesse Nicolai</h5>
- </div>
- `;
- document.body.appendChild(menuContent);
- // Function to toggle the menu
- function toggleMenu() {
- menuContent.style.display = menuContent.style.display === 'none' ? 'block' : 'none';
- }
- // Toggle the menu when the Q key is pressed
- document.addEventListener('keydown', function(event) {
- if (event.key === 'q' || event.key === 'Q') {
- toggleMenu();
- }
- });
- // Function to toggle feature and change button style
- function toggleFeature(button, isActive) {
- if (isActive) {
- button.classList.add('active');
- button.textContent = button.textContent.replace(': Off', ': On');
- } else {
- button.classList.remove('active');
- button.textContent = button.textContent.replace(': On', ': Off');
- }
- }
- // Toggle feature when clicking on buttons
- const highlightButton = document.getElementById('highlightAnswers');
- let highlightActive = false;
- let highlightInterval = null; // Variable to hold the interval ID
- highlightButton.addEventListener('click', function() {
- highlightActive = !highlightActive;
- toggleFeature(highlightButton, highlightActive);
- if (highlightActive) {
- // Add your code for toggling highlight answers feature here
- highlightInterval = setInterval(() => {
- 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;
- [...document.querySelectorAll(`[class*="answerContainer"]`)].forEach((answer, i) => {
- if ((state.question || props.client.question).correctAnswers.includes((state.question || props.client.question).answers[i])) answer.style.backgroundColor = "rgb(0, 207, 119)";
- else answer.style.backgroundColor = "rgb(189, 15, 38)";
- });
- });
- } else {
- clearInterval(highlightInterval); // Stop the interval when toggled off
- // Reset background color of answer containers when turning off highlight
- [...document.querySelectorAll(`[class*="answerContainer"]`)].forEach((answer) => {
- answer.style.backgroundColor = "";
- });
- }
- });
- const removeButton = document.getElementById('removeWrongAnswers');
- let removeActive = false;
- let removeInterval = null; // Variable to hold the interval ID
- removeButton.addEventListener('click', function() {
- removeActive = !removeActive;
- toggleFeature(removeButton, removeActive);
- if (removeActive) {
- // Add your code for toggling remove wrong answers feature here
- removeInterval = setInterval(() => {
- 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;
- [...document.querySelectorAll(`[class*="answerContainer"]`)].forEach((answer, i) => {
- if (!(state.question || props.client.question).correctAnswers.includes((state.question || props.client.question).answers[i])) answer.style.display = "none";
- else answer.style.display = "";
- });
- });
- } else {
- clearInterval(removeInterval); // Stop the interval when toggled off
- // Reset display of answer containers when turning off remove wrong answers
- [...document.querySelectorAll(`[class*="answerContainer"]`)].forEach((answer) => {
- answer.style.display = "";
- });
- }
- });
- const autoButton = document.getElementById('autoAnswer');
- let autoActive = false;
- let autoInterval = null; // Variable to hold the interval ID
- autoButton.addEventListener('click', function() {
- autoActive = !autoActive;
- toggleFeature(autoButton, autoActive);
- if (autoActive) {
- // Add your code for auto-answering here
- autoInterval = setInterval(() => {
- try {
- 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;
- Array.from(document.querySelectorAll('div[class*="answerText"]')).filter(t => t.firstChild.innerHTML === (state.question || props.client.question).correctAnswers[0])[0].click();
- } catch {}
- // Check for the presence of feedbackButton and click if found
- const feedbackButton = document.getElementById('feedbackButton');
- if (feedbackButton) {
- feedbackButton.click();
- }
- });
- } else {
- clearInterval(autoInterval); // Stop the interval when toggled off
- }
- });
- // Make the menu draggable
- let isDragging = false;
- let offsetX, offsetY;
- menuContent.addEventListener('mousedown', function(event) {
- isDragging = true;
- offsetX = event.clientX - parseFloat(window.getComputedStyle(menuContent).left);
- offsetY = event.clientY - parseFloat(window.getComputedStyle(menuContent).top);
- });
- document.addEventListener('mousemove', function(event) {
- if (isDragging) {
- menuContent.style.left = (event.clientX - offsetX) + 'px';
- menuContent.style.top = (event.clientY - offsetY) + 'px';
- }
- });
- document.addEventListener('mouseup', function() {
- isDragging = false;
- });
- // Style the menu
- GM_addStyle(`
- .menu-button {
- margin-bottom: 5px;
- cursor: pointer;
- background-color: darkred;
- color: #fff;
- border: none;
- padding: 5px 10px;
- border-radius: 3px;
- width: 200px;
- }
- .menu-button.active {
- background-color: green;
- }
- `);
- })();