您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Keybinds to select radios
当前为
// ==UserScript== // @name Mturk Radio Keybinds // @namespace https://gist.github.com/Kadauchi // @version 2.0.1 // @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(); } }); window.focus();