Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. // ==UserScript==
  2. // @name New Userscript
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description try to take over the world!
  6. // @author You
  7. // @match https://de165.die-staemme.de/game.php?village=*&screen=am_farm*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. var win = typeof unsafeWindow != 'undefined' ? unsafeWindow : window;
  15.  
  16. var $ = win.$;
  17. let doc = document;
  18. // 8 9 10
  19.  
  20.  
  21. doc.addEventListener('keydown', function(e) {
  22. let index = 0
  23. if(e.keyCode == 89 || e.keyCode == 88 || e.keyCode == 67) {
  24. let row = $('#plunder_list').find('tr:visible')[2];
  25.  
  26. switch(e.keyCode){
  27. case 89:
  28. index = 8
  29. console.log("A FARM");
  30. break;
  31. case 88:
  32. index = 9
  33. console.log("B FARM");
  34. break;
  35. case 67:
  36. index = 10
  37. console.log("C FARM");
  38. break;
  39.  
  40. }
  41. let td = row.getElementsByTagName('td')[index];
  42. let button = td.getElementsByTagName('a');
  43. button[0].click();
  44.  
  45. }
  46.  
  47. }, false);
  48.  
  49. // Your code here...
  50. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement