MTurk Research Tasks Keyboard Shortcuts 2

Add keyboard shortcuts to MTurk requester Research Task's HITs for "How Old" and "Commonsense"

目前為 2015-07-17 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        MTurk Research Tasks Keyboard Shortcuts 2
// @description Add keyboard shortcuts to MTurk requester Research Task's HITs for "How Old" and "Commonsense"
// @namespace   http://idlewords.net
// @include     https://vqa.cloudcv.org/*
// @version     0.1
// @require     https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js
// @grant       none
// ==/UserScript==

$.noConflict();
if ($("h3:contains('How Old Do You Think a Person Needs')").length) {
	$(document).keydown(function(event) {
		var rated = 0;
		switch(event.which) {
			case 49:
			case 97:
				$("#csToddler").prop('checked', true);
				rated = 1;
				break;
			case 50:
			case 98:
				$(":radio[value='yChild']").prop('checked', true);
				rated = 1;
				break;
			case 51:
			case 99:
				$(":radio[value='oChild']").prop('checked', true);
				rated = 1;
				break;
			case 52:
			case 100:
				$(":radio[value='yTeen']").prop('checked', true);
				rated = 1;
				break;
			case 53:
			case 101:
				$(":radio[value='adult']").prop('checked', true);
				rated = 1;
				break;
		}
		if (rated == 1) {
			event.preventDefault();
			$("#nextButton").click();
		}
	});
} else if ($("h3:contains('Do These Questions Need Common')").length) {
	$(document).keydown(function(event) {
		if (event.which == 49 || event.which == 97) {
			$("input#csYes").prop('checked', true);
			event.preventDefault();
			$("#nextButton").click();
		} else if (event.which == 50 || event.which == 98) {
			$("input#csNo").prop('checked', true);
			event.preventDefault();
			$("#nextButton").click();
		}
	});
}