Keybinds to select radios
当前为
// ==UserScript==
// @name Mturk Radio Keybinds
// @namespace https://gist.github.com/Kadauchi
// @version 2.0.0
// @description Keybinds to select radios
// @author Kadauchi
// @icon http://i.imgur.com/oGRQwPN.png
// @include /^https://(www\.mturkcontent|s3\.amazonaws)\.com/
// @grant GM_getValue
// @grant GM_setValue
// ==/UserScript==
document.body.insertAdjacentHTML(`afterbegin`,
`<div style="background-color: lightgreen;">` +
`<label style="color: black; margin-left: 10px;">Script: Mturk Radio Keybinds</label>` +
`<span style="margin-left: 3px;cursor:help" title="Press 1-9 to select the radio you want. \n\nPress Enter to submit the HIT. \n\nCheck auto submit to have the HIT submit after you press 1-9.">❔</span>` +
`<label style="color: black; float: right; margin-right: 10px;">Auto Submit: ` +
`<input id="autosubmit" type="checkbox" ${GM_getValue(`autosubmit`) ? `checked` : ``}></input>` +
`</label>` +
`</div>`
);
const autosubmit = document.getElementById(`autosubmit`);
autosubmit.addEventListener(`change`, function (event) {
GM_setValue(`autosubmit`, autosubmit.checked);
});
window.addEventListener(`keydown`, function (event) {
const key = event.key;
if (key.match(/[1-9]/)) {
const radio = document.querySelectorAll(`[type="radio"]`)[key - 1];
if (radio) radio.click();
if (autosubmit.checked) document.querySelector(`[type="submit"]`).click();
}
if (key.match(/Enter/)) {
document.querySelector(`[type="submit"]`).click();
}
});
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址