-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinit.js
40 lines (34 loc) · 1.56 KB
/
init.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
window.addEventListener('load', function() {
//function init() {
// Checks Web3 support
/*
if(typeof web3 !== 'undefined' && typeof Web3 !== 'undefined') {
// If there's a web3 library loaded, then make your own web3
web3 = new Web3(web3.currentProvider);
} else*/ if (typeof Web3 !== 'undefined') {
alert(1);
// If there isn't then set a provider
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
} else if(typeof web3 == 'undefined' && typeof Web3 == 'undefined') {
// If there is neither then this isn't an ethereum browser
document.getElementById("results").style.display = "none";
document.getElementById("see-results").style.display = "none";
document.getElementById("vote-support").style.display = "none";
document.getElementById("vote-against").style.display = "none";
document.getElementById("subtitle").style.display = "none";
document.getElementById("proposal").textContent = "Give Stakers a Voice";
var message = document.getElementById("message");
message.style.display = "block";
return;
}
globalWeb3 = web3;
var simplemixerContract = web3.eth.contract(contractABI);
globalContractInstance = simplemixerContract.at(contractAddressTestnet);
var page = location.pathname.split("/").slice(-1);
if( page.toString() === "index.html" || page.toString() === ""){
myDealsPage();
}
else if( page.toString() === "alldeals.html" ){
allDealsPage();
}
});