A9 Image Survey - 1 Location

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==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;
}