-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
537 lines (458 loc) · 16.2 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
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
<link rel="shortcut icon" href="../favicon.ico">
<link rel="icon" type="image/icon" href="../favicon.ico" >
<title>inbestcoin [INC] - Block Explorer</title>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-timeago/1.4.0/jquery.timeago.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-sparklines/2.1.2/jquery.sparkline.min.js"></script>
<link href="css/themes/white/style.css" rel="stylesheet" id="theme_link">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<link href="//fonts.googleapis.com/css?family=Inconsolata" rel="stylesheet" type="text/css">
<script src="config.js"></script>
</head>
<body>
<script>
var blockchainExplorer = "/?hash={id}#blockchain_block";
var transactionExplorer = "/?hash={id}#blockchain_transaction";
var paymentIdExplorer = "/?hash={id}#blockchain_payment_id";
var style_cookie_name = "style";
var style_cookie_duration = 365;
var style_domain = window.location.hostname;
$(function(){
$('.theme-switch[rel="/css/themes/white/style.css"]').hide();
set_style_from_cookie();
$('.theme-switch').click(function() {
swapStyleSheet($(this).attr('rel'));
$('.theme-switch').show();
$(this).hide();
return false;
});
function swapStyleSheet(sheet){
$('#theme_link').attr('href',sheet);
$('.theme-switch').show();
$('.theme-switch[rel="'+sheet+'"]').hide();
set_cookie(style_cookie_name, sheet, style_cookie_duration, style_domain);
}
function set_style_from_cookie(){
var style = get_cookie(style_cookie_name);
if (style.length){
swapStyleSheet(style);
}
}
function set_cookie (cookie_name, cookie_value, lifespan_in_days, valid_domain){
var domain_string = valid_domain ?
("; domain=" + valid_domain) : '';
document.cookie = cookie_name +
"=" + encodeURIComponent(cookie_value) +
"; max-age=" + 60 * 60 *
24 * lifespan_in_days +
"; path=/" + domain_string;
}
function get_cookie (cookie_name){
var cookie_string = document.cookie;
if (cookie_string.length != 0){
var cookie_value = cookie_string.match(
'(^|;)[\s]*' +
cookie_name +
'=([^;]*)' );
if(cookie_value != null && cookie_value.length>0) {
return decodeURIComponent (cookie_value[2]);
}
}
return '';
}
});
function getTransactionUrl(id) {
return transactionExplorer.replace('{symbol}', symbol.toLowerCase()).replace('{id}', id);
}
$.fn.update = function(txt){
var el = this[0];
if (el.textContent !== txt)
el.textContent = txt;
return this;
};
function updateTextClasses(className, text){
var els = document.getElementsByClassName(className);
for (var i = 0; i < els.length; i++){
var el = els[i];
if (el.textContent !== text)
el.textContent = text;
}
}
function updateText(elementId, text){
var el = document.getElementById(elementId);
if (el.textContent !== text){
el.textContent = text;
}
return el;
}
function updateTextLinkable(elementId, text){
var el = document.getElementById(elementId);
if (el.innerHTML !== text){
el.innerHTML = text;
}
return el;
}
var currentPage;
var lastStats;
function getReadableHashRateString(hashrate){
var i = 0;
var byteUnits = [' H', ' kH', ' MH', ' GH', ' TH', ' PH', ' EH', ' ZH', ' YH' ];
while (hashrate > 1000){
hashrate = hashrate / 1000;
i++;
}
return hashrate.toFixed(2) + byteUnits[i];
}
function getReadableDifficultyString(difficulty, precision){
if (isNaN(parseFloat(difficulty)) || !isFinite(difficulty)) return 0;
if (typeof precision === 'undefined') precision = 0;
var units = ['', 'k', 'M', 'G', 'T', 'P'],
number = Math.floor(Math.log(difficulty) / Math.log(1000));
if (units[number] === undefined || units[number] === null) {
return 0
}
return (difficulty / Math.pow(1000, Math.floor(number))).toFixed(precision) + ' ' + units[number];
}
function formatBlockLink(hash){
return '<a href="' + getBlockchainUrl(hash) + '">' + hash + '</a>';
}
function getReadableCoins(coins, digits, withoutSymbol){
var amount = (parseInt(coins || 0) / coinUnits).toFixed(digits || coinUnits.toString().length - 1);
return amount + (withoutSymbol ? '' : (' ' + symbol));
}
function formatDate(time){
if (!time) return '';
return new Date(parseInt(time) * 1000).toLocaleString();
}
function formatPaymentLink(hash){
return '<a href="' + getTransactionUrl(hash) + '">' + hash + '</a>';
}
function pulseLiveUpdate(){
var stats_update = document.getElementById('stats_updated');
stats_update.style.transition = 'opacity 100ms ease-out';
stats_update.style.opacity = 1;
setTimeout(function(){
stats_update.style.transition = 'opacity 7000ms linear';
stats_update.style.opacity = 0;
}, 500);
}
window.onhashchange = function(){
routePage();
};
function fetchLiveStats() {
$.ajax({
url: api + '/getinfo',
dataType: 'json',
type: 'GET',
cache: 'false'
}).done(function(data){
pulseLiveUpdate();
lastStats = data;
currentPage.update();
}).always(function () {
setTimeout(function() {
fetchLiveStats();
}, refreshDelay);
});
}
function floatToString(float) {
return float.toFixed(6).replace(/[0\.]+$/, '');
}
var xhrPageLoading;
function routePage(loadedCallback) {
if (currentPage) currentPage.destroy();
$('#page').html('');
$('#loading').show();
if (xhrPageLoading)
xhrPageLoading.abort();
$('.hot_link').parent().removeClass('active');
var $link = $('a.hot_link[href="' + (window.location.hash || '#') + '"]');
$link.parent().addClass('active');
var page = $link.data('page');
xhrPageLoading = $.ajax({
url: 'pages/' + page,
cache: false,
success: function (data) {
$('#loading').hide();
$('#page').show().html(data);
currentPage.init();
currentPage.update();
if (loadedCallback) loadedCallback();
}
});
}
function getBlockchainUrl(id) {
return blockchainExplorer.replace('{id}', id);
}
$(function(){
$.ajax({
url: api + '/getinfo',
dataType: 'json',
success: function(data){
lastStats = data;
routePage(fetchLiveStats);
}});
});
// Blockexplorer functions
urlParam = function(name){
var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
if (results==null){
return null;
}
else{
return results[1] || 0;
}
}
$(function() {
$('[data-toggle="tooltip"]').tooltip();
});
function hex2a(hexx) {
var hex = hexx.toString();//force conversion
var str = '';
for (var i = 0; i < hex.length; i += 2)
str += String.fromCharCode(parseInt(hex.substr(i, 2), 16));
return str;
}
</script>
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Menu</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand " href="/"><img style="height: 1.5em; display: inline;" src="/img/inbestcoin.png" alt="inbestcoin Icon"> <strong>inbestcoin</strong></a>
<div id="stats_updated"><i class="fa fa-bolt"></i></div>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-left explorer_menu">
<li><a class="hot_link" data-page="home.html" href="#">
<i class="fa fa-cubes" aria-hidden="true"></i> Block Explorer
</a></li>
<li><a class="hot_link" data-page="pools.html" href="#pools">
<i class="fa fa-gavel" aria-hidden="true"></i> Pools
</a></li>
<li><a class="hot_link" data-page="api.html" href="#api">
<i class="fa fa-code" aria-hidden="true"></i> API
</a></li>
<button rel="/css/themes/dark/style.css" class="btn btn-default theme-switch" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="Switch to Night Mode"><i class="fa fa-moon-o"></i></button>
<button rel="/css/themes/white/style.css" class="btn btn-default theme-switch" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="Switch to Day Mode"><i class="fa fa-sun-o"></i></button>
<!-- //-->
<li style="display:none;"><a class="hot_link" data-page="blockchain_block.html" href="#blockchain_block"><i class="fa fa-cubes"></i> Block
</a></li>
<li style="display:none;"><a class="hot_link" data-page="blockchain_transaction.html" href="#blockchain_transaction"><i class="fa fa-cubes"></i> Transaction
</a></li>
<li style="display:none;"><a class="hot_link" data-page="blockchain_payment_id.html" href="#blockchain_payment_id"><i class="fa fa-cubes"></i> Transactions by Payment ID
</a></li>
<li><a style="display:none;" class="hot_link" data-page="support.html" href="#support">
<i class="fa fa-comments"></i> Help
</a></li>
<!-- //-->
</ul>
<div class="nav col-md-6 navbar-right explorer-search">
<div class="input-group">
<input class="form-control" placeholder="Search by block height / hash, transaction hash, payment id" id="txt_search">
<span class="input-group-btn"><button class="btn btn-default" type="button" id="btn_search">
<span><i class="fa fa-search"></i> Search</span>
</button></span>
</div>
</div>
</div>
</div>
</div>
<script>
$('#btn_search').click(function(e) {
var text = document.getElementById('txt_search').value;
function GetSearchBlockbyHeight(){
var block, xhrGetSearchBlockbyHeight;
if (xhrGetSearchBlockbyHeight) xhrGetSearchBlockbyHeight.abort();
xhrGetSearchBlockbyHeight = $.ajax({
url: api + '/json_rpc',
method: "POST",
data: JSON.stringify({
jsonrpc:"2.0",
id: "blockbyheight",
method:"getblockheaderbyheight",
params: {
height: parseInt(text)
}
}),
dataType: 'json',
cache: 'false',
success: function(data){
if(data.result){
block = data.result.block_header;
window.location.href = getBlockchainUrl(block.hash);
} else if(data.error) {
wrongSearchAlert();
}
}
});
}
function GetSearchBlock(){
var block, xhrGetSearchBlock;
if (xhrGetSearchBlock) xhrGetSearchBlock.abort();
xhrGetSearchBlock = $.ajax({
url: api + '/json_rpc',
method: "POST",
data: JSON.stringify({
jsonrpc:"2.0",
id: "GetSearchBlock",
method:"f_block_json",
params: {
hash: text
}
}),
dataType: 'json',
cache: 'false',
success: function(data){
if(data.result){
block = data.result.block;
sessionStorage.setItem('searchBlock', JSON.stringify(block));
window.location.href = getBlockchainUrl(block.hash);
} else if(data.error) {
$.ajax({
url: api + '/json_rpc',
method: "POST",
data: JSON.stringify({
jsonrpc:"2.0",
id: "test",
method:"f_transaction_json",
params: {
hash: text
}
}),
dataType: 'json',
cache: 'false',
success: function(data){
if(data.result){
sessionStorage.setItem('searchTransaction', JSON.stringify(data.result));
window.location.href = transactionExplorer.replace('{id}', text);
} else if(data.error) {
xhrGetTsx = $.ajax({
url: api + '/json_rpc',
method: "POST",
data: JSON.stringify({
jsonrpc:"2.0",
id: "test",
method:"k_transactions_by_payment_id",
params: {
payment_id: text
}
}),
dataType: 'json',
cache: 'false',
success: function(data){
if(data.result){
txsByPaymentId = data.result.transactions;
sessionStorage.setItem('txsByPaymentId', JSON.stringify(txsByPaymentId));
window.location.href = paymentIdExplorer.replace('{id}', text);
} else if(data.error) {
$('#page').after(
'<div class="alert alert-warning alert-dismissable fade in" style="position: fixed; right: 50px; top: 50px;">'+
'<button type="button" class="close" ' +
'data-dismiss="alert" aria-hidden="true">' +
'×' +
'</button>' +
'We could not find anything.' +
'</div>');
}
}
});
}
}
});
}
}
});
}
if ( text.length < 64 ) {
GetSearchBlockbyHeight();
} else if ( text.length == 64 ) {
GetSearchBlock();
} else {
wrongSearchAlert();
}
e.preventDefault();
});
function wrongSearchAlert() {
$('#page').after(
'<div class="alert alert-danger alert-dismissable fade in" style="position: fixed; right: 50px; top: 50px;">'+
'<button type="button" class="close" ' +
'data-dismiss="alert" aria-hidden="true">' +
'×' +
'</button>' +
'<strong>Wrong search query!</strong><br /> Please enter block height or hash, transaction hash, or payment id.' +
'</div>');
}
$('#txt_search').keyup(function(e){
if(e.keyCode === 13)
$('#btn_search').click();
});
</script>
<div id="content">
<div class="container">
<div id="page"></div>
<p id="loading" class="text-center"><i class="fa fa-circle-o-notch fa-spin"></i></p>
</div>
</div>
<footer>
<div class="container">
<div class="row">
<div class="col-lg-4 col-md-4 col-sm-6">
<p>
<small>
© 2018 <strong>inbestcoin</strong>.
</small>
</p>
</div>
<div class="col-lg-4 col-md-4 col-sm-6">
<p>
<small>
<!-- This copyright should be left intact -->
Powered by <a target="_blank" href="https://github.com/inbestcoin/inbestcoin-explorer"><i class="fa fa-github"></i> inbestcoin explorer</a>
v. 1.0<br />
<span class="text-muted">Partially based on <strong>Karbovanets/Karbowanec-Blockchain-Explorer</strong>
</small>
</p>
</div>
<div class="col-lg-4 col-md-4 col-sm-6">
<ul>
<li><a href="https://cloud.inbest.cloud">cloud.inbest.cloud</li>
</ul>
</div>
</div>
</div>
</footer>
<a href="#" class="scrollup"><i class="fa fa-chevron-circle-up"></i></a>
<script type="text/javascript">
jQuery(function($) { $(document).ready(function() {
$(window).scroll(function(){
if ($(this).scrollTop() > 500) {
$('.scrollup').fadeIn();
} else {
$('.scrollup').fadeOut();
}
});
$('.scrollup').click(function(){
$("html, body").animate({ scrollTop: 0 }, 600);
return false;
});
$('.scrollup').css('opacity','0.3');
$('.scrollup').hover(function(){
$(this).stop().animate({opacity: 0.9}, 400);
}, function(){
$(this).stop().animate({opacity: 0.3}, 400);
});
});});
</script>
</body>
</html>