Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. // ==UserScript==
  2. // @name New Userscript
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description try to take over the world!
  6. // @author You
  7. // @match https://datdrop.com/battle/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. //This overwrites every XHR object's open method with a new function that adds load and error listeners to the XHR request. When the request completes or errors out, the functions have access to the method and url variables that were used with the open method.
  12. //You can do something more useful with method and url than simply passing them into console.log if you wish.
  13. //https://stackoverflow.com/questions/43282885/how-do-i-use-javascript-to-store-xhr-finished-loading-messages-in-the-console
  14. (function() {
  15. var origOpen = XMLHttpRequest.prototype.open;
  16. XMLHttpRequest.prototype.open = function(method, url) {
  17. this.addEventListener('load', function() {
  18. console.log('XHR finished loading', method, url);
  19. display();
  20. });
  21.  
  22. this.addEventListener('error', function() {
  23. console.log('XHR errored out', method, url);
  24. });
  25. origOpen.apply(this, arguments);
  26. };
  27. })();
  28. function display(){
  29. var free = document.getElementsByClassName('_2-pV12L8Pq1AJyoNO9mlrZ')[0];
  30. if (typeof free !== 'undefined') {
  31. document.querySelector("div > div > div._16lXxKpcKA8dfUwC4GSBCq").click();
  32. } else {
  33. console.log("not free dont care")
  34. return;
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement