Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name New Userscript
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description try to take over the world!
- // @author You
- // @match https://datdrop.com/battle/*
- // @grant none
- // ==/UserScript==
- //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.
- //You can do something more useful with method and url than simply passing them into console.log if you wish.
- //https://stackoverflow.com/questions/43282885/how-do-i-use-javascript-to-store-xhr-finished-loading-messages-in-the-console
- (function() {
- var origOpen = XMLHttpRequest.prototype.open;
- XMLHttpRequest.prototype.open = function(method, url) {
- this.addEventListener('load', function() {
- console.log('XHR finished loading', method, url);
- display();
- });
- this.addEventListener('error', function() {
- console.log('XHR errored out', method, url);
- });
- origOpen.apply(this, arguments);
- };
- })();
- function display(){
- var free = document.getElementsByClassName('_2-pV12L8Pq1AJyoNO9mlrZ')[0];
- if (typeof free !== 'undefined') {
- document.querySelector("div > div > div._16lXxKpcKA8dfUwC4GSBCq").click();
- } else {
- console.log("not free dont care")
- return;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement