a9 - 5 radios

Keybinds for the 5 radios in the a9 HITs

目前為 2016-11-08 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         a9 - 5 radios
// @namespace    http://kadauchi.com/
// @version      1.0.0
// @description  Keybinds for the 5 radios in the a9 HITs
// @author       Kadauchi
// @icon         http://i.imgur.com/oGRQwPN.png
// @include      /^https://(www|s3)\.(mturkcontent|amazonaws)\.com/
// @grant        GM_log
// @require      https://code.jquery.com/jquery-3.1.1.min.js
// @hitname      Shoe (WARNING: This HIT may contain adult content. Worker discretion is advised.)
// @hitsave      https://s3.amazonaws.com/mturk_bulk/hits/235915880/onYNjrCy3S1NRlSfqUcH4Q.html
// ==/UserScript==

var autosubmit = false;

function _rate (i) {
  $(':radio').eq(i).click();
  if (autosubmit) {
    $(':submit').click();
  }
}

$(document).keydown(function (e) {
  switch (e.which) {
    case 49: case 97: // 1, Numpad 1
      _rate(0);
      break;
    case 50: case 98: // 2, Numpad 2
      _rate(1);
      break;
    case 51: case 99: // 3, Numpad 3
      _rate(2);
      break;
    case 52: case 100: // 4, Numpad 4
      _rate(3);
      break;
    case 53: case 101: // 5, Numpad 5
      _rate(4);
      break;
    case 13: // Enter
      $(':submit').click();
      break;
  }
});