|
|
|
@ -19,9 +19,10 @@ blockchainExplorer = function(){ |
|
|
|
function _getblockNameFromHash(hash)
|
|
|
|
{
|
|
|
|
var retour = '';
|
|
|
|
liste_blocks.forEach(function(item){
|
|
|
|
if (hash == item.hash) retour = item.name;
|
|
|
|
});
|
|
|
|
if (liste_blocks != null)
|
|
|
|
liste_blocks.forEach(function(item){
|
|
|
|
if (hash == item.hash) retour = item.name;
|
|
|
|
});
|
|
|
|
return retour;
|
|
|
|
}
|
|
|
|
|
|
|
|
@ -209,6 +210,25 @@ blockchainExplorer = function(){ |
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
function _ajouterTopBlock(data)
|
|
|
|
{
|
|
|
|
// Bloquer la navigation pendant le calcul
|
|
|
|
if (!flag_nav) return false;
|
|
|
|
flag_nav = false;
|
|
|
|
|
|
|
|
// Ajouter un div
|
|
|
|
_addDivForBlock(data.height);
|
|
|
|
|
|
|
|
// Mettre les infos dans le div
|
|
|
|
_addInfoForBlock(data);
|
|
|
|
|
|
|
|
// Décaler le tableau cur_height par le haut
|
|
|
|
cur_height.unshift(data.height);
|
|
|
|
|
|
|
|
// Maintenir la liste des blocks
|
|
|
|
liste_blocks['BLOCK_'+data.height] = data.hash;
|
|
|
|
}
|
|
|
|
|
|
|
|
function _ajouterPreviousBlock()
|
|
|
|
{
|
|
|
|
// Bloquer la navigation pendant le calcul
|
|
|
|
@ -246,6 +266,11 @@ blockchainExplorer = function(){ |
|
|
|
_gotoBlock('PREVIOUS');
|
|
|
|
else
|
|
|
|
_addDivForVoid();
|
|
|
|
|
|
|
|
// Ajouter le trigger sur les nouveaux blocks
|
|
|
|
if (block_name == 'LAST')
|
|
|
|
blockchainListener.addBlockHook(_ajouterTopBlock);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
return true;
|
|
|
|
@ -289,6 +314,7 @@ blockchainExplorer = function(){ |
|
|
|
|
|
|
|
ajouterPreviousBlock: _ajouterPreviousBlock,
|
|
|
|
getblocHashFromName: _getblocHashFromName,
|
|
|
|
ajouterTopBlock : _ajouterTopBlock,
|
|
|
|
|
|
|
|
init: _init
|
|
|
|
};
|