RandomSelector[Typing-tube]

RealTimeCombatting埋め込み 曲に迷ったとき用

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         RandomSelector[Typing-tube]
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  RealTimeCombatting埋め込み 曲に迷ったとき用
// @author       Spacia(の)
// @match        https://typing-tube.net/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    setTimeout(() =>{
        var parent = document.querySelector("#RTCRoomIdleScene > div:nth-child(3)");

        var button = document.createElement("input");
        button.setAttribute("type","file");
        button.setAttribute("accept",".txt");
        button.setAttribute("value", "曲をランダムセレクト");
        parent.appendChild(button);
        button.addEventListener("change", (event) =>{
            var _file = event.target.files[0];
            if(_file){
                var fr = new FileReader();
                fr.onload = function(e) {
                    var ids = fr.result.split('\n');
                    var  id = ids[Math.floor(Math.random() * ids.length)];
                    window.open('https://typing-tube.net/movie/show/' + id,"_self");
                }
                fr.readAsText(_file);
            }
        });
    }, 5000);
    // Your code here...
})();