(mTurk) Dave Cobb HIT Helper

(mTurk) Press "1" to select "Yes, we missed some faces/heads!" and advance. Press "2" to select "No, every single face/head has been found." and advance.

目前为 2014-10-24 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name (mTurk) Dave Cobb HIT Helper
  3. // @namespace http://ericfraze.com
  4. // @version 0.1
  5. // @description (mTurk) Press "1" to select "Yes, we missed some faces/heads!" and advance. Press "2" to select "No, every single face/head has been found." and advance.
  6. // @author Eric Fraze
  7. // @match https://dbxtagger.appspot.com/*
  8. // @grant none
  9. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
  10. // ==/UserScript==
  11.  
  12. $(document).ready(function() {
  13. $(document).keyup(function (event) {
  14. var key = toCharacter(event.keyCode);
  15. if (key=='1') {
  16. $("#missed").click();
  17. $("#nextbtn").click();
  18. }
  19. if (key=='2') {
  20. $("#notmissed").click();
  21. $("#nextbtn").click();
  22. }
  23. if (key=='ENTER') {
  24. $("#submitbtn").click();
  25. }
  26. });
  27. });
  28.  
  29. function toCharacter(keyCode) {
  30.  
  31. // delta to convert num-pad key codes to QWERTY codes.
  32. var numPadToKeyPadDelta = 48;
  33.  
  34. // if a numeric key on the num pad was pressed.
  35. if (keyCode >= 96 && keyCode <= 105) {
  36. keyCode = keyCode - numPadToKeyPadDelta;
  37. return String.fromCharCode(keyCode);
  38. }
  39.  
  40. if (keyCode == 106)
  41. return "*";
  42.  
  43. if (keyCode == 107)
  44. return "+";
  45.  
  46. if (keyCode == 109)
  47. return "-";
  48.  
  49. if (keyCode == 110)
  50. return ".";
  51.  
  52. if (keyCode == 111)
  53. return "/";
  54.  
  55. // the 'Enter' key was pressed
  56. if (keyCode == 13)
  57. return "ENTER"; //TODO: you should change this to interpret the 'Enter' key as needed by your app.
  58.  
  59. return String.fromCharCode(keyCode);
  60. }