Auto Stickers

Posts Stickers Automatically in NT Race

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Auto Stickers
// @namespace    mq
// @version      1.0
// @description  Posts Stickers Automatically in NT Race
// @author       mq
// @match        https://www.nitrotype.com/race
// @license      
// ==/UserScript==

/*
Variable frequency_of_stickers usages :
100 -> post sticker in every race i.e. 100% chance
 70 -> post sticker in 7 out of 10 races i.e. 70% chance
 50 -> post sticker every other race i.e. 50% chance
 33 -> post sticker in every thrid race i.e. 33% chance
*/
var frequency_of_stickers = 100;
/*
Variable sticker_choice usages :
0 -> Random choice from all available stickers
1 -> First sticker
2 -> Second sticker
3 -> Third sticker and so on
*/
var sticker_choice = 0;

var clt_intvl = null;
function look_for_b(){
    var a = document.getElementsByClassName('raceChat-pickerOpt');
    if(a.length != 0 && a.length != undefined){
        setTimeout(function() {
            click_the_b(a);
        }, 3900)
        clearInterval(clt_intvl);
    }
}

clt_intvl = setInterval(look_for_b, 300);

function click_the_b(a){
    if(Math.floor((Math.random() * 100) + 1) <= frequency_of_stickers){
        var total_choices = a.length;
        if(sticker_choice == 0){
            var current_choice = Math.floor((Math.random() * total_choices));
            a[current_choice].firstChild.click();
        }
        else{
            a[sticker_choice - 1].firstChild.click();
        }
    }
}