Howrse Reserve EC Boxes Simplified

Simplifies reserving EC boxes on Howrse to yourself or unreserving them.

  1. // ==UserScript==
  2. // @name Howrse Reserve EC Boxes Simplified
  3. // @namespace myHowrse
  4. // @description Simplifies reserving EC boxes on Howrse to yourself or unreserving them.
  5. // @include http://*.howrse.com/centre/box/*
  6. // @version 2
  7. // ==/UserScript==
  8. // finds the URL to your presentation page
  9. lastMenu = document.getElementsByClassName("menu-sub-item last last-profil");
  10. menuList = lastMenu[0].getElementsByTagName("a");
  11. myPageLink = document.URL.substring(0,document.URL.indexOf("/centre")) + menuList[3].getAttribute("href");
  12. usergroup2List = document.getElementsByClassName("usergroup_2");
  13. // finds your username if you already have at least one reserved box
  14. i=0;
  15. reserveName = "";
  16. while(i < usergroup2List.length)
  17. {
  18. if(usergroup2List[i].getAttribute("href") == myPageLink)
  19. {
  20. reserveName = usergroup2List[i].textContent;
  21. i = usergroup2List.length;
  22. }
  23. else ++i;
  24. }
  25. // sets all of the initial input values for the boxes to either your username or ""
  26. boxList = document.getElementsByName("boxFormReserverLogin");
  27. for(i=0;i < boxList.length; ++i)
  28. {
  29. if(boxList[i].getAttribute("value") == reserveName) boxList[i].setAttribute("value","");
  30. else boxList[i].setAttribute("value",reserveName);
  31. }