Guest User

Lever of Doom Avatar

a guest
Mar 18th, 2016
474
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name Lever of Doom
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description try to take over the world!
  6. // @include http://www.neopets.com/space/strangelever.phtml
  7. // @include http://www.neopets.com/space/leverofdoom.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 backToLever = findLinkContainingString("Go Back to the Lever");
  29. var pullLever = findLinkContainingString("Pull the Lever Anyway");
  30. if (document.body.innerHTML.search("You are now eligible to use") < 0) {
  31. if (backToLever != null) {
  32. backToLever.click();
  33. } else {
  34. pullLever.click();
  35. }
  36. }
RAW Paste Data