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
+17 -2
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,15 +329,29 @@ blockchainExplorer = function(){
function _initBlockSelector()
{
if (_known_blocks == null)
{
$.getJSON('data/getKnownBlocksList.php', function( data ) {
// Init the selector
var select = $('#blockSelector');
_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) {
select.append(new Option('LAST', 'LAST'));
$.each(_known_blocks, function (key, bloc) {
select.append(new Option(bloc.name, bloc.name));
});
}
return true;
});
}
}
function _init(mode, infos)
@@ -461,6 +475,7 @@ blockchainExplorer = function(){
getblocHashFromName: _getblocHashFromName,
initOneBlock : _initOneBlock,
initBlockSelector : _initBlockSelector,
toggleInfos: _toggleInfos,
getLength: _getLength,
+5 -8
View File
@@ -48,27 +48,24 @@
}
});
showInfos();
blockchainExplorer.initBlockSelector();
selectBlock();
});
function showInfos()
{
lastScroll = 0;
blockchainExplorer.init(0, false);
selectBlock();
}
function toggleInfos()
{
blockchainExplorer.toggleInfos();
c.toggleInfos();
}
function selectBlock()
{
lastScroll = 0;
if ($('#blockSelector').val() == 'FULL')
blockchainExplorer.init(0, false);
else
blockchainExplorer.initOneBlock($('#blockSelector').val());
}
</script>
@@ -105,7 +102,7 @@
<div class="col-sm-12 text-right">
<br>
<select id="blockSelector" onchange="selectBlock()">
<option value='FULL'>Full Blockchain</option>
<option value='LAST'>LAST</option>
</select>
<br>
<label>show block infos&nbsp;</label><input id="mode_checkbox" type="checkbox" onchange="toggleInfos()">