'Choose Subject of Homework Question'

Selection hotkeys and auto-submit for Lili Dworkin's HIT 'Choose Subject of Homework Question'

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         'Choose Subject of Homework Question'
// @version      1.0
// @description  Selection hotkeys and auto-submit for Lili Dworkin's HIT 'Choose Subject of Homework Question'
// @author       TheFrostlixen
// @include      https://www.mturkcontent.com/dynamic/*
// @match        https://www.mturk.com/mturk/accept?*
// @match        https://www.mturk.com/mturk/previewandaccept?*
// @grant        none
// @namespace    https://greasyfork.org/en/users/34060
// @require      https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js

// ==/UserScript==
var submit = true;
var $j = jQuery.noConflict(true);

// verify HIT
if ( $j('strong:homework question')) {
    // This HIT is a match for the script, so get it set up
    document.addEventListener( "keydown", key, false);
    $j("input[name='Q1Answer']").eq(5).click();
    $j("input[id='submitButton']").focus();
}

// Wait for keypress
function key(i) {
    if (i.keyCode >= 97 && i.keyCode <= 103) { // numpad 1-7
        $j("input[name='Q1Answer']").eq(i.keyCode - 97).click();
        if (submit) {
            $j("input[id='submitButton']").click();
        }
    }
    if (i.keyCode == 13) { // enter
        console.log( $j("input[id='submitButton']") );
        $j("input[id='submitButton']").click();
    }
}