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