Kahoot PIN Checker

Check pin of a kahoot game.

当前为 2019-11-08 提交的版本,查看 最新版本

// ==UserScript==
// @name         Kahoot PIN Checker
// @namespace    http://tampermonkey.net/
// @version      0.0.1
// @description  Check pin of a kahoot game.
// @author       theusaf
// @match        *://play.kahoot.it/*
// @grant        none
// ==/UserScript==

function Check(pin){
    return new Promise(function(res,rej){
        const x = new XMLHttpRequest();
        x.open("GET",`https://kahoot.it/reserve/session/${pin}/?${Date.now()}`);
        x.send();
        x.onload = function(){
            res(x.response);
        };
    });
}

var pin;

const interval = setInterval(()=>{
    Check(pin).then(o=>{
        if(o == "Not found"){
            document.write(`<script>window.location = "https://play.kahoot.it/v2/${window.location.search}"</script>`);
        }
    });
},1000*60*5);

const otherInterval = setInterval(()=>{
    const pind = document.querySelector("[data-functional-selector=game-pin]");
    if(pind){
        pin = pind.innerHTML;
    }
},100);