Greasy Fork 还支持 简体中文。

Amazon requester Customer Interests

hotkeys

  1. // ==UserScript==
  2. // @name Amazon requester Customer Interests
  3. // @namespace https://greasyfork.org/en/users/9054
  4. // @version 0.4
  5. // @author ikarma
  6. // @description hotkeys
  7. // @include https://s3.amazonaws.com/mturk_bulk/*
  8. // @grant none
  9. // @require http://code.jquery.com/jquery-2.1.0.min.js
  10.  
  11. // ==/UserScript==
  12.  
  13. var $j = jQuery.noConflict(true);
  14.  
  15. var Cat = $("p:eq(3)").text();
  16. var Cat = Cat.split(":");
  17. var Categ = Cat[1].trim();
  18.  
  19.  
  20. var sheet = document.createElement('style');
  21. sheet.innerHTML = ".highlight { font-weight: bold; background-color: yellow; font-size: 110%;}";
  22. document.body.appendChild(sheet);
  23. /*
  24.  
  25. highlight v5
  26.  
  27. Highlights arbitrary terms.
  28.  
  29. <http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html>
  30.  
  31. MIT license.
  32.  
  33. Johann Burkard
  34. <http://johannburkard.de>
  35. <mailto:jb@eaio.com>
  36.  
  37. */
  38.  
  39. jQuery.fn.highlight = function(pat) {
  40. function innerHighlight(node, pat) {
  41. var skip = 0;
  42. if (node.nodeType == 3) {
  43. var pos = node.data.toUpperCase().indexOf(pat);
  44. pos -= (node.data.substr(0, pos).toUpperCase().length - node.data.substr(0, pos).length);
  45. if (pos >= 0) {
  46. var spannode = document.createElement('span');
  47. spannode.className = 'highlight';
  48. var middlebit = node.splitText(pos);
  49. var endbit = middlebit.splitText(pat.length);
  50. var middleclone = middlebit.cloneNode(true);
  51. spannode.appendChild(middleclone);
  52. middlebit.parentNode.replaceChild(spannode, middlebit);
  53. skip = 1;
  54. }
  55. }
  56. else if (node.nodeType == 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) {
  57. for (var i = 0; i < node.childNodes.length; ++i) {
  58. i += innerHighlight(node.childNodes[i], pat);
  59. }
  60. }
  61. return skip;
  62. }
  63. return this.length && pat && pat.length ? this.each(function() {
  64. innerHighlight(this, pat.toUpperCase());
  65. }) : this;
  66. };
  67.  
  68. jQuery.fn.removeHighlight = function() {
  69. return this.find("span.highlight").each(function() {
  70. this.parentNode.firstChild.nodeName;
  71. with (this.parentNode) {
  72. replaceChild(this.firstChild, this);
  73. normalize();
  74. }
  75. }).end();
  76. };
  77. // end of plugin
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85. $('#asin_info').highlight(Categ);
  86.  
  87.  
  88.  
  89.  
  90.  
  91. document.addEventListener( "keydown", kas, false);
  92.  
  93.  
  94.  
  95.  
  96.  
  97. function kas(i) {
  98. if (i.keyCode == 97 ) { //A or npad 1
  99. $j('input[value="yes"]').eq(0).click();
  100. $j('input[id="submitButton"]').eq(0).click();
  101. }
  102. if (i.keyCode == 98 ) { //S or npad 2
  103. $j('input[value="no"]').eq(0).click();
  104. $j('input[id="submitButton"]').eq(0).click();
  105. }
  106. if (i.keyCode == 99 ) { //D or npad 3
  107. $j('input[name="skip"]').eq(0).click();
  108. $j('input[id="submitButton"]').eq(0).click();
  109. }
  110.  
  111. }
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.