nft phase 2 b

This commit is contained in:
2021-12-04 20:35:54 +01:00
parent fbf6b4b3e3
commit 04f4bed665
2 changed files with 28 additions and 16 deletions
+22 -7
View File
@@ -2,7 +2,7 @@ blockchainExplorer = function(){
// Init array
var _known_blocks = null;
var _liste_blocks = null;
var _liste_blocks = [];
var _classes = ['bg-grey-even','bg-grey-odd'];
var _cur_class = 0;
var _cur_methode = 'hasard';
@@ -329,13 +329,27 @@ blockchainExplorer = function(){
function _initBlockSelector()
{
// Init the selector
var select = $('#blockSelector');
if (_known_blocks == null)
{
$.getJSON('data/getKnownBlocksList.php', function( data ) {
// Init the selector
var select = $('#blockSelector');
if (select !== null) {
select.append(new Option('LAST', 'LAST'));
$.each(_known_blocks, function (key, bloc) {
select.append(new Option(bloc.name, bloc.name));
_known_blocks = data;
_known_blocks.sort(function(a,b){
// sort desc ...
if (parseInt(a.height) < parseInt(b.height)) return 1;
if (parseInt(a.height) > parseInt(b.height)) return -1;
return 0;
});
if (select !== null) {
$.each(_known_blocks, function (key, bloc) {
select.append(new Option(bloc.name, bloc.name));
});
}
return true;
});
}
}
@@ -461,6 +475,7 @@ blockchainExplorer = function(){
getblocHashFromName: _getblocHashFromName,
initOneBlock : _initOneBlock,
initBlockSelector : _initBlockSelector,
toggleInfos: _toggleInfos,
getLength: _getLength,