// ==UserScript==
// @name Rowan
// @version 1.0
// @description 1,2,3,4,5,6, space, enter
// @author SarahAshlee90
// @include /^https://(www|s3)\.(mturkcontent|amazonaws)\.com/
// @grant none
// @require https://code.jquery.com/jquery-3.1.1.min.js
// ==/UserScript==
const radios = Array.from(document.querySelectorAll('[type="radio"]'));
var i = 0;
window.addEventListener("keydown", function (event) {
if(event.code === "Numpad1") {
if (i < 18) {
radios[i].click();
i += 3;
radios[i].focus();
} else if (i >= 18) {
radios[i].click();
i += 6;
radios[i].focus();
}
}
if(event.code === "Numpad2"){
if (i < 18) {
radios[i+1].click();
i += 3;
radios[i].focus();
} else if (i >= 18) {
radios[i+1].click();
i += 6;
radios[i].focus();
}
}
if(event.code === "Numpad3"){
if (i < 18) {
radios[i+2].click();
i += 3;
radios[i].focus();
} else if (i >= 18) {
radios[i+2].click();
i += 6;
radios[i].focus();
}
}
if(event.code === "Numpad4"){
if (i < 18) {
return;
} else if (i >= 18 && i <= 29) {
radios[i+3].click();
i += 6;
}
}
if(event.code === "Numpad5"){
if (i < 18) {
return;
} else if ( i >= 18 && i <= 29) {
radios[i+4].click();
i += 6;
}
}
if(event.code === "Numpad6"){
if (i < 18) {
return;
} else if (i >= 18 && i <= 29) {
radios[i+5].click();
i += 6;
}
}
if(event.code === "Space") {
$('input[name="hard"]').click();
}
if(event.code === "Enter") {
coin ();
setTimeout(function(){ $('input[id="submitButton"]').click(); }, 50);
}
});
function coin () {
var audio = document.createElement("audio");
audio.src = "http://www.superluigibros.com/downloads/sounds/GAMECUBE/SUPERMARIOSUNSHINE/WAV/coin.wav";
audio.play();
}