réactiver le refesh du top block
This commit is contained in:
+21
-6
@@ -75,8 +75,11 @@ blockchainExplorer = function(){
|
||||
_flag_nav = false;
|
||||
|
||||
blockName = _getblockNameFromHash(block.hash);
|
||||
if (block.hash == _liste_blocks['TOP']) blockName = 'LAST BLOCK';
|
||||
if (blockName == '') blockName = 'height';
|
||||
if (block.hash == _liste_blocks['TOP']) {
|
||||
blockName = 'LAST BLOCK';
|
||||
if (_mode == 1) div_label = 'LAST';
|
||||
}
|
||||
if (blockName == '') blockName = 'block';
|
||||
else blockName = '<b>'+blockName+'</b>';
|
||||
|
||||
visibility='hidden';
|
||||
@@ -210,20 +213,28 @@ blockchainExplorer = function(){
|
||||
|
||||
function _addTopBlock(data, flag = false)
|
||||
{
|
||||
var old_hash = _liste_blocks['TOP'];
|
||||
|
||||
if (old_hash == data.hash) return false;
|
||||
|
||||
if (flag) return "ajouterTopBlock";
|
||||
|
||||
// Maintenir la liste des blocks
|
||||
_liste_blocks['TOP'] = data.hash;
|
||||
_liste_blocks['BLOCK_'+data.height] = data.hash;
|
||||
|
||||
// Ajouter un div
|
||||
if (_mode < 2) _addDivForBlock(data.height,true);
|
||||
// Rafraîchir l'ancien block TOP
|
||||
if (_mode == 0) {
|
||||
$.getJSON('data/getBlockInfo.php?block_hash='+old_hash, function( old ) {
|
||||
_addInfoForBlock(old);
|
||||
});
|
||||
_addDivForBlock(data.height,true);
|
||||
}
|
||||
|
||||
// Mettre les infos dans le div
|
||||
_addInfoForBlock(data);
|
||||
|
||||
topistoConsole.log('Last Block on top : '+data.hash);
|
||||
|
||||
}
|
||||
|
||||
function _maintenirListe(data){
|
||||
@@ -289,6 +300,10 @@ blockchainExplorer = function(){
|
||||
$.getJSON(block_hash_url, function( data ) {
|
||||
|
||||
div_label = data.height;
|
||||
if (_mode == 1)
|
||||
if (block_name == 'LAST')
|
||||
div_label = 'LAST';
|
||||
|
||||
_liste_blocks['TOP'] = data.hash;
|
||||
|
||||
_addDivForBlock(div_label);
|
||||
@@ -298,7 +313,7 @@ blockchainExplorer = function(){
|
||||
_maintenirListe(data);
|
||||
|
||||
// Cela fout le boxon pour l'instant
|
||||
// blockchainListener.addBlockHook(_addTopBlock);
|
||||
blockchainListener.addBlockHook(_addTopBlock);
|
||||
});
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user