Compare commits
3 Commits
1d90cd185a
...
537c61e8a3
| Author | SHA1 | Date | |
|---|---|---|---|
| 537c61e8a3 | |||
| f28d91237b | |||
| 24bbee0109 |
@@ -32,5 +32,5 @@ function init_2018025(leblock)
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
last_block_hooks.push(init_2018025);
|
||||
blockchainListener.addBlockHook(init_2018025);
|
||||
});
|
||||
|
||||
2
blog.php
2
blog.php
@@ -88,7 +88,7 @@ echo $liste;
|
||||
<p>Contact me</p>
|
||||
<p><span class="glyphicon glyphicon-map-marker"></span> Shambala</p>
|
||||
<p><span class="glyphicon glyphicon-globe"></span> Employer : Mutiny</p>
|
||||
<p><span class="glyphicon glyphicon-phone"></span> +00 666 666 666</p>
|
||||
<p><span class="glyphicon glyphicon-phone"></span> +33 4 8 15 16 23 42</p>
|
||||
<p>
|
||||
<span class="glyphicon glyphicon-envelope"></span>
|
||||
<!--Place the code below where you want the link to be displayed-->
|
||||
|
||||
@@ -24,7 +24,7 @@ $block_hash = blockchain::getLastCacheBlockHash();
|
||||
// ---
|
||||
// --- Le cas échéant, on cherche block passé en argument
|
||||
// ---
|
||||
if (isset($_REQUEST['block_hash'])) $block_hash = $_REQUEST['block_hash'];
|
||||
if (isset($_REQUEST['block_hash'])) $block_hash = $_REQUEST['block_hash'];
|
||||
|
||||
$the_block = blockchain::getBlockWithHash($block_hash);
|
||||
if ($the_block === FALSE) die();
|
||||
|
||||
@@ -140,7 +140,7 @@
|
||||
<p>Contact me</p>
|
||||
<p><span class="glyphicon glyphicon-map-marker"></span> Shambala</p>
|
||||
<p><span class="glyphicon glyphicon-globe"></span> Employer : Mutiny</p>
|
||||
<p><span class="glyphicon glyphicon-phone"></span> +00 666 666 666</p>
|
||||
<p><span class="glyphicon glyphicon-phone"></span> +33 4 8 15 16 23 42</p>
|
||||
<p>
|
||||
<span class="glyphicon glyphicon-envelope"></span>
|
||||
<!--Place the code below where you want the link to be displayed-->
|
||||
|
||||
@@ -198,7 +198,7 @@
|
||||
<p>Contact me</p>
|
||||
<p><span class="glyphicon glyphicon-map-marker"></span> Shambala</p>
|
||||
<p><span class="glyphicon glyphicon-globe"></span> Employer : Mutiny</p>
|
||||
<p><span class="glyphicon glyphicon-phone"></span> +00 666 666 666</p>
|
||||
<p><span class="glyphicon glyphicon-phone"></span> +33 4 8 15 16 23 42</p>
|
||||
<p>
|
||||
<span class="glyphicon glyphicon-envelope"></span>
|
||||
<!--Place the code below where you want the link to be displayed-->
|
||||
|
||||
10
index.php
10
index.php
@@ -113,7 +113,7 @@
|
||||
$('#img_explorer').attr('src', 'images/loading.gif');
|
||||
block_name = $('#blockSelector').val();
|
||||
block_url = 'data/getBlockInfo.php';
|
||||
if (block_name != 'LAST') block_url += '?block_hash='+liste_blocks[block_name];
|
||||
if (block_name != 'LAST') block_url += '?block_hash='+getblocHashFromName(block_name);
|
||||
$.getJSON(block_url, function( data ) {
|
||||
changeExploreBlockDrawing(data);
|
||||
});
|
||||
@@ -127,7 +127,7 @@
|
||||
downloadingImage.src = 'images/block_image.php?methode=hasard&hash='+le_block.hash;
|
||||
}
|
||||
$(document).ready(function(){
|
||||
last_block_hooks.push(changeExploreBlockDrawing);
|
||||
blockchainListener.addBlockHook(changeExploreBlockDrawing);
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -139,12 +139,12 @@
|
||||
<div class="container-fluid bg-grey" style="padding-top:0px;padding-bottom:10px">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<br><img id="img_explorer" src="images/block_image.php" width="100%; height: auto">
|
||||
<br><img id="img_explorer" src="images/loading.gif" width="100%; height: auto">
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
<br>
|
||||
<h2>Explore the Bitcoin's Blockchain</h2>
|
||||
<h4>This is a drawing of the <select id="blockSelector" onchange="javascript:changeExploreBlock()"><option value="LAST">LAST</option></select> block of the Bitcoin's Blockchain.</h4>
|
||||
<h4>This is a drawing of the <select id="blockSelector" onchange="javascript:changeExploreBlock()"><option selected value="LAST">LAST</option></select> block of the Bitcoin's Blockchain.</h4>
|
||||
<a href="explorer.php">Click here to see the other blocks</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -195,7 +195,7 @@ echo $liste;
|
||||
<p>Contact me</p>
|
||||
<p><span class="glyphicon glyphicon-map-marker"></span> Shambala</p>
|
||||
<p><span class="glyphicon glyphicon-globe"></span> Employer : Mutiny</p>
|
||||
<p><span class="glyphicon glyphicon-phone"></span> +00 666 666 666</p>
|
||||
<p><span class="glyphicon glyphicon-phone"></span> +33 4 8 15 16 23 42</p>
|
||||
<p>
|
||||
<span class="glyphicon glyphicon-envelope"></span>
|
||||
<!--Place the code below where you want the link to be displayed-->
|
||||
|
||||
@@ -1,40 +1,86 @@
|
||||
// Init array
|
||||
var known_blocks = [
|
||||
'WHALE201810',
|
||||
'BLOCK21E800',
|
||||
'HURRICANE_1',
|
||||
'SEGWIT',
|
||||
'SEGWIT_LOCK',
|
||||
'BCC',
|
||||
'BIP_91_LOCK',
|
||||
'HALVING_2',
|
||||
'WHALE201311',
|
||||
'HALVING_1',
|
||||
'PIZZA',
|
||||
'TOPISTO',
|
||||
'LEET',
|
||||
'LUCIFER',
|
||||
'THE_ANSWER',
|
||||
'GENESIS'
|
||||
var liste_blocks = [
|
||||
{
|
||||
name : 'WHALE201810',
|
||||
hash : '0000000000000000000f9f2dadfb8f312572183272802cbfcc4ff95b4ee6777d',
|
||||
height : 545911
|
||||
},
|
||||
{
|
||||
name : 'BLOCK21E800',
|
||||
hash : '00000000000000000021e800c1e8df51b22c1588e5a624bea17e9faa34b2dc4a',
|
||||
height : 528249
|
||||
},
|
||||
{
|
||||
name : 'HURRICANE_1',
|
||||
hash : '0000000000000000000fe6d521a187a5523d5cef6f6c178923ff82ffe5a0f372',
|
||||
height : 506734
|
||||
},
|
||||
{
|
||||
name : 'SEGWIT',
|
||||
hash : '000000000000000000cbeff0b533f8e1189cf09dfbebf57a8ebe349362811b80',
|
||||
height : 481823
|
||||
},
|
||||
{
|
||||
name : 'SEGWIT_LOCK',
|
||||
hash : '0000000000000000012e6060980c6475a9a8e62a1bf44b76c5d51f707d54522c',
|
||||
height : 479808
|
||||
},
|
||||
{
|
||||
name : 'BCC',
|
||||
hash : '00000000000000000019f112ec0a9982926f1258cdcc558dd7c3b7e5dc7fa148',
|
||||
height : 478559
|
||||
},
|
||||
{
|
||||
name : 'BIP_91_LOCK',
|
||||
hash : '0000000000000000015411ca4b35f7b48ecab015b14de5627b647e262ba0ec40',
|
||||
height : 477120
|
||||
},
|
||||
{
|
||||
name : 'HALVING_2',
|
||||
hash : '000000000000000002cce816c0ab2c5c269cb081896b7dcb34b8422d6b74ffa1',
|
||||
height : 420000
|
||||
},
|
||||
{
|
||||
name : 'WHALE201311',
|
||||
hash : '0000000000000001bc7156dd1183c87859b326affa3a5cdd157e809537f0b284',
|
||||
height : 270953
|
||||
},
|
||||
{
|
||||
name : 'HALVING_1',
|
||||
hash : '000000000000048b95347e83192f69cf0366076336c639f9b7228e9ba171342e',
|
||||
height : 210000
|
||||
},
|
||||
{
|
||||
name : 'PIZZA',
|
||||
hash : '00000000006de085dadb3ec413ef074022fe781121b467e98960280dd246bb00',
|
||||
height : 57035
|
||||
},
|
||||
{
|
||||
name : 'TOPISTO',
|
||||
hash : '000000000a73e64735a2b75c97ea674950a9018da1420d01328a918c9ff9852c',
|
||||
height : 5637
|
||||
},
|
||||
{
|
||||
name : 'LEET',
|
||||
hash : '000000008bf44a528a09d203203a6a97c165cf53a92ecc27aed0b49b86a19564',
|
||||
height : 1337
|
||||
},
|
||||
{
|
||||
name : 'LUCIFER',
|
||||
hash : '00000000fc5b3c76f27f810ee775e480ae7fd604fd196b2d8da4257fcd39f4f9',
|
||||
height : 666
|
||||
},
|
||||
{
|
||||
name : 'THE_ANSWER',
|
||||
hash : '00000000314e90489514c787d615cea50003af2023796ccdd085b6bcc1fa28f5',
|
||||
height : 42
|
||||
},
|
||||
{
|
||||
name : 'GENESIS',
|
||||
hash : '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f',
|
||||
height : 0
|
||||
}
|
||||
];
|
||||
var liste_blocks = {
|
||||
'WHALE201810' : '0000000000000000000f9f2dadfb8f312572183272802cbfcc4ff95b4ee6777d',
|
||||
'BLOCK21E800' : '00000000000000000021e800c1e8df51b22c1588e5a624bea17e9faa34b2dc4a',
|
||||
'HURRICANE_1' : '0000000000000000000fe6d521a187a5523d5cef6f6c178923ff82ffe5a0f372',
|
||||
'SEGWIT' : '000000000000000000cbeff0b533f8e1189cf09dfbebf57a8ebe349362811b80',
|
||||
'SEGWIT_LOCK' : '0000000000000000012e6060980c6475a9a8e62a1bf44b76c5d51f707d54522c',
|
||||
'BCC' : '00000000000000000019f112ec0a9982926f1258cdcc558dd7c3b7e5dc7fa148',
|
||||
'BIP_91_LOCK' : '0000000000000000015411ca4b35f7b48ecab015b14de5627b647e262ba0ec40',
|
||||
'HALVING_2' : '000000000000000002cce816c0ab2c5c269cb081896b7dcb34b8422d6b74ffa1',
|
||||
'WHALE201311' : '0000000000000001bc7156dd1183c87859b326affa3a5cdd157e809537f0b284',
|
||||
'HALVING_1' : '000000000000048b95347e83192f69cf0366076336c639f9b7228e9ba171342e',
|
||||
'PIZZA' : '00000000006de085dadb3ec413ef074022fe781121b467e98960280dd246bb00',
|
||||
'TOPISTO' : '000000000a73e64735a2b75c97ea674950a9018da1420d01328a918c9ff9852c',
|
||||
'LEET' : '000000008bf44a528a09d203203a6a97c165cf53a92ecc27aed0b49b86a19564',
|
||||
'LUCIFER' : '00000000fc5b3c76f27f810ee775e480ae7fd604fd196b2d8da4257fcd39f4f9',
|
||||
'THE_ANSWER' : '00000000314e90489514c787d615cea50003af2023796ccdd085b6bcc1fa28f5',
|
||||
'GENESIS' : '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f'
|
||||
};
|
||||
|
||||
var flag_nav = true;
|
||||
var classes = ['bg-grey-even','bg-grey-odd'];
|
||||
@@ -50,12 +96,20 @@
|
||||
|
||||
function getblockNameFromHash(hash)
|
||||
{
|
||||
sHash = String(hash);
|
||||
known_blocks.forEach(function(item){
|
||||
if (sHash == String(liste_blocks[item]))
|
||||
return item;
|
||||
var retour = '';
|
||||
liste_blocks.forEach(function(item){
|
||||
if (hash == item.hash) retour = item.name;
|
||||
});
|
||||
return '';
|
||||
return retour;
|
||||
}
|
||||
|
||||
function getblocHashFromName(name)
|
||||
{
|
||||
var retour = '';
|
||||
liste_blocks.forEach(function(item){
|
||||
if (name == item.name) retour = item.hash;
|
||||
});
|
||||
return retour;
|
||||
}
|
||||
|
||||
function addInfoForBlock(block)
|
||||
@@ -241,7 +295,7 @@
|
||||
flag_nav = true;
|
||||
|
||||
block_hash = '';
|
||||
if (block_name != 'LAST') block_hash = '?block_hash='+liste_blocks[block_name];
|
||||
if (block_name != 'LAST') block_hash = '?block_hash='+getblocHashFromName(block_name);
|
||||
$.getJSON('data/getBlockInfo.php'+block_hash, function( data ) {
|
||||
addDivForBlock(data.height);
|
||||
addInfoForBlock(data);
|
||||
@@ -265,10 +319,11 @@
|
||||
{
|
||||
// Init the selector
|
||||
var select = $('#blockSelector');
|
||||
if (select.length < 2)
|
||||
if (typeof select.isInitSelector == 'undefined')
|
||||
{
|
||||
$.each(liste_blocks, function (key, text) {
|
||||
select.append(new Option(key, key));
|
||||
select.isInitSelector = true;
|
||||
$.each(liste_blocks, function (key, bloc) {
|
||||
select.append(new Option(bloc.name, bloc.name));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -281,5 +336,5 @@
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
addBlockHook(initBlockExplorer);
|
||||
blockchainListener.addBlockHook(initBlockExplorer);
|
||||
});
|
||||
|
||||
@@ -1,39 +1,49 @@
|
||||
function logBlockHash(leblock)
|
||||
{
|
||||
console.log('Last Block detected : '+leblock.hash);
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
* Ce module permet d'écouter la blockchain
|
||||
*/
|
||||
blockchainListener = function(){
|
||||
|
||||
var last_block = null;
|
||||
var last_block_hooks = [logBlockHash];
|
||||
var last_block_refresh_flag = true;
|
||||
var _last_block = null;
|
||||
var _last_block_hooks = [];
|
||||
|
||||
function getLastBlockInfo()
|
||||
{
|
||||
$.get( "data/getBlockInfo.php", function( data ) {
|
||||
if ((last_block == null)||(last_block.hash != data.hash))
|
||||
{
|
||||
if (last_block_refresh_flag && (last_block != null))
|
||||
last_block_refresh_flag = window.confirm('New block detected, apply change ?');
|
||||
function _logBlockHash(leblock)
|
||||
{
|
||||
console.log('Last Block detected : '+leblock.hash);
|
||||
return true;
|
||||
};
|
||||
|
||||
last_block = data;
|
||||
function _isBlockNew(leblock)
|
||||
{
|
||||
return ((_last_block == null)||(_last_block.hash != leblock.hash));
|
||||
};
|
||||
|
||||
if (last_block_refresh_flag)
|
||||
function _getLastBlockInfo()
|
||||
{
|
||||
$.get( "data/getBlockInfo.php", function( data ) {
|
||||
if (_isBlockNew(data))
|
||||
{
|
||||
last_block_hooks.forEach(function(element) {
|
||||
element(last_block);
|
||||
_last_block = data;
|
||||
_last_block_hooks.forEach(function(element) {
|
||||
element(data);
|
||||
});
|
||||
}
|
||||
}
|
||||
}, "json" );
|
||||
}, "json" );
|
||||
|
||||
setTimeout(getLastBlockInfo, 30000);
|
||||
}
|
||||
setTimeout(_getLastBlockInfo, 30000);
|
||||
};
|
||||
|
||||
function addBlockHook(addBlockHook){
|
||||
last_block_hooks.push(addBlockHook);
|
||||
}
|
||||
function _addBlockHook(addBlockHook){
|
||||
_last_block_hooks.push(addBlockHook);
|
||||
};
|
||||
|
||||
function _init(){
|
||||
_last_block_hooks.push(_logBlockHash);
|
||||
_getLastBlockInfo();
|
||||
};
|
||||
|
||||
return {init: _init, addBlockHook: _addBlockHook};
|
||||
}();
|
||||
|
||||
$(document).ready(function() {
|
||||
getLastBlockInfo();
|
||||
blockchainListener.init();
|
||||
});
|
||||
|
||||
@@ -357,7 +357,7 @@
|
||||
<p>Contact me</p>
|
||||
<p><span class="glyphicon glyphicon-map-marker"></span> Shambala</p>
|
||||
<p><span class="glyphicon glyphicon-globe"></span> Employer : Mutiny</p>
|
||||
<p><span class="glyphicon glyphicon-phone"></span> +00 666 666 666</p>
|
||||
<p><span class="glyphicon glyphicon-phone"></span> +33 4 8 15 16 23 42</p>
|
||||
<p>
|
||||
<span class="glyphicon glyphicon-envelope"></span>
|
||||
<!--Place the code below where you want the link to be displayed-->
|
||||
|
||||
Reference in New Issue
Block a user