forked from DannyDaemonic/MonsterMinigameWormholeWarp
-
Notifications
You must be signed in to change notification settings - Fork 38
/
autoPlay.user.js
68 lines (59 loc) · 2.69 KB
/
autoPlay.user.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// ==UserScript==
// @name Ye Olde Megajump (Auto-updating)
// @namespace https://github.com/YeOldeWH/MonsterMinigameWormholeWarp
// @description A script that runs the Steam Monster Minigame for you. Now with megajump. Brought to you by the Ye Olde Wormhole Schemers and DannyDaemonic
// @version 6.0.3
// @match *://steamcommunity.com/minigame/towerattack*
// @match *://steamcommunity.com//minigame/towerattack*
// @grant GM_xmlhttpRequest
// @updateURL https://raw.githubusercontent.com/YeOldeWH/MonsterMinigameWormholeWarp/master/autoPlay.user.js
// @downloadURL https://raw.githubusercontent.com/YeOldeWH/MonsterMinigameWormholeWarp/master/autoPlay.user.js
// ==/UserScript==
(function(x) {
// Options
var old_version = false;
var update_json_url = 'https://raw.githubusercontent.com/YeOldeWH/MonsterMinigameWormholeWarp/master/version.json';
var script_url = 'https://raw.githubusercontent.com/YeOldeWH/MonsterMinigameWormholeWarp/master/autoplay.noUpdate.user.js';
var loader_version = '6.0.3';
// Load the actual script
GM_xmlhttpRequest ({
method: "GET",
url: script_url + "?" + new Date().getTime(),
onload: function(response) {
var scriptElement = document.createElement( "script" );
scriptElement.type = "text/javascript";
scriptElement.innerHTML = response.responseText;
document.body.appendChild (scriptElement);
}
});
function do_check () {
GM_xmlhttpRequest ({
method: "GET",
url: update_json_url + "?" + new Date().getTime(),
onload: function(response) {
var version_data = JSON.parse(response.responseText);
if (version_data.Version != old_version) {
if (old_version === false) {
// First time reading the JSON
old_version = version_data.Version;
// Display the version
var versionDiv = document.createElement ("div");
versionDiv.innerHTML = '<div style="' +
'color: white; position: fixed; right: 1em; ' +
'border: 1px solid white; padding: 2px; background: black;' +
'bottom: 1em; z-index: 9999;">Loader: ' + loader_version + ' Script: ' + old_version + '</div>';
document.body.appendChild (versionDiv);
// Check again in 15 minutes
x.setTimeout (do_check, 15 * 60 * 1000);
} else {
x.location.reload(true);
}
} else {
// Check again in 5 minutes
x.setTimeout (do_check, 5 * 60 * 1000);
}
}
});
}
do_check ();
}(window));