A9 Image Survey - 1 Location

Makes the A9 Image Survey - 1 (Location HITs) easier to do (only keyboard).

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         A9 Image Survey - 1 Location
// @namespace    https://greasyfork.org/en/scripts/19949-a9-image-survey-1-location
// @version      0.41
// @description  Makes the A9 Image Survey - 1 (Location HITs) easier to do (only keyboard).
// @author       walco005
// incl. is removed but kept here in case it is REALLY needed     *.mturkcontent.com/*
// @include      https://s3.amazonaws.com/mturk_bulk/*
// @include      https://www.mturk.com/mturk/*groupId=3SI493PTTXCN8RR0YUKNNXB592FZDB*
// @grant        GM-Log
// @require      http://code.jquery.com/jquery-2.1.0.min.js
// ==/UserScript==

//Using just the What location portion of the h4 since using the whole thing was creating issues.
var x = false;
if ($("h4:contains(What location)").length){
    window.focus();
    $("h4:contains(What location)").append(
      "<br> Press the following key to select each location, then press ENTER to submit. <br> 1 - Bedroom <br> 2 - Bathroom<br> 3 - Kitchen<br > 4 - Living Room<br> 5 - Dining Area<br> 6 - Store<br> 7 - Other Location<br> 8 - Cannot Identify"
    );
    $(document).keydown(function(e) {
      switch(e.keyCode) {
          case 49:
              $("select[data-reactid='.0.0.1.2:$q1scene.2']").val("context_bedroom");
              if(!x) changeButton();
              break;
          case 50:
              $("select[data-reactid='.0.0.1.2:$q1scene.2']").val("context_bathroom");
              if(!x) changeButton();
              break;
          case 51:
              $("select[data-reactid='.0.0.1.2:$q1scene.2']").val("context_kitchen");
              if(!x) changeButton();
              break;
          case 52:
              $("select[data-reactid='.0.0.1.2:$q1scene.2']").val("context_living_room");
              if(!x) changeButton();
              break;
          case 53:
              $("select[data-reactid='.0.0.1.2:$q1scene.2']").val("context_dining_area");
              if(!x) changeButton();
              break;
          case 54:
              $("select[data-reactid='.0.0.1.2:$q1scene.2']").val("context_store");
              if(!x) changeButton();
              break;
          case 55:
              $("select[data-reactid='.0.0.1.2:$q1scene.2']").val("context_other");
              if(!x) changeButton();
              break;
          case 56:
              $("select[data-reactid='.0.0.1.2:$q1scene.2']").val("context_unknown");
              if(!x) changeButton();
              break;
          default:
              break;
          case 13:
              if(x) $("input[value='Submit']").click();
              break;
      }
    });
}

if ($("td:contains(All HITs Available to You)").length){
    location.reload();
    i++;
}

function changeButton() {
      $("h4:contains(What location)").removeClass("qHeadlineTodo");
      $("h4:contains(What location)").addClass("qHeadlineDone");
      $("input[data-reactid='.0.0.1.4.0']").removeClass("btn-default");
      $("input[data-reactid='.0.0.1.4.0']").addClass("btn-success");
      $("input[data-reactid='.0.0.1.4.0']").prop("disabled", false);
      x = true;
}