-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
324 lines (319 loc) · 13 KB
/
index.html
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ECVM</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<script type="text/javascript" src="js/mds.js"></script>
<script type="text/javascript" src="js/service.js"></script>
<script type="text/javascript" src="js/tracker.js"></script>
<link rel="icon" type="image/x-icon" href="pic/favicon.ico"/>
<link rel="stylesheet" href="css/styles.css" />
</head>
<body>
<h1>ECVM</h1>
<a href="Coin.html">Coin</a><br/>
<a href="Card.html">Card</a><br/>
<a href="Contract.html">Contract</a><br/>
<a href="Ticket.html">Ticket</a><br/>
<a href="Deed.html">Deed</a><br/>
<br/>
The following is based on the 'Tracker' Minima Innovation Challenge App.<br/>
<p class="statusdata">Maxima User Name: <span class="maindata" id="maximacontactname"></span></p>
<p class="statusdata">Current Node Version: <span class="maindata" id="version"></span></p>
<p class="statusdata">Current Blockchain Time: <span class="maindata" id="blockchaintime"></span></p>
<div class="AdvertiserSection" id="advertiserbanner">
</div>
<div class="wrapper">
<div class="INF contacts">
<h2>MAXIMA CONTACTS</h2>
<table>
<tr>
<td style="color:#FFF; text-align:right;">List of Contacts: </td>
<td>
<select id="contactslist" ></select>
</td>
</tr>
</table>
<p>Name: <span id="contactname"></span></p>
<p>PublicKey: <span id="contactpublickey"></span></p>
<p>Current Address: <span id="contactid"></span></p>
</div>
<div class="INF Createcontact">
<h2>ADD CONTACT</h2>
<p>Here you can add a Maxima Contact.</p>
<table class="">
<tr>
<td style="color:#FFF; text-align:right;">PublicKey: </td>
<td><input type="text" id='publickeycontact'></td>
</tr>
<tr>
<td style="color:#FFF; text-align:right;">Contact Id: </td>
<td><input type="text" id='idcontact'></td>
</tr>
<tr>
<td>
<button class="button" onclick='addContact();'>Add Contact</button>
</td>
</tr>
</table>
</div>
<div class="INF Buytoken">
<table>
<h2>SEND TOKENS MANUALLY</h2>
<p>Fill in the fields send Tokens.</p>
<tr>
<td style="color:#FFF; text-align:right;">Token to Send: </td>
<td>
<select id="tokens"></select>
</td>
</tr>
<tr>
<td style=" color:#FFF; text-align:right;">Amount: </td>
<td><input type="number" id='amount' maxlength='64'></td>
</tr>
<tr>
<td style=" color:#FFF; text-align:right;">Address to Send: </td>
<td><input type="text" id='destinationaddress' maxlength='66'></td>
</tr>
</table>
<br>
<button type="button" id="buybutton" class="Button" onclick="sendTokens();">Send Tokens</button>
</div>
<div class="INF Tokencreate">
<h2>LIST OF MDAE DAPP'S </h2>
<table style="color:#FFF; border=0;">
<tr>
<td style="color:#FFF; text-align:right;">As a: </td>
<td style="margin:5px;">
<select id="role">
<option value="user">User</option>
<option value="developer">Developer</option>
</select>
</td>
</tr>
<tr>
<td style="color:#FFF; text-align:right;">Dapp's List: </td>
<td><select id="daoapps" onchange="daodapslist();"></td>
</tr>
<tr>
<td style="text-align:right;">Earned Token: </td>
<td><span id="earnedtoken"></span></td>
</tr>
<tr>
<td style="text-align:right;">Amount Accumulated: </td>
<td><span id="amountacumulated"></span></td>
</tr>
</table>
<br>
<button type="button" class="Button" onclick="addDapp();">Add Dapp</button>
</div>
<div class="INF Tokenminima">
<h2>MINIMA TOKEN BALANCE</h2>
<p>Token: <span id="MinimaToken"></span></p>
<p >Tokenid: <span id="MinimaTokenid"></span></p>
<p>Coins: <span id="MinimaCoins"></span></p>
<p>Sendable: <span id="MinimaSendable"></span></p>
<p>Total Minima's Amount: <span id="MinimaTotal"></span></p>
<button class="button" onclick='minimaBalance();'>Update Minima Balance</button>
<p><span id="StatusBalancesMinima"></span></p>
</div>
<div class="INF Balance">
<h2>TOKEN BALANCE</h2>
<tr>
<td style="color:#FFF; text-align:right;">Token : </td>
<td>
<select id="tokens2" onchange="tokenBalance();">
</select>
</td>
</tr>
<p>Tokenid: <span id="Tokenid"></span></p>
<p>Coins: <span id="Coins"></span></p>
<p>Sendable: <span id="Sendable"></span></p>
<p>Total Token's Amount: <span id="Total"></span></p>
</div>
</div>
<div class="Box WalletSection">
<h2>PROFILE SECTION</h2>
<table style="color:#FFF; border=0;">
<tr>
<td style="color:#FFF; text-align:right;">Select a Profile: </td>
<td style="margin:5px;">
<select id="roleselector">
<option value="user">User</option>
<option value="developer">Developer</option>
</select>
</td>
</tr>
<tr>
<td style="color:#FFF; text-align:right;">Dapp's List: </td>
<td><select id="daoapps" onchange="daodapslist();"></td>
</tr>
<tr>
<td style="text-align:right;">Amount Accumulated: </td>
<td><span id="amountacumulated"></span></td>
</tr>
</table>
<!-- Simple modal dialog containing the Profile form -->
<dialog id="favDialog">
<form method="dialog">
<p><label>Topics Available:
<select>
<option value="default">List of topics:</option>
<option>Sports</option>
<option>Travel</option>
<option>Cars</option>
<option>Cosmetics</option>
</select>
</label></p>
<div>
<button value="cancel">Cancel</button>
<button id="confirmBtn" value="default">Send a Topic to the DAO</button>
</div>
</form>
</dialog>
<br>
<!-- <button class="button" id="updateDetails" onclick='datarole="user"; processProfile(datarole);'>Set a User Profile</button>
<button class="button" id="updateDetails" onclick='datarole="developer"; processProfile(datarole);'>Set a Developer Profile</button>
-->
<button id="updateDetails" class="button">Send New Topic to the DAO</button>
</div>
<div class="Box WalletSection">
<h2>WALLETS SECTION</h2>
<p class="statusdata">Current User Wallet Address: <span style="font-size: 0.8em;" class="maindata" id="userwalletaddress"></span></p>
<p class="statusdata">Current Developer Wallet Address: <span style="font-size: 0.8em;" class="maindata" id="developerwalletaddress"></span></p>
<button class="button" onclick='datarole="user"; processWallet(datarole);'>Set User Wallet Address</button>
<button class="button" onclick='datarole="developer"; processWallet(datarole);'>Set Developer Wallet Address</button>
</div>
<div class="Box Statussection">
<h2>STATUS AND TOOLS SECTION</h2>
<button class="button" onclick='contact();'>Maxima</button>
<button class="button" onclick='setMaximaName();'>Set Maxima Name</button>
<button class="button" onclick='newAddress();'>New Address</button>
<button class="button" onclick='getAddress();'>Get Address</button>
<button class="button" onclick='setDAOWalletAddress();'>Set DAO Wallet Address</button>
<button class="button" onclick='coins();'>Coins</button>
<button class="button" onclick='newBalanceEvent();'>List DB Transactions</button>
<pre id="status-object"></pre>
<div class="visualconsole"></div>
</div>
<div class="Box Credits">
<p style="text-align: center;">Developed by Minima Innovation Challenge Team</p>
</div>
<script type="text/javascript">
//document.getElementById("buybutton").disabled = true;
//Initialise the dongles and data
Getcontacts();
GetTokens();
displayPublicity();
/******** This is the update profile pop-up window **************/
const updateButton = document.getElementById('updateDetails');
const favDialog = document.getElementById('favDialog');
//const outputBox = document.querySelector('output');
const selectEl = favDialog.querySelector('select');
const confirmBtn = favDialog.querySelector('#confirmBtn');
// If a browser doesn't support the dialog, then hide the
// dialog contents by default.
if (typeof favDialog.showModal !== 'function') {
favDialog.hidden = true;
/* a fallback script to allow this dialog/form to function
for legacy browsers that do not support <dialog>
could be provided here.
*/
}
// "Update details" button opens the <dialog> modally
updateButton.addEventListener('click', () => {
if (typeof favDialog.showModal === "function") {
favDialog.showModal();
} else {
outputBox.value = "Sorry, the <dialog> API is not supported";
}
});
// Sets the value of the submit button
selectEl.addEventListener('change', (e) => {
confirmBtn.value = selectEl.value;
});
// "Confirm" button of form triggers "close" on dialog because of [method="dialog"]
favDialog.addEventListener('close', () => {
//outputBox.value = `${favDialog.returnValue} button clicked - ${(new Date()).toString()}`;
if (favDialog.returnValue != "cancel"){
selectElement = document.getElementById("roleselector");
roleselected = selectElement.value;
TOPICS_OF_INTEREST = favDialog.returnValue;
isthereaWallet(roleselected);
}
});
/****** This is the update profile pop-up window *************/
//Send the Contacts available to the dongles
function Getcontacts() {
MDS.cmd("maxcontacts", function(result) {
//MDS.log(JSON.stringify(result));
var contact = result.response.contacts;
if (result.status) {
if(contact.length==0){
return;
}
else{
//Create the select dongles
var select = document.getElementById('contactslist');
while (select.hasChildNodes()) {
select.removeChild(select.firstChild);
}
//Add each Token
contact = result.response.contacts;
//Add the contacts to the dongle list contacts
for(var i = 0; i < contact.length; i++) {
var opt = document.createElement('option');
opt.value = contact[i].id;
opt.innerHTML = contact[i].extradata.name;
document.getElementById("contactname").innerText = contact[i].extradata.name;
document.getElementById("contactpublickey").innerText = contact[i].publickey;
document.getElementById("contactid").innerText = contact[i].currentaddress;
select.appendChild(opt);
}
}
}
})
}
//Send the Tokens available to the dongles
function GetTokens(){
MDS.cmd("balance",function(result){
//Create the select dongles
var select = document.getElementById('tokens');
while (select.hasChildNodes()) {
select.removeChild(select.firstChild);
}
var select2 = document.getElementById('tokens2');
while (select2.hasChildNodes()) {
select2.removeChild(select2.firstChild);
}
//Add each Token
balance = result.response;
//Add the tokens to the dongle Buy a Token (spend)
for(var i = 0; i < balance.length; i++) {
var opt = document.createElement('option');
if(balance[i].tokenid == "0x00"){
opt.value = balance[i].tokenid;
opt.innerHTML = balance[i].token;
}else{
opt.value = balance[i].tokenid;
opt.innerHTML = balance[i].token.name;
}
select.appendChild(opt);
}
//Add tokens to the dongle Token balance
for(var i = 0; i < balance.length; i++) {
var opt = document.createElement('option');
if(balance[i].tokenid == "0x00"){
opt.value = balance[i].tokenid;
opt.innerHTML = balance[i].token;
}else{
opt.value = balance[i].tokenid;
opt.innerHTML = balance[i].token.name;
}
select2.appendChild(opt);
}
});
}
</script>
</body>
</html>