theHunter auto join all competitions

Add a button to join all avalaible competitions at once. You need to be on competitions page first ! It will only joins competitions that are displayed on screen !

  1. // ==UserScript==
  2. // @name theHunter auto join all competitions
  3. // @namespace https://greasyfork.org/fr/users/153112-spychopat
  4. // @version 0.1
  5. // @description Add a button to join all avalaible competitions at once. You need to be on competitions page first ! It will only joins competitions that are displayed on screen !
  6. // @author Spychopat
  7. // @match https://www.thehunter.com/
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11.  
  12. function joinAllComp() {
  13. var buttons = [];
  14. do {
  15. console.log("check buttons...");
  16. buttons = document.getElementsByClassName("btn btn-primary btn-join");
  17. } while (buttons.length = 0);
  18. console.log("Buttons found ! Starting clicking buttons...");
  19. for (var i = 0; i < buttons.length; i++) {
  20. console.log("Clicking button "+i+"...");
  21. buttons[i].click();
  22. }
  23. }
  24.  
  25. (function() {
  26. 'use strict';
  27. var btn = document.createElement("BUTTON");
  28. btn.innerHTML = "JOIN ALL COMPETITIONS";
  29. btn.onclick = function(){joinAllComp()};
  30. btn.style.background = "#f9370d";
  31. btn.style.border = "none";
  32. btn.style.color = "#fff";
  33. btn.style.borderRadius = "5px";
  34. btn.style.fontSize = "20px";
  35. btn.style.padding = "10px";
  36. btn.style.margin = "10px";
  37. btn.style.boxShadow = "2px 2px rgba(0,0,0,0.4)";
  38. document.getElementById("page_menu").appendChild(btn);
  39.  
  40. })();