GamekitImageAutoRate

Continuously rate every pictures with 3 stars

目前為 2019-06-30 提交的版本,檢視 最新版本

// ==UserScript==
// @name         GamekitImageAutoRate
// @namespace    fr.mrcraftcod
// @version      0.4
// @description  Continuously rate every pictures with 3 stars
// @author       MrCraftCod
// @match        https://gamekit.com/image/star/*
// @match        https://dogry.pl/image/star/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function tryRate()
    {
        var captchaValid = $('#google_recaptcha_send');
        if(captchaValid && captchaValid !== undefined && captchaValid !== null && captchaValid.length && captchaValid.length > 0) //Can't valid automatically captcha due to CORS
            return;
        var note = (1 + getRandomInt(5)) * 2;
        var button = $('[data-rating="' + note + '"]');
        if(!button || button === null || button === undefined){
            setTimeout(tryRate, 100);
        }
        else{
            button.click();
        }
    }

    function getRandomInt(max) {
        return Math.floor(Math.random() * Math.floor(max));
    }

    $(document).ready(function(){
        setTimeout(tryRate, 1000);
    });
})();