A9 Validation

Category Validation and Logo Validation

当前为 2015-10-22 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name A9 Validation
  3. // @namespace https://greasyfork.org/users/11580
  4. // @version 1.1
  5. // @description Category Validation and Logo 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. $("#truth").click(function(){
  20. $("input[value='Valid_Object']").click();
  21. });
  22.  
  23. $("input[value='Missing_Object']").focus();
  24. $("input[value='Missing_Object']").click();
  25.  
  26. // Keybinds
  27. window.onkeydown = function(e) {
  28.  
  29. // Only one.
  30. if ((e.keyCode === 49) || (e.keyCode === 97) || (e.altKey && e.keyCode === 97)) { // 1 or Numpad1 or Alt+Numpad1
  31. $("input[value='Valid_Object']").click();
  32. $("input[value='Partial_Object']").prop('checked', false);
  33. if (autosubmit) {
  34. $("input[id='submitButton']").click();
  35. }
  36. }
  37.  
  38. // Only one, blocked or out.
  39. if ((e.keyCode === 50) || (e.keyCode === 98) || (e.altKey && e.keyCode === 98)) { // 2 or Numpad2 or Alt+Numpad2
  40. $("input[value='Valid_Object']").click();
  41. $("input[value='Partial_Object']").click();
  42. if (autosubmit) {
  43. $("input[id='submitButton']").click();
  44. }
  45. }
  46.  
  47. // More than one.
  48. if ((e.keyCode === 51) || (e.keyCode === 99) || (e.altKey && e.keyCode === 99)) { // 3 or Numpad3 or Alt+Numpad3
  49. $("input[value='Multiple_Objects']").click();
  50. $("input[value='Partial_Object']").prop('checked', false);
  51. if (autosubmit) {
  52. $("input[id='submitButton']").click();
  53. }
  54. }
  55.  
  56. // The image contains adult content and/or obscenity and/or financial and/or residential addresses.
  57. if ((e.keyCode === 52) || (e.keyCode === 100) || (e.altKey && e.keyCode === 100)) { // 4 or Numpad4 or Alt+Numpad4
  58. $("input[value='Obscene_Finance']").click();
  59. $("input[value='Partial_Object']").prop('checked', false);
  60. if (autosubmit) {
  61. $("input[id='submitButton']").click();
  62. }
  63. }
  64.  
  65. // No.
  66. if ((e.keyCode === 53) || (e.keyCode === 101) || (e.altKey && e.keyCode === 101)) { // 5 or Numpad5 or Alt+Numpad5
  67. $("input[value='Missing_Object']").click();
  68. $("input[value='Partial_Object']").prop('checked', false);
  69. if (autosubmit) {
  70. $("input[id='submitButton']").click();
  71. }
  72. }
  73.  
  74. //Submit
  75. if (e.keyCode === 13) { // Enter or NumpadEnter
  76. $("input[id='submitButton']").click();
  77. }
  78. };
  79. }
  80.  
  81. // Makes radio and checkboxes bigger.
  82. $("input[type='radio']").css({ width: '1.25em', height: '1.25em'});
  83. $("input[type='checkbox']").css({ width: '1.25em', height: '1.25em'});