A9 Validation

Category Validation and Logo Validation

当前为 2015-12-23 提交的版本,查看 最新版本

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