a9 - 5 radios

Keybinds for the 5 radios in the a9 HITs

当前为 2016-11-08 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name a9 - 5 radios
  3. // @namespace http://kadauchi.com/
  4. // @version 1.0.1
  5. // @description Keybinds for the 5 radios in the a9 HITs
  6. // @author Kadauchi
  7. // @icon http://i.imgur.com/oGRQwPN.png
  8. // @include /^https://(www|s3)\.(mturkcontent|amazonaws)\.com/
  9. // @grant GM_log
  10. // @require https://code.jquery.com/jquery-3.1.1.min.js
  11. // @hitname Shoe (WARNING: This HIT may contain adult content. Worker discretion is advised.)
  12. // @hitsave https://s3.amazonaws.com/mturk_bulk/hits/235915880/onYNjrCy3S1NRlSfqUcH4Q.html
  13. // ==/UserScript==
  14.  
  15. var autosubmit = false;
  16.  
  17. function _rate (i) {
  18. $(':radio').eq(i).click();
  19. if (autosubmit) {
  20. $(':submit').click();
  21. }
  22. }
  23.  
  24. $(document).keydown(function (e) {
  25. switch (e.which) {
  26. case 49: case 97: // 1, Numpad 1
  27. _rate(0);
  28. break;
  29. case 50: case 98: // 2, Numpad 2
  30. _rate(1);
  31. break;
  32. case 51: case 99: // 3, Numpad 3
  33. _rate(2);
  34. break;
  35. case 52: case 100: // 4, Numpad 4
  36. _rate(3);
  37. break;
  38. case 53: case 101: // 5, Numpad 5
  39. _rate(4);
  40. break;
  41. case 13: // Enter
  42. $(':submit').click();
  43. break;
  44. }
  45. });
  46.  
  47. window.focus();