temporaire

This commit is contained in:
2021-11-11 11:51:43 +01:00
parent d0c998146d
commit 62f3ac48bb
2 changed files with 46 additions and 40 deletions
+33 -36
View File
@@ -8,6 +8,7 @@ blockchainExplorer = function(){
var _cur_methode = 'hasard';
var _mode = 1;
var _infos = false;
var _flag_nav = true;
function _precisionRound(number) {
var precision = 4;
@@ -71,6 +72,8 @@ blockchainExplorer = function(){
_cur_class = 1 - _cur_class;
_flag_nav = false;
blockName = _getblockNameFromHash(block.hash);
// if (blockName != '') blockName = ' ( '+blockName+' )';
@@ -113,7 +116,7 @@ blockchainExplorer = function(){
div0.style.backgroundRepeat = "no-repeat";
div0.style.backgroundPosition = "center";
div0.style.backgroundSize = "auto 100%";
flag_nav = true;
_flag_nav = true;
};
downloadingImage.src = 'images/block_image.php?methode='+_cur_methode+'&hash='+block.hash;
@@ -236,6 +239,28 @@ blockchainExplorer = function(){
}
function _maintenirListe(data){
_liste_blocks['BLOCK_'+data.height] = data.hash;
_liste_blocks['LENGTH'] += 1;
// Récursivité pour précharger par paquets
// Tant qu'on n'est pas sur le GENESIS
if (data.height > 0)
switch(_mode)
{
case 0:
case 1:
// Récursivité pour précharger par paquets
_liste_blocks['BOTTOM'] = data.prev;
break;
case 2:
case 3:
_liste_blocks['BOTTOM'] = _known_blocks[_liste_blocks['LENGTH']-1].hash;
break;
}
}
function _addBottomBlock()
{
// Mettre les infos du block
@@ -248,23 +273,8 @@ blockchainExplorer = function(){
// Mettre les infos dans le div
_addInfoForBlock(data);
_liste_blocks['BLOCK_'+data.height] = data.hash;
_liste_blocks['LENGTH'] += 1;
switch(_mode)
{
case 0:
case 1:
// Récursivité pour précharger par paquets
if (data.height > 0)
_liste_blocks['BOTTOM'] = data.prev;
break;
case 2:
case 3:
if (data.height > 0)
_liste_blocks['BOTTOM'] = _known_blocks[_liste_blocks['LENGTH']-1].hash;
break;
}
// Maintenir la Liste
_maintenirListe(data);
if (_liste_blocks['LENGTH'] % 10) _addBottomBlock();
@@ -284,29 +294,16 @@ blockchainExplorer = function(){
if (block_name != 'LAST') block_hash = '?block_hash='+_getblocHashFromName(block_name);
$.getJSON('data/getBlockInfo.php'+block_hash, function( data ) {
_liste_blocks['TOP'] = data.hash;
_liste_blocks['BLOCK_'+data.height] = data.hash;
_liste_blocks['LENGTH'] += 1;
div_label = data.height;
switch(_mode)
{
case 0:
case 1:
// Récursivité pour précharger par paquets
_liste_blocks['BOTTOM'] = data.prev;
break;
case 2:
case 3:
div_label = 'LAST';
_liste_blocks['BOTTOM'] = _known_blocks[0].hash;
break;
}
_liste_blocks['TOP'] = data.hash;
_maintenirListe(data);
_addDivForBlock(div_label);
_addInfoForBlock(data);
blockchainListener.addBlockHook(_addTopBlock);
// Cela fout le boxon pour l'instant
// blockchainListener.addBlockHook(_addTopBlock);
_addBottomBlock();
});