GamekitImageAutoRate

Continuously rate every pictures with ransom stars

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         GamekitImageAutoRate
// @namespace    fr.mrcraftcod
// @version      0.5
// @description  Continuously rate every pictures with ransom stars
// @author       MrCraftCod
// @match        https://gamekit.com/image/star/*
// @match        https://dogry.pl/image/star/*
// @require      http://code.jquery.com/jquery-3.4.1.min.js
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var loadDate = Date.now();
    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
        {
            console.log("[GamekitImageAutoRate] Captcha, waiting user input");
            return;
        }
        var note = (1 + getRandomInt(5)) * 2;
        var button = $('[data-rating="' + note + '"]');
        if(!button || button === null || button === undefined){
            console.log("[GamekitImageAutoRate] Stars not found, retrying in 100ms");
            setTimeout(tryRate, 100);
        }
        else{
            console.log("[GamekitImageAutoRate] Rated image with " + note / 2 + " stars");
            button.click(); //Page will reload and script be run again after
        }
    }

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

    $(document).ready(function(){
        var delay = Math.max(0, (loadDate + 1000) - Date.now());
        if(delay == 0){
            tryRate();
        }else{
            console.log("[GamekitImageAutoRate] Waiting " + delay + "ms before rating");
            setTimeout(tryRate, delay); //wait at least 1s since the scipt have been loaded
        }
    });
})();