Kahoot Game Finding Loop

The fuk ee dat???!!!!

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Kahoot Game Finding Loop
// @version      0.11
// @description  The fuk ee dat???!!!!
// @author       Mega-Konami
// @license      MIT
// @match        *://kahoot.it/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=kahoot.it
// @namespace kahoot-game-finding-loop-mk-1l2jff
// ==/UserScript==
/* jshint esversion:6 */

(function() {
    var code, btn, inp;
    var el = document.createElement('DIV');
    el.id = 'cds';
    document.body.appendChild(el);
    console.log('Connected!');
    window.addEventListener('load', function() {
        btn = document.querySelector('button.enter-pin-form__SubmitButton-sc-z047z0-1');
        inp = document.querySelector('input#game-input');
        function* CodeGenerator() {
            function rand(min, max) {return Math.floor(Math.random()*(max-min)+min);}
            const chars = '1234567890';
            while (true) {
                var len = 6; code = '';
                for (var i=0;i<6;i++) {
                    code += chars[rand(0,chars.length)];
                }
                var spread = code.split();
                if (spread[0]==='0') {
                    spread[0] = '1';
                    for (i in spread) {
                        code = '';
                        code += spread[i];
                    }
                }
                yield code;
            }
        }
        const gen = CodeGenerator();
        setInterval(function() {
            code = gen.next().value;
            var b = [...code];
            if (parseInt(b[0]) < 7) {
                b[0] = '7';
                code = '';
                for (var i in b) {
                    code += b[i];
                }
            }
            fetch(`https://kahoot.it/reserve/session/${code}/`, {
                method: 'GET'
            }).then(function(res) {
                console.log(typeof res.text());
                if (res.ok||res.status < 400) {
                    var e = document.createElement('SPAN');
                    e.innerHTML = code;
                    document.getElementById('cds').appendChild(e);
                }
            });
        }, 50);
    });
})();