// ==UserScript==
// @name Hotel Photos
// @namespace https://github.com/Kadauchi/
// @version 1.0.0
// @description Helps with Hotel Photos
// @author Kadauchi
// @icon http://i.imgur.com/oGRQwPN.png
// @include https://s3.amazonaws.com/mturk_bulk/*
// @grant GM_log
// @hitsave https://s3.amazonaws.com/mturk_bulk/hits/245802341/_xoA59feByMOGyJnAVu_2Q.html
// ==/UserScript==
let q = 1, i = 0;
const inputs = [
`_DoesImageContainExterior_`,
`_DoesContainMoreThanOneBuilding_`,
`_DoesImageContainOver75_`,
`_IsBuildingRestaurantOrStore_`,
`_IsBuildingPrimarySubject_`,
];
document.addEventListener(`keydown`, function (pressed) {
switch (pressed.key) {
case `1`: KEYPRESS(1); break;
case `2`: KEYPRESS(2); break;
case `Enter`: document.getElementsByName(`submit`)[0].click();
}
});
function KEYPRESS (KEY) {
const yn = KEY === 1 ? `yes` : `no`;
document.getElementById(`ID0${q}${inputs[i]}${yn}`).click();
if (document.getElementById(`ID0${q}_Done`).offsetParent !== null) {
q ++;
i = 0;
}
else {
i ++;
}
if (q === 6) {/*document.getElementsByName(`submit`)[0].click();*/ return;}
document.getElementById(`ID0${q}_DoesImageContainExterior_yes`).focus();
document.getElementById(`ID0${q}_DoesImageContainExterior_yes`).scrollIntoView();
}
document.getElementById(`ID01_DoesImageContainExterior_yes`).focus();
document.getElementById(`ID01_DoesImageContainExterior_yes`).scrollIntoView();