Thor Russell:Rate the audio file

Rate audio files easily

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name Thor Russell:Rate the audio file	
// @namespace None
// @version 1.0.2
// @description Rate audio files easily
// @author Kintsugi
// @include https://www.mturk.com/*
// @grant GM_log
// @require http://code.jquery.com/jquery-2.1.0.min.js
// ==/UserScript==

var i = 0;
var answer = "Answer_";
var thisAnswer = "";
var linkMP3 = document.querySelector('a[href$=".mp3"]').getAttribute("href");
var audio = document.createElement('audio');
audio.src = linkMP3;
window.focus();

$('input[name="Answer_1"][value="Selection_Nw--"]').click();
$('input[name="Answer_2"][value="Selection_Nw--"]').click();
$('input[name="Answer_3"][value="Selection_Nw--"]').click();
$('input[name="Answer_4"][value="Selection_Nw--"]').click();

// Keybinds
$(document).keydown(function (e) {
	  switch (e.which) {
	  	case 96: // Numpad 0 (Data Problem)
        case 48: // 0
        case 68: // d
          i++;
          thisAnswer = answer.concat(i.toString());
		  $('input[name="' + thisAnswer + '"][value="Selection_MA--"]').click();
		  break;
		case 97: // Numpad 1
        case 49: // 1
          i++;
          thisAnswer = answer.concat(i.toString());
		  $('input[name="' + thisAnswer + '"][value="Selection_MQ--"]').click();
		  break;
		case 98: // Numpad 2
        case 50: // 2
          i++;
          thisAnswer = answer.concat(i.toString());
		  $('input[name="' + thisAnswer + '"][value="Selection_Mg--"]').click();
		  break;
        case 99: // Numpad 3
        case 51: // 3
          i++;
          thisAnswer = answer.concat(i.toString());
		  $('input[name="' + thisAnswer + '"][value="Selection_Mw--"]').click();
		  break;
        case 100: // Numpad 4
        case 52: // 4
          i++;
          thisAnswer = answer.concat(i.toString());
		  $('input[name="' + thisAnswer + '"][value="Selection_NA--"]').click();
		  break;
        case 101: // Numpad 5
        case 53: // 5
          i++;
          thisAnswer = answer.concat(i.toString());
		  $('input[name="' + thisAnswer + '"][value="Selection_NQ--"]').click();
		  break;
		case 102: // Numpad 6
        case 54: // 6
          i++;
          thisAnswer = answer.concat(i.toString());
		  $('input[name="' + thisAnswer + '"][value="Selection_Ng--"]').click();
		  break;
		case 103: // Numpad 7
        case 55: // 7
          i++;
          thisAnswer = answer.concat(i.toString());
		  $('input[name="' + thisAnswer + '"][value="Selection_Nw--"]').click();
		  break;
        case 67: // c (clears input and resets to default values and allows you to cycle through questions from top)
          i = 0;
          $('input[name="Answer_1"][value="Selection_Nw--"]').click();
          $('input[name="Answer_2"][value="Selection_Nw--"]').click();
          $('input[name="Answer_3"][value="Selection_Nw--"]').click();
          $('input[name="Answer_4"][value="Selection_Nw--"]').click();
        break;      
        case 80: // p
        audio.play();
          break;
		case 13: // Enter
		  $("input[name*='/submit']").click();
          break;
	  }
	});