Image moderation speeder-upper

Lots of optimizations to speed up image moderation HITs

目前為 2015-11-29 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Image moderation speeder-upper
// @namespace    mobiusevalon.tibbius.com
// @version      0.3
// @description  Lots of optimizations to speed up image moderation HITs
// @author       Mobius Evalon
// @match        https://www.mturkcontent.com/dynamic/hit*
// @require      https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js
// @grant        none
// ==/UserScript==

function hide_instructions()
{
    $('.panel-heading').first().append(
        $('<span/>')
        .text(" [Show/Hide]")
        .css("cursor","pointer")
        .click(function() {
            var $p = $(".panel-body").first();
            if($p.css("display") === "none") $p.show();
            else $p.hide();
        })
    );
    $(".panel-body").first().hide();
}

$(document).ready(function() {
    var matches = /What is (\d*)\+(\d*)\?/i.exec($("label").last().text());

    if(matches !== null) // vessel turk
    {
        $("input:radio[value=no]").prop('checked',true);
        $("input:text[name=captcha]").val((matches[matches.length-1]*1)+(matches[matches.length-2]*1));
        $("#submitButton").focus();
        $(document).keydown(function(event) {if(event.which === 13) $("#submitButton").click();})
    }
    
    else if($("input:radio[name=shouldBan]").length) // mixerbox
    {
        hide_instructions();
        $("input:radio[name=shouldBan][value=0]").prop('checked',true);
        $("#submitButton").focus();
        $(document).keydown(function(event) {
            switch(event.which)
            {
                case 13:
                    $("#submitButton").click();
                    break;
                case 97: case 49: // numpad numlock on, horizontal num keys respectively
                    $("input:radio[name=shouldBan][value=1]").prop('checked',true);
                    break;
                case 98: case 50:
                    $("input:radio[name=shouldBan][value=-2]").prop('checked',true);
                    break;
                case 99: case 51:
                    $("input:radio[name=shouldBan][value=0]").prop('checked',true);
                    break;
            }
        })
    }

    else if($("img").first().attr("src").indexOf("cuteornot.buzzfed.com") > -1) // buzzfeed
    {
        hide_instructions();
        $("#submitButton").focus();
        $(document).keydown(function(event) {
            switch(event.which)
            {
                case 13:
                    $("#submitButton").click();
                    break;
                case 100: case 49:
                    $("#checkbox1").click();
                    break;
                case 101: case 50:
                    $("#checkbox2").click();
                    break;
                case 102: case 51:
                    $("#checkbox3").click();
                    break;
                case 97: case 52:
                    $("#checkbox4").click();
                    break;
                case 98: case 53:
                    $("#checkbox5").click();
                    break;
                case 99: case 54:
                    $("#checkbox6").click();
                    break;
                case 96: case 48:
                    $("#checkbox8").click();
                    break;
            }
        })
    }
});