Basic Macro

Regular Split = E Macro Feed = Q

  1. // ==UserScript==
  2. // @name Basic Macro
  3. // @namespace Add Any Site By Typing // @match and your website (above user script
  4. // @version 0.1
  5. // @description Regular Split = E Macro Feed = Q
  6. // @author Eclipse
  7. // @match http://micos.io/*
  8. // @match http://germs.io/*
  9. // @grant none
  10. // ==/UserScript==
  11. / jshint -W097 /
  12. 'use strict';
  13.  
  14. var SplitInterval;
  15. var MacroInterval;
  16. var SplitDebounce = false;
  17. var MacroDebounce = false;
  18. $(document).on('keydown', function(input) {
  19. console.log("got keydown")
  20. if (input.keyCode == 69) {
  21. if (SplitDebounce) {
  22. return;
  23. }
  24. SplitDebounce = true;
  25. SplitInterval = setInterval(function() {
  26. $("body").trigger($.Event("keydown", {
  27. keyCode: 32
  28. }));
  29. $("body").trigger($.Event("keyup", {
  30. keyCode: 32
  31. }));
  32. }, 0);
  33. } else if (input.keyCode == 81) {
  34. if (MacroDebounce) {
  35. return;
  36. }
  37. MacroDebounce = true;
  38. MacroInterval = setInterval(function() {
  39. $("body").trigger($.Event("keydown", {
  40. keyCode: 87
  41. }));
  42. $("body").trigger($.Event("keyup", {
  43. keyCode: 87
  44. }));
  45. }, 0);
  46. }
  47. })
  48.  
  49. $(document).on('keyup', function(input) {
  50. if (input.keyCode == 69) {
  51. SplitDebounce = false;
  52. clearInterval(SplitInterval);
  53. return;
  54. } else if (input.keyCode == 81) {
  55. MacroDebounce = false;
  56. clearInterval(MacroInterval);
  57. return;
  58. }
  59. })