Last active
December 30, 2017 09:50
-
-
Save TheFrostlixen/426547361dc5f5798de4a3e37b1d1f2d to your computer and use it in GitHub Desktop.
Amazon Mechanical Turk scripts for GreaseMonkey/TamperMonkey
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Status Searchable Requester | |
// @description Replace status page contact links with a HIT search for that requester, and adds a separate contact link. | |
// @author TheFrostlixen | |
// @version 0.2 | |
// @namespace https://greasyfork.org/en/users/34060 | |
// @match https://www.mturk.com/mturk/statusdetail?* | |
// @grant none | |
// ==/UserScript== | |
// == CHANGELOG == | |
// v0.1 Does what it should, quick and dirty implementation | |
Array.prototype.forEach.call( document.querySelectorAll('[title="Contact this Requester"'), function(el) { | |
var tag = document.createElement('a'); // make our new link tag | |
tag.href = el.href; // set it to the 'contact requester' existing link | |
el.href = "https://www.mturk.com/mturk/searchbar?selectedSearchType=hitgroups&requesterId=" + tag.search.split(/=|&/)[1]; // modify the original tag to search for the requester | |
el.target = "_blank"; // opens in new window | |
tag.innerHTML = "✉"; // add a cute ascii symbol for the contact link | |
el.parentElement.appendChild( tag ); // append the contact link tag to the parent (requester name) | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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')) { // check if this HIT should have this script active | |
document.addEventListener( "keydown", key, false); // add a keypress listener | |
$j("input[name='Q1Answer']").eq(5).click(); // check this by default | |
$j("input[id='submitButton']").focus(); // give focus to something in the window, also makes it easier to insta-submit | |
} | |
// Wait for keypress | |
function key(i) { | |
// Numpad 1-7 | |
if (i.keyCode >= 97 && i.keyCode <= 103) { | |
// click the corresponding form named 'Q1Answer' and optionally submit | |
$j("input[name='Q1Answer']").eq(i.keyCode - 97).click(); | |
if (submit) { | |
$j("input[id='submitButton']").click(); | |
} | |
} | |
// Enter | |
else if (i.keyCode == 13) { | |
// submit the HIT as long as you have focus in the window | |
$j("input[id='submitButton']").click(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment