superfish

Assists with Superfish hits on Amazon Mechanical Turk

当前为 2014-06-27 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name superfish
  3. // @namespace whatever
  4. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js
  5. // @include https://www.mturkcontent.com/dynamic*
  6. // @description Assists with Superfish hits on Amazon Mechanical Turk
  7. // @version 1.3
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. $('img').each(function(){
  12. $(this).click(function(){
  13. $(this).next().next().click();
  14. });
  15. });
  16.  
  17. if (!this.GM_getValue || (this.GM_getValue.toString && this.GM_getValue.toString().indexOf("not supported")>-1)) {
  18. this.GM_getValue=function (key,def) {
  19. return localStorage[key] || def;
  20. };
  21. this.GM_setValue=function (key,value) {
  22. return localStorage[key]=value;
  23. };
  24. this.GM_deleteValue = function(key) {
  25. return localStorage.removeItem(key);
  26. };
  27. }
  28.  
  29. if (GM_getValue("superfish")){
  30. $('input').each(function(){
  31. if ($(this).attr("type") == "checkbox" && $(this).attr("id") != "assignmentId" && $(this).attr("value") != "none" && $(this).attr("id") != "submitButton")
  32. $(this).click();
  33. });
  34. }
  35.  
  36. document.onkeydown = showkeycode;
  37. function showkeycode(evt){
  38. var keycode = evt.keyCode;
  39. switch (keycode) {
  40. case 13: //enter
  41. document.getElementById("mturk_form").submit();
  42. break;
  43. case 192: //`
  44. $('input').each(function(){
  45. if ($(this).attr("type") == "checkbox" && $(this).attr("id") != "assignmentId" && $(this).attr("value") != "none" && $(this).attr("id") != "submitButton")
  46. $(this).click();
  47. });
  48. if (GM_getValue("superfish"))
  49. GM_deleteValue("superfish");
  50. else
  51. GM_setValue("superfish",1);
  52. break;
  53. }}