Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2018
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Mush Character Autopicker
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Reloads the /chooseHero page, waits for your favorite character and autopicks it
  6. // @author HwangLiu
  7. // @match http://mush.vg/chooseHero
  8. // @match http://mush.twinoid.com/chooseHero
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. //Checks for a preferred character
  13. var allImages = document.getElementsByTagName("img");
  14. for (var i = 0, max = allImages.length; i < max; i++)
  15. if (allImages[i].src === "http://mush.vg/img/art/char/paola_rinaldo.jpg"){
  16. var target = allImages[i];
  17. break;
  18. }
  19.  
  20. //Sets the countdown to reload the page
  21. setTimeout(function() {
  22. location.reload();
  23. }, 300000);
  24.  
  25. //Choosing the preferred character
  26. var clickEvent = document.createEvent ('MouseEvents');
  27. clickEvent.initEvent ('click', true, true);
  28. target.dispatchEvent (clickEvent);
  29.  
  30. //Pressing Join the ship button
  31. var joinButton = document.getElementsByClassName("but2bg")
  32. joinButton[0].dispatchEvent (clickEvent);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement