-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtamperMonkey-clientside-script.js
34 lines (29 loc) · 1.21 KB
/
tamperMonkey-clientside-script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// ==UserScript==
// @name chessBot
// @namespace http://tampermonkey.net/
// @version 0.1
// @require https://code.jquery.com/jquery-2.1.4.min.js
// @description try to take over the world!
// @author You
// @include http*://www.chess.com*
// @grant none
// ==/UserScript==
(function(open) {
XMLHttpRequest.prototype.open = function() {
this.addEventListener("readystatechange", function() {
try{
var J = JSON.parse(this.response);
if(J && typeof J =='object' && typeof J[0] =='object'&& typeof J[0].data =='object'&& typeof J[0].data.game =='object'&& typeof J[0].data.game.reason =='string'&& J[0].data.game.reason =='movemade'&& J[0].data.game.status =='in_progress'){
var R = J[0].data.game;
$.ajax('https://localhost:4912/api', {
data : JSON.stringify(R),
contentType : 'application/json',
type : 'POST'
}, function( data ) {
});
}
}catch( E){}
}, false);
open.apply(this, arguments);
};
})(XMLHttpRequest.prototype.open);