[Script] Ceedj and THFYM A9 Script

Discussion in 'mTurk Scripts & Resources' started by ceedj, Dec 2, 2016.

  1. ceedj

    ceedj Survey Slinger

    Messages:
    2,866
    Gender:
    Male
    Ratings:
    +6,400
    Hullo gang, here is an updated version of the A9 script THFYM and I put together sometime ago. This script will auto select a fair amount of the most common options for you, depending on the HIT. @THFYM helped a great deal to add drawing support, so if you left click to draw, it will select 1 object; right click to draw selects 2 or more. Be sure to finish the click with the same mouse button you started with; so if you start with left, finish the box with left, otherwise it will select options for whatever you finish the box with. Handy in case you meant to right click for drawing, but just be aware of it.

    The other options are chosen with numpad or number row 4-9 and + or +/=. This gets updated periodically, but it SHOULD detect the HIT and have the appropriate options picked for that HIT (type of dress or hemline type, etc).

    Added(1.0.11): Support for dominant image HITs (0.01) - Auto selects Yes, choose with 1 or 2.

    Added (1.0.10): Support for the image matching HITs, and still has the watch comparison from a few months ago. The image match hits select Yes for all by default.

    No warranties or guarantees this won't create a giant spaghetti mess somewhere (it shouldn't, we only use fresh noodles in our scripts), so you are responsible, blah blah blah.

    Anyway, here is the script, enjoy!

    Code:
    // ==UserScript==
    // @name A9 Category Validation ALL ($0.02)
    // @namespace None
    // @version 1.0.11
    // @description Blamm!
    // @author ceedj / THFYM
    // @include *.mturkcontent.com/*
    // @include https://s3.amazonaws.com/*
    // @grant GM_log
    // @require http://code.jquery.com/jquery-2.1.0.min.js
    // ==/UserScript==
    
    var my_var = $('h5:contains(target)');
    var my_var2 = $('h5:contains(looking for...)');
    var hemline = $('li:contains(hemline)');
    var imagematch = $('b:contains(Compare the largest product)');
    var watch = $('h5:contains(evaluate)');
    var veh_interior = $('h5:contains(interior of a passenger vehicle)');
    var dom = $('p:contains(dominant)');
    if (my_var.length || my_var2.length || imagematch.length || veh_interior.length || dom.length)
    {
        $(document).ready(function() {
        window.focus();
            if (veh_interior.length)
            {$("input[id='yesLoad']").click();
             $("input[id='noInterior']").click();
            }
       });
    
    if (imagematch.length || dom.length)
    {
        $("input[value='Yes']").click();
    }
    if (watch.length)
    {
        $("input[value='No']").click();
    }
    
    $("p").eq(0).css('font-size', '250%');
    //$('img').detach(); //Comment out this line if you want to see example images
    my_var.detach();
    $("#truth").bind('contextmenu', function(){ return false ;});
    $("#truth").click(function(){
            $("input[id='oneItem']").click();
            $("#yesWorn[value='Yes']").focus();
            $("#noPersonal[value='No']").click();
            $("#yesWorn[value='Yes']").click();
            $("#yesJeans[value='yesJeans']").click();
            $("#yesCatalog[value='Yes']").click();
            $("#noOverlay[value='No']").click();
            $("#completeObject[value='No']").click();
            $("input[id='onePassenger']").click();
            $("input[id='small']").click();
            $("input[id='frontProfile']").click();
            $("#completeObject[value='Complete']").click();
    
        });
    $("#truth").mousedown(function(m){
        if( m.button == 2 ) {
            $("input[id='multipleItem']").click();
            $("#yesWorn[value='Yes']").focus();
            $("#yesWorn[value='Yes']").click();
            $("#noPersonal[value='No']").click();
            $("#yesJeans[value='yesJeans']").click();
            $("#yesAngle[value='Yes']").click();
            $("#yesCatalog[value='Yes']").click();
            $("#noOverlay[value='No']").click();
            $("#completeObject[value='No']").click();
            $("input[id='twoplusPassenger']").click();
            $("input[id='small']").click();
            $("input[id='frontProfile']").click();
            $("#completeObject[value='Complete']").click();
        }
        });
    // Keybinds
    document.onkeydown = function(e) {
    
    // No Items
    if ((e.keyCode === 48) || (e.keyCode === 96) || (e.altKey && e.keyCode === 96)) { // 0 or Numpad0 or Alt+Numpad0
    $("input[id='noItem']").click();
    $("input[id='noPassenger']").click();
    
    }
    
    // One Item
    if ((e.keyCode === 49) || (e.keyCode === 97) || (e.altKey && e.keyCode === 97)) { // 1 or Numpad1 or Alt+Numpad1
    $("input[id='oneItem']").click();
    $("#yesWorn[value='Yes']").focus();
    $("#noPersonal[value='No']").click();
    $("#yesJeans[value='yesJeans']").click();
    $("#yesWorn[value='Yes']").click();
    $("#yesAngle[value='Yes']").click();
    $("#yesCatalog[value='Yes']").click();
    $("#noOverlay[value='No']").click();
    $("#completeObject[value='No']").click();
    $("input[id='onePassenger']").click();
    $("input[id='small']").click();
    $("input[id='frontProfile']").click();
    $("#completeObject[value='Complete']").click();
    $("input[value='Yes']").click();
    
    }
    
    // Multiple Items
    if ((e.keyCode === 50) || (e.keyCode === 98) || (e.altKey && e.keyCode === 98)) { // 2 or Numpad2 or Alt+Numpad2
    $("input[id='multipleItem']").click();
    $("#yesWorn[value='Yes']").focus();
    $("#noPersonal[value='No']").click();
    $("#yesJeans[value='yesJeans']").click();
    $("#yesWorn[value='Yes']").click();
    $("#yesAngle[value='Yes']").click();
    $("#yesCatalog[value='Yes']").click();
    $("#noOverlay[value='No']").click();
    $("#completeObject[value='No']").click();
    $("input[id='twoplusPassenger']").click();
    $("input[id='small']").click();
    $("input[id='frontProfile']").click();
    $("#completeObject[value='Complete']").click();
    $("input[value='No']").click();
    
    }
    
    // No Picture Loaded
    if ((e.keyCode === 51) || (e.keyCode === 99) || (e.altKey && e.keyCode === 99)) { // 3 or Numpad3 or Alt+Numpad3
        $("input[id='deadLink']").click();
    
    }
      
    // Option 1
    if ((e.keyCode === 52) || (e.keyCode === 100) || (e.altKey && e.keyCode === 100)) { // 4 or Numpad4 or Alt+Numpad4
        if (hemline.length){$("input[id='aboveknee'],input[id='aline']").click();} else {
        $("input[id='strapless'],input[id='bootcut'],input[id='striped'],input[id='ankle'],input[id='ombre'],input[id='singlegraphic']").click();}
    
    }
    
    // Option 2
    if ((e.keyCode === 53) || (e.keyCode === 101) || (e.altKey && e.keyCode === 101)) { // 5 or Numpad5 or Alt+Numpad5
        if (hemline.length){$("input[id='kneelength'],input[id='fitted']").click();} else {
        $("input[id='sleeveless'],input[id='polkadot'],input[id='skinny'],input[id='midcalf'],input[id='tiedye'],input[id='multiplerepeated']").click();}
    
    }
      
    // Option 3
    if ((e.keyCode === 54) || (e.keyCode === 102) || (e.altKey && e.keyCode === 102)) { // 6 or Numpad6 or Alt+Numpad6
        if (hemline.length){$("input[id='midcalf'],input[id='straight'").click();} else {
        $("input[id='shortsleeve'],input[id='plaid'],input[id='straight'],input[id='knee'],input[id='abstract']").click();}
    
    }
    
    // Option 4
    if ((e.keyCode === 55) || (e.keyCode === 103) || (e.altKey && e.keyCode === 103)) { // 7 or Numpad7 or Alt+Numpad7
        if (hemline.length){$("input[id='ankle']").click();} else {
        $("input[id='halfsleeve'],input[id='geometric'],input[id='overknee'],input[id='predomtext']").click();}
    
    }
      
    
    // Option 5
    if ((e.keyCode === 56) || (e.keyCode === 104) || (e.altKey && e.keyCode === 104)) { // 8 or Numpad8 or Alt+Numpad8
        if (hemline.length){$("input[id='highlow']").click();} else {
        $("input[id='quartersleeve'],input[id='floral']").click();}
    
    }
      
    // Option 6
    if ((e.keyCode === 57) || (e.keyCode === 105) || (e.altKey && e.keyCode === 105)) { // 9 or Numpad9 or Alt+Numpad9
    $("input[id='longsleeve'],input[id='animal']").click();
    
    }
      
    // Option 7
    if ((e.keyCode === 61) || (e.keyCode === 107) || (e.altKey && e.keyCode === 107)) { // = or Numpad+ or Alt+Numpad+
    $("input[id='cantsee'],input[id='other'],input[id='partial']").click();
    
    }
    //Submit
    if (e.keyCode === 13) { // Enter or NumpadEnter
    $("input[id='submitButton']").click();
    }
    };
    }
    
     
    • Like Like x 2
    • Love Love x 2
    • Today I Learned Today I Learned x 1
    Last edited: Dec 21, 2016
  2. THFYM

    THFYM Survey Slinger Former MTG MotM

    Messages:
    8,887
    Gender:
    Male
    Ratings:
    +23,050
    I won't be offended if you just list me as a // @contributor, because I'm responsible for about 3 lines of this thing :p This is your baby, I just helped out once upon a time.
     
  3. ceedj

    ceedj Survey Slinger

    Messages:
    2,866
    Gender:
    Male
    Ratings:
    +6,400
    You are the glue, man.

    The GLUE.
     
  4. ChrisTurk

    ChrisTurk Administrator

    Messages:
    56,746
    Ratings:
    +163,330
    So.. THFYM contributed the "glue" to make this baby? :bolt:
     
    • Like Like x 1
  5. ceedj

    ceedj Survey Slinger

    Messages:
    2,866
    Gender:
    Male
    Ratings:
    +6,400
    Back to your hole and fix stuff damnit! :poke:
     
    • Like Like x 2
    • Love Love x 2
  6. ceedj

    ceedj Survey Slinger

    Messages:
    2,866
    Gender:
    Male
    Ratings:
    +6,400
    Added(1.0.11): Support for dominant image HITs (0.01) - Auto selects Yes, choose with 1 or 2.
     
    • Today I Learned Today I Learned x 1