您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Skibidi Toilet approved, made by floidAI
当前为
- // ==UserScript==
- // @name Kahoot Cheat (Beta) (Working Dec 2024)
- // @namespace http://tampermonkey.net/
- // @version 0.01
- // @description Skibidi Toilet approved, made by floidAI
- // @author You
- // @match https://kahoot.it/*
- // @grant GM.xmlHttpRequest
- // @run-at document-idle
- // @license Unlicense
- // ==/UserScript==
- (function () {
- 'use strict';
- const selectors = [
- 'answer-0',
- 'answer-1',
- 'answer-2',
- 'answer-3'
- ];
- const questionSelector = '.question-title__Title-sc-12qj0yr-1';
- const questionCounterSelector = '.visually-hidden__SROnly-sc-18gl3eq-0';
- const currentQuestionSelector = 'question-index-counter';
- let quizData = null;
- let currentUrl = location.href;
- const observeUrlChange = () => {
- setInterval(() => {
- if (location.href !== currentUrl) {
- currentUrl = location.href;
- if (currentUrl === 'https://kahoot.it/gameblock') {
- extractAndSendData();
- }
- }
- }, 500);
- };
- const getTotalQuestions = () => {
- const counterElement = document.getElementsByClassName("visually-hidden__SROnly-sc-18gl3eq-0")[1];
- if (counterElement) {
- const text = counterElement.innerText;
- const match = text.match(/of (\d+)/);
- if (match && match[1]) {
- return parseInt(match[1], 10);
- }
- }
- return null;
- };
- const extractAndSendData = () => {
- const questionElement = document.querySelector(questionSelector);
- const answerElements = selectors
- .map(selector => document.querySelector(`[data-functional-selector="${selector}"]`))
- .filter(el => el);
- const totalQuestions = getTotalQuestions();
- if (!totalQuestions) {
- return;
- }
- if (questionElement && answerElements.length > 0) {
- const question = questionElement.innerText;
- const answers = answerElements.map(el => el.innerText);
- const curQuestion = document.querySelector(`[data-functional-selector="${currentQuestionSelector}"]`).innerText;
- if (quizData) {
- processQuestionData(question, answers, totalQuestions);
- } else {
- const query = question;
- const apiUrl = `https://create.kahoot.it/rest/kahoots/?query=${encodeURIComponent(query)}&limit=20&orderBy=relevance&cursor=0&searchCluster=1&includeExtendedCounters=false&inventoryItemId=ANY`;
- GM.xmlHttpRequest({
- method: 'GET',
- url: apiUrl,
- onload: function (response) {
- const jsonResponse = JSON.parse(response.responseText);
- const filteredResults = jsonResponse.entities.filter(quiz => quiz.card.number_of_questions === totalQuestions);
- if (filteredResults.length > 0) {
- const quizId = filteredResults[0].card.uuid;
- const quizDetailsUrl = `https://create.kahoot.it/rest/kahoots/${quizId}/card/?includeKahoot=true`;
- GM.xmlHttpRequest({
- method: 'GET',
- url: quizDetailsUrl,
- onload: function (response) {
- quizData = JSON.parse(response.responseText);
- processQuestionData(question, answers, totalQuestions);
- },
- onerror: function (error) {
- console.error('Error fetching quiz details:', error);
- }
- });
- } else {
- console.error(`No quizzes found with ${totalQuestions} questions.`);
- }
- },
- onerror: function (error) {
- console.error('Error making API request:', error);
- }
- });
- }
- } else {
- console.error('Required elements not found or no answers available.');
- }
- };
- const processQuestionData = (question, answers, totalQuestions) => {
- const questionData = quizData.kahoot.questions.find(questionInData => questionInData.question == question);
- const correctChoice = questionData.choices.find(choice => choice.correct);
- if (correctChoice) {
- const correctAnswerText = correctChoice.answer;
- answers.forEach((answerText, index) => {
- if (answerText.trim() === correctAnswerText.trim()) {
- const answerElement = document.querySelector(`[data-functional-selector="answer-${index}"]`);
- if (answerElement) {
- answerElement.innerText = answerText.trim() + '.';
- }
- }
- });
- }
- };
- observeUrlChange();
- })();