A9 Validation

Category Validation.

当前为 2015-08-14 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name A9 Validation
  3. // @namespace https://greasyfork.org/users/11580
  4. // @version 1.0
  5. // @description Category Validation.
  6. // @description Validate an image.
  7. // @author Kadauchi
  8. // @include https://www.mturkcontent.com/dynamic/*
  9. // @grant GM_log
  10. // @require http://code.jquery.com/jquery-2.1.0.min.js
  11. // ==/UserScript==
  12.  
  13. var autosubmit = false;
  14.  
  15. // Variable to check for the type of HIT.
  16. var Category_Validation = $('u:contains("Select the first option that applies to the image on the ")');
  17.  
  18. if (Category_Validation.length) {
  19.  
  20. $("input[value='Valid_Object']").focus();
  21.  
  22. // Keybinds
  23. window.onkeydown = function(e) {
  24.  
  25. // Only one.
  26. if ((e.keyCode === 49) || (e.keyCode === 97) || (e.altKey && e.keyCode === 97)) { // 1 or Numpad1 or Alt+Numpad1
  27. $("input[value='Valid_Object']").click();
  28. $("input[value='Partial_Object']").prop('checked', false);
  29. if (autosubmit) {
  30. $("input[id='submitButton']").click();
  31. }
  32. }
  33.  
  34. // Only one, blocked or out.
  35. if ((e.keyCode === 50) || (e.keyCode === 98) || (e.altKey && e.keyCode === 98)) { // 2 or Numpad2 or Alt+Numpad2
  36. $("input[value='Valid_Object']").click();
  37. $("input[value='Partial_Object']").click();
  38. if (autosubmit) {
  39. $("input[id='submitButton']").click();
  40. }
  41. }
  42.  
  43. // More than one.
  44. if ((e.keyCode === 51) || (e.keyCode === 99) || (e.altKey && e.keyCode === 99)) { // 3 or Numpad3 or Alt+Numpad3
  45. $("input[value='Multiple_Objects']").click();
  46. $("input[value='Partial_Object']").prop('checked', false);
  47. if (autosubmit) {
  48. $("input[id='submitButton']").click();
  49. }
  50. }
  51.  
  52. // The image contains adult content and/or obscenity and/or financial and/or residential addresses.
  53. if ((e.keyCode === 52) || (e.keyCode === 100) || (e.altKey && e.keyCode === 100)) { // 4 or Numpad4 or Alt+Numpad4
  54. $("input[value='Obscene_Finance']").click();
  55. $("input[value='Partial_Object']").prop('checked', false);
  56. if (autosubmit) {
  57. $("input[id='submitButton']").click();
  58. }
  59. }
  60.  
  61. // No.
  62. if ((e.keyCode === 53) || (e.keyCode === 101) || (e.altKey && e.keyCode === 101)) { // 5 or Numpad5 or Alt+Numpad5
  63. $("input[value='Missing_Object']").click();
  64. $("input[value='Partial_Object']").prop('checked', false);
  65. if (autosubmit) {
  66. $("input[id='submitButton']").click();
  67. }
  68. }
  69.  
  70. //Submit
  71. if (e.keyCode === 13) { // Enter or NumpadEnter
  72. $("input[id='submitButton']").click();
  73. }
  74. };
  75. }
  76.  
  77. // Makes radio and checkboxes bigger.
  78. $("input[type='radio']").css({ width: '1.25em', height: '1.25em'});
  79. $("input[type='checkbox']").css({ width: '1.25em', height: '1.25em'});