nft phase 2
This commit is contained in:
+93
-9
@@ -64,7 +64,7 @@ blockchainExplorer = function(){
|
||||
return ladateStr;
|
||||
}
|
||||
|
||||
function _addInfoForBlock(block)
|
||||
function _addInfoForBlock(block, p_div_label)
|
||||
{
|
||||
var contenu = '';
|
||||
var downloadingImage = new Image();
|
||||
@@ -77,15 +77,19 @@ blockchainExplorer = function(){
|
||||
blockName = _getblockNameFromHash(block.hash);
|
||||
if (block.hash == _liste_blocks['TOP']) {
|
||||
blockName = 'LAST BLOCK';
|
||||
if (_mode == 1) div_label = 'LAST';
|
||||
if (_mode == 1)
|
||||
div_label = 'LAST';
|
||||
}
|
||||
if (blockName == '') blockName = 'block';
|
||||
else blockName = '<b>'+blockName+'</b>';
|
||||
|
||||
if (p_div_label != null)
|
||||
div_label = p_div_label;
|
||||
|
||||
visibility='hidden';
|
||||
if (_infos) visibility='visible';
|
||||
|
||||
contenu += '<div id="img_'+block.height+'" style="color:black;height:220px">';
|
||||
contenu += '<div id="img_'+div_label+'" style="color:black;height:220px">';
|
||||
contenu += ' <table class="block_infos" width="100%" align="center" height="220px" style="margin-top:3px;visibility:'+visibility+';background:rgba(255,255,255,0.7)">';
|
||||
contenu += ' <tr><td>'+blockName+'</td><td align="right"><b>'+block.height+'</b></td></tr>';
|
||||
contenu += ' <tr><td>timestamp </td><td align="right"><b>'+_formatDate(block.time)+'</b></td></tr>';
|
||||
@@ -102,7 +106,7 @@ blockchainExplorer = function(){
|
||||
$('#info_'+div_label).html(contenu);
|
||||
|
||||
downloadingImage.onload = function(){
|
||||
var div0 = document.getElementById('img_'+block.height);
|
||||
var div0 = document.getElementById('img_'+div_label);
|
||||
div0.style.backgroundImage = "url(" + this.src + ")";
|
||||
div0.style.backgroundRepeat = "no-repeat";
|
||||
div0.style.backgroundPosition = "center";
|
||||
@@ -292,7 +296,6 @@ blockchainExplorer = function(){
|
||||
_liste_blocks = [];
|
||||
_liste_blocks['LENGTH'] = 0;
|
||||
|
||||
$(document).scrollTop( $("#explorer").offset().top );
|
||||
$('#blockchain').html('');
|
||||
|
||||
if (block_name != 'LAST') block_hash_url += '?block_hash='+_getblocHashFromName(block_name);
|
||||
@@ -328,10 +331,13 @@ blockchainExplorer = function(){
|
||||
{
|
||||
// Init the selector
|
||||
var select = $('#blockSelector');
|
||||
|
||||
$.each(_liste_blocks, function (key, bloc) {
|
||||
select.append(new Option(bloc.name, bloc.name));
|
||||
});
|
||||
|
||||
if (select !== null) {
|
||||
select.append(new Option('LAST', 'LAST'));
|
||||
$.each(_known_blocks, function (key, bloc) {
|
||||
select.append(new Option(bloc.name, bloc.name));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function _init(mode, infos)
|
||||
@@ -350,6 +356,7 @@ blockchainExplorer = function(){
|
||||
if (parseInt(a.height) > parseInt(b.height)) return -1;
|
||||
return 0;
|
||||
});
|
||||
_initBlockSelector();
|
||||
return true;
|
||||
});
|
||||
}
|
||||
@@ -372,12 +379,89 @@ blockchainExplorer = function(){
|
||||
return _liste_blocks['LENGTH'];
|
||||
}
|
||||
|
||||
function _initOneBlock(block_name)
|
||||
{
|
||||
var block_hash_url = 'data/getBlockInfo.php';
|
||||
|
||||
$('#blockchain').html('');
|
||||
|
||||
if (block_name != 'LAST') block_hash_url += '?block_hash='+_getblocHashFromName(block_name);
|
||||
|
||||
$.getJSON(block_hash_url, function( data ) {
|
||||
allMethod = [
|
||||
'circle',
|
||||
'circle_line',
|
||||
'circles',
|
||||
'circle_spline',
|
||||
'circles_spline',
|
||||
'line',
|
||||
'linegradient',
|
||||
'linehashed',
|
||||
'linehashedtx',
|
||||
'mondrian',
|
||||
'peigne',
|
||||
'peignealpha',
|
||||
'spirale',
|
||||
'splinelineblack',
|
||||
'splinelineblackalpha',
|
||||
'splinelinegradient',
|
||||
'splinelinegradientalpha',
|
||||
'treemap2',
|
||||
'tylerhobbs',
|
||||
'veraMolnar'
|
||||
];
|
||||
|
||||
for(i=0;i<allMethod.length;i++)
|
||||
{
|
||||
_cur_methode = allMethod[i];
|
||||
|
||||
_addDivForBlock(_cur_methode);
|
||||
|
||||
_addInfoForBlock(data, _cur_methode);
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function _showBlockAllMethod(blockname)
|
||||
{
|
||||
allMethod = [
|
||||
'circle',
|
||||
'circle_line',
|
||||
'circles',
|
||||
'circle_spline',
|
||||
'circles_spline',
|
||||
'line',
|
||||
'linegradient',
|
||||
'linehashed',
|
||||
'linehashedtx',
|
||||
'mondrian',
|
||||
'peigne',
|
||||
'peignealpha',
|
||||
'spirale',
|
||||
'splinelineblack',
|
||||
'splinelineblackalpha',
|
||||
'splinelinegradient',
|
||||
'splinelinegradientalpha',
|
||||
'treemap2',
|
||||
'tylerhobbs',
|
||||
'veraMolnar'
|
||||
];
|
||||
|
||||
block_hash = _getblocHashFromName(blockname);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
addTopBlock: _addTopBlock,
|
||||
addBottomBlock: _addBottomBlock,
|
||||
getblocHashFromName: _getblocHashFromName,
|
||||
|
||||
initOneBlock : _initOneBlock,
|
||||
|
||||
toggleInfos: _toggleInfos,
|
||||
getLength: _getLength,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user