Guest User

Symol Hole Avatar

a guest
Mar 18th, 2016
447
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name Symol Hole Avatar
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description try to take over the world!
  6. // @author You
  7. // @match http://www.neopets.com/medieval/symolhole.phtml*
  8. // @grant none
  9. // ==/UserScript==
  10. /* jshint -W097 */
  11. 'use strict';
  12.  
  13. function findLinkContainingString(myStr) {
  14. var aTags = document.getElementsByTagName("input");
  15. var searchText = myStr;
  16. var found;
  17.  
  18. for (var i = 0; i < aTags.length; i++) {
  19. if (aTags[i].value.search(searchText) != -1) {
  20. console.log("Found tag with textContent: " + aTags[i].value);
  21. found = aTags[i];
  22. break;
  23. }
  24. }
  25. return found;
  26. }
  27.  
  28. var url = window.location.href;
  29. if (url.search("type") < 0) {
  30. // Symol Hole Main page
  31. findLinkContainingString("ENTER!").click();
  32. } else {
  33. // Stop if we get avatar. Otherwise, go back to main page
  34. if (document.body.innerHTML.search("You are now eligible to use") < 0) {
  35. window.location.href = "http://www.neopets.com/medieval/symolhole.phtml";
  36. }
  37. }
RAW Paste Data