temporaire 20181201
This commit is contained in:
46
explorer.php
46
explorer.php
@@ -60,6 +60,12 @@
|
||||
});
|
||||
});
|
||||
|
||||
function changeMethode(la_methode)
|
||||
{
|
||||
cur_height = [];
|
||||
cur_methode=la_methode;
|
||||
return initBlockExplorer(null);
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
@@ -78,12 +84,42 @@
|
||||
<span style="vertical-align:text-bottom;display:inline-block;color:black;font-family: Bangers, sans-serif;font-size: 60px;text-shadow: 2px 2px #ffffff">TOPISTO</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse" id="myNavbar">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li><a href="#explorer">Full Explorer</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div id="explorer" class="container-fluid bg-grey" style="padding-top:10px">
|
||||
<div id="explorer" class="container-fluid bg-grey" style="padding-bottom:10px">
|
||||
<div class="row">
|
||||
<div class="col-sm-12"> </div>
|
||||
<div class="col-sm-12 text-right">
|
||||
Scroll down to see the previous blocks<br>
|
||||
<!--
|
||||
Méthode de dessin <select onchange="changeMethode(this.value);">
|
||||
<option value="hasard">hasard</option>
|
||||
<option value="circle">circle</option>
|
||||
<option value="circle_spline">circle_spline</option>
|
||||
<option value="linegradient">linegradient</option>
|
||||
<option value="mondrian">mondrian</option>
|
||||
<option value="splinelineblackalpha">splinelineblackalpha</option>
|
||||
<option value="treemap2">treemap2</option>
|
||||
<option value="circle_line">circle_line</option>
|
||||
<option value="circles_spline">circles_spline</option>
|
||||
<option value="linehashed">linehashed/option>
|
||||
<option value="peigne">peigne</option>
|
||||
<option value="splinelinegradient">splinelinegradient</option>
|
||||
<option value="veraMolnar">veraMolnar</option>
|
||||
<option value="circles">circles</option>
|
||||
<option value="line">line</option>
|
||||
<option value="linehashedtx">linehashedtx</option>
|
||||
<option value="peignealpha">peignealpha</option>
|
||||
<option value="splinelineblack">splinelineblack</option>
|
||||
<option value="splinelinegradientalpha">splinelinegradientalpha</option>
|
||||
</select>
|
||||
-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -91,11 +127,11 @@
|
||||
|
||||
<div id="contact" class="container-fluid bg-grey">
|
||||
<h4 class="text-center">
|
||||
<a href="#myPage" title="To Top">
|
||||
<a href="#contact" title="To Top">
|
||||
<span class="glyphicon glyphicon-chevron-down"></span>
|
||||
</a>
|
||||
SCROLL TO LOAD PREVIOUS BLOCK
|
||||
<a href="#myPage" title="To Top">
|
||||
PREVIOUS BLOCK
|
||||
<a href="#contact" title="To Top">
|
||||
<span class="glyphicon glyphicon-chevron-down"></span>
|
||||
</a>
|
||||
</h4>
|
||||
|
||||
230
history.php
Normal file
230
history.php
Normal file
@@ -0,0 +1,230 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>TOPISTO</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
|
||||
|
||||
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet" type="text/css">
|
||||
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet" type="text/css">
|
||||
<link href="https://fonts.googleapis.com/css?family=Bangers" rel="stylesheet" type="text/css">
|
||||
|
||||
<link href="css/topisto.css" rel="stylesheet" type="text/css">
|
||||
<link href="css/fonts.css" rel="stylesheet" type="text/css">
|
||||
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
||||
|
||||
<script src="js/lastblock.js" defer></script>
|
||||
<script src="js/blockexplorer.js" defer></script>
|
||||
|
||||
<script>
|
||||
|
||||
// Init array
|
||||
var cur_history_blocks = -1;
|
||||
var history_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 height_blocks = {
|
||||
'GENESIS' : 0,
|
||||
'THE_ANSWER' : 42,
|
||||
'LUCIFER' : 666,
|
||||
'LEET' : 1337,
|
||||
'TOPISTO' : 5637,
|
||||
'PIZZA' : 57035,
|
||||
'HALVING_1' : 210000,
|
||||
'HALVING_2' : 420000,
|
||||
'BIP_91_LOCK' : 477120,
|
||||
'BCC' : 478559,
|
||||
'SEGWIT_LOCK' : 479808,
|
||||
'WHALE201311' : 270953,
|
||||
'BLOCK21E800' : 528249,
|
||||
'WHALE201810' : 545911,
|
||||
'HURRICANE_1' : 506734,
|
||||
'SEGWIT' : 481823
|
||||
};
|
||||
|
||||
function ajouterPreviousHistoryBlock()
|
||||
{
|
||||
// Bloquer la navigation pendant le calcul
|
||||
if (!flag_nav) return false;
|
||||
flag_nav = false;
|
||||
|
||||
// Ajouter un div
|
||||
cur_history_blocks += 1;
|
||||
curblocname=history_blocks[cur_history_blocks];
|
||||
console.log(curblocname);
|
||||
console.log(height_blocks[curblocname]);
|
||||
addDivForBlock(height_blocks[curblocname]);
|
||||
// Mettre les infos du
|
||||
block_hash = '?block_hash='+liste_blocks[history_blocks[cur_history_blocks]];
|
||||
$.getJSON('data/getBlockInfo.php'+block_hash, function( data ) {
|
||||
addInfoForBlock(data);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
// tooltips activation
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
|
||||
// Add smooth scrolling to all links in navbar + footer link
|
||||
$(".navbar a, footer a[href='#myPage']").on('click', function(event) {
|
||||
// Make sure this.hash has a value before overriding default behavior
|
||||
if (this.hash !== "") {
|
||||
// Prevent default anchor click behavior
|
||||
event.preventDefault();
|
||||
|
||||
// Store hash
|
||||
var hash = this.hash;
|
||||
|
||||
// Using jQuery's animate() method to add smooth page scroll
|
||||
// The optional number (900) specifies the number of milliseconds it takes to scroll to the specified area
|
||||
$('html, body').animate({
|
||||
scrollTop: $(hash).offset().top
|
||||
}, 900, function(){
|
||||
// Add hash (#) to URL when done scrolling (default click behavior)
|
||||
window.location.hash = hash;
|
||||
});
|
||||
} // End if
|
||||
});
|
||||
|
||||
$(window).scroll(function() {
|
||||
$(".slideanim").each(function(){
|
||||
var pos = $(this).offset().top;
|
||||
var winTop = $(window).scrollTop();
|
||||
if (pos < winTop + 600) {
|
||||
ajouterPreviousHistoryBlock();
|
||||
$(this).addClass("slide");
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function changeMethode(la_methode)
|
||||
{
|
||||
cur_height = [];
|
||||
cur_methode=la_methode;
|
||||
return initBlockExplorer(null);
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body id="myPage" data-spy="scroll" data-target=".navbar" data-offset="60">
|
||||
|
||||
<nav class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="..">
|
||||
<img id="logo_topisto" src="images/topisto_vert.png" style="border-radius:6px;display:inline-block;visibility:block;height:72px;;box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19)">
|
||||
<span style="vertical-align:text-bottom;display:inline-block;color:black;font-family: Bangers, sans-serif;font-size: 60px;text-shadow: 2px 2px #ffffff">TOPISTO</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse" id="myNavbar">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li><a href="#explorer">Full Explorer</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div id="explorer" class="container-fluid bg-grey" style="padding-bottom:10px">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 text-right">
|
||||
Scroll down to see the previous blocks<br>
|
||||
Méthode de dessin <select onchange="changeMethode(this.value);">
|
||||
<option value="hasard">hasard</option>
|
||||
<option value="circle">circle</option>
|
||||
<option value="circle_spline">circle_spline</option>
|
||||
<option value="linegradient">linegradient</option>
|
||||
<option value="mondrian">mondrian</option>
|
||||
<option value="splinelineblackalpha">splinelineblackalpha</option>
|
||||
<option value="treemap2">treemap2</option>
|
||||
<option value="circle_line">circle_line</option>
|
||||
<option value="circles_spline">circles_spline</option>
|
||||
<option value="linehashed">linehashed/option>
|
||||
<option value="peigne">peigne</option>
|
||||
<option value="splinelinegradient">splinelinegradient</option>
|
||||
<option value="veraMolnar">veraMolnar</option>
|
||||
<option value="circles">circles</option>
|
||||
<option value="line">line</option>
|
||||
<option value="linehashedtx">linehashedtx</option>
|
||||
<option value="peignealpha">peignealpha</option>
|
||||
<option value="splinelineblack">splinelineblack</option>
|
||||
<option value="splinelinegradientalpha">splinelinegradientalpha</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="blockchain"></div>
|
||||
|
||||
<div id="contact" class="container-fluid bg-grey">
|
||||
<h4 class="text-center">
|
||||
<a href="#contact" title="To Top">
|
||||
<span class="glyphicon glyphicon-chevron-down"></span>
|
||||
</a>
|
||||
PREVIOUS BLOCK
|
||||
<a href="#contact" title="To Top">
|
||||
<span class="glyphicon glyphicon-chevron-down"></span>
|
||||
</a>
|
||||
</h4>
|
||||
<div class="row slideanim">
|
||||
<div class="col-sm-5">
|
||||
<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-envelope"></span>
|
||||
<!--Place the code below where you want the link to be displayed-->
|
||||
<span id="obf"><script>document.getElementById("obf").innerHTML="<n uers=\"znvygb:nyoreg.frnaquvyf@gbcvfgb.arg?fhowrpg=pbagnpg\" gnetrg=\"_oynax\">nyoreg.frnaquvyf@gbcvfgb.arg</n>".replace(/[a-zA-Z]/g,function(c){return String.fromCharCode((c<="Z"?90:122)>=(c=c.charCodeAt(0)+13)?c:c-26);});</script>
|
||||
<noscript><span style="unicode-bidi:bidi-override;direction:rtl;">ten.otsipot@slihdnaes.trebla</span></noscript></span>
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
bookmarks : <br>
|
||||
<a href="http://inconvergent.net/" target="_blank">Inconvergent</a><br>
|
||||
<a href="http://www.datasketch.es/" target="_blank">Data Sketches</a><br>
|
||||
<a href="https://bit101.github.io/lab/dailies/170310.html" target="_blank">bit101-github</a><br>
|
||||
<a href="http://www.imdb.com/title/tt1508021/" target="_blank">being captain zero</a><br>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
PGP : <br>
|
||||
<a href="page.php?id=00000000"><img src="articles/00000000/public_key_qrcode.png" width="100%; height: auto"></img></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer class="container-fluid bg-grey text-center">
|
||||
<a href="#myPage" title="To Top">
|
||||
<span class="glyphicon glyphicon-chevron-up"></span>
|
||||
</a>
|
||||
<p>Bootstrap Theme Made By <a href="https://www.w3schools.com" title="Visit w3schools">www.w3schools.com</a></p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
236
images/block_image_1.php
Normal file
236
images/block_image_1.php
Normal file
@@ -0,0 +1,236 @@
|
||||
<?php
|
||||
|
||||
function tri_filemtime( $a, $b ) { return filemtime($a) - filemtime($b); }
|
||||
|
||||
// ---
|
||||
// --- La config globale
|
||||
// ---
|
||||
chdir('/opt/TOPISTO/apps');
|
||||
require_once '/opt/TOPISTO/apps/global/inc/config.php';
|
||||
|
||||
// ---
|
||||
// --- External dependances
|
||||
// ---
|
||||
require TOPISTO_PATH.'/ressources/vendor/autoload.php';
|
||||
|
||||
// ---
|
||||
// --- Internal dependances
|
||||
// ---
|
||||
require_once APP_PATH.'/blockchain/inc/block.php';
|
||||
|
||||
// ---
|
||||
// --- Par défaut on cherche le dernier block
|
||||
// ---
|
||||
$block_hash = '*';
|
||||
$methode='hasard';
|
||||
$mode=9999;
|
||||
|
||||
// ---
|
||||
// --- Le cas échéant, on cherche block passé en argument
|
||||
// ---
|
||||
if (isset($_REQUEST['hash'])) $block_hash = $_REQUEST['hash'];
|
||||
if (isset($_REQUEST['methode'])) $methode = $_REQUEST['methode'];
|
||||
if (isset($_REQUEST['mode'])) $mode = intval($_REQUEST['mode']);
|
||||
|
||||
$img = null;
|
||||
|
||||
// ---
|
||||
// --- Le cas général : on trouve le fichier image demandé
|
||||
// ---
|
||||
$imagefilename = DATA_PATH.'/'.$methode.'/'.$block_hash;
|
||||
if ($mode != 9999) $imagefilename .= '-'.$mode;
|
||||
$imagefilename .= '.png';
|
||||
|
||||
echo $imagefilename.PHP_EOL;
|
||||
if (file_exists($imagefilename)) die('OK');
|
||||
else die('PROBLEM');
|
||||
|
||||
if (file_exists($imagefilename)) $img = imagecreatefrompng($imagefilename);
|
||||
|
||||
// ---
|
||||
// --- "strict" est un flag qui indique que l'on veut précisément
|
||||
// --- ce que les paramètres demandent
|
||||
// ---
|
||||
if (($img==null)&&(!isset($_REQUEST['strict'])))
|
||||
{
|
||||
//
|
||||
// On n'a pas passé de HASH
|
||||
//
|
||||
if (($img==null)&&(!isset($_REQUEST['hash'])))
|
||||
{
|
||||
//
|
||||
// On prend le dernier connu pour la méthode et le mode
|
||||
//
|
||||
$myarray = glob(DATA_PATH.'/'.$methode.'/*-'.$mode.'.png');
|
||||
if (isset($myarray[0]))
|
||||
{
|
||||
usort( $myarray, tri_filemtime );
|
||||
$img = imagecreatefrompng($myarray[0]);
|
||||
}
|
||||
//
|
||||
// On prend le dernier connu pour la méthode tout mode confondu
|
||||
//
|
||||
if ($img==null)
|
||||
{
|
||||
$myarray = glob(DATA_PATH.'/'.$methode.'/*.png');
|
||||
if (isset($myarray[0]))
|
||||
{
|
||||
usort( $myarray, tri_filemtime );
|
||||
$img = imagecreatefrompng($myarray[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// On a passé un HASH
|
||||
//
|
||||
if (($img==null)&&(isset($_REQUEST['hash'])))
|
||||
{
|
||||
//
|
||||
// On cherche le bon HASH et la bonne méthode
|
||||
//
|
||||
$imagefilename = DATA_PATH.'/'.$methode.'/'.$block_hash.'.png';
|
||||
if (($img==null)&&(file_exists($imagefilename)))
|
||||
{
|
||||
$img = imagecreatefrompng($imagefilename);
|
||||
}
|
||||
//
|
||||
// En fait on s'en fiche de la méthode tant qu'on a le bon HASH
|
||||
//
|
||||
$imagefilename = DATA_PATH.'/hasard/'.$block_hash.'.png';
|
||||
if (($img==null)&&(file_exists($imagefilename)))
|
||||
{
|
||||
$img = imagecreatefrompng($imagefilename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// On n'a rien trouvé, donc on dessine ce qui est demandé
|
||||
//
|
||||
if ($img==null)
|
||||
{
|
||||
if ($mode == 9999) $mode = 0;
|
||||
if ($block_hash == '*') $block_hash = blockchain::getLastCacheBlockHash();
|
||||
if ($methode == 'hasard') $methode = 'treemap';
|
||||
|
||||
$imagefilename = DATA_PATH.'/'.$methode.'/'.$block_hash.'.png';
|
||||
|
||||
$the_block = blockchain::getBlockWithHash($block_hash);
|
||||
if ($the_block === FALSE) die();
|
||||
|
||||
$the_name = blockchain::hash2SpecialName($the_block->hash);
|
||||
if ($the_name == $the_block->hash) $the_name ='';
|
||||
|
||||
$bandeau = 50;
|
||||
$marge = 25;
|
||||
$text_border = 20;
|
||||
$width = GRAPH_WIDTH;
|
||||
$height = GRAPH_HEIGHT;
|
||||
|
||||
// Pour que l'image simple ait les proportions que l'image full
|
||||
$width = $marge + ($width*2) + (2*$text_border);
|
||||
$height = $marge + ($height*2);
|
||||
|
||||
$img_w = $width;
|
||||
$img_h = $height+(2*$bandeau);
|
||||
|
||||
$type=2;
|
||||
if (count($the_block->tx)==1) $type=4;
|
||||
|
||||
// création d'une image plus haute pour inclure bandeaux haut et bas
|
||||
$img = imagecreatetruecolor($img_w, $img_h);
|
||||
|
||||
$param0 = blockchain::DrawBlockHeaderFooter($the_block, $img, $bandeau);
|
||||
|
||||
$parametres = [];
|
||||
$parametres['x'] = 0;
|
||||
$parametres['y'] = $bandeau;
|
||||
$parametres['width'] = $width;
|
||||
$parametres['height'] = $height;
|
||||
$parametres['methode'] = $mode;
|
||||
$parametres['type'] = $type;
|
||||
$parametres['transparent_color'] = $param0[0];
|
||||
$parametres['background_color'] = $param0[1];
|
||||
$parametres['font_color'] = $param0[2];
|
||||
$parametres['fontname'] = $param0[3];
|
||||
$parametres['font_RGB'] = $param0[4];
|
||||
$parametres['background_RGB'] = $param0[5];
|
||||
|
||||
switch($methode)
|
||||
{
|
||||
case 'veraMolnar':
|
||||
require_once APP_PATH.'/methode/veraMolnar/inc/treemap.php';
|
||||
topisto_veraMolnar::DrawBlock($the_block, $img, $parametres);
|
||||
break;
|
||||
|
||||
case 'treemapV2':
|
||||
require_once APP_PATH.'/methode/treemapV2/inc/treemap.php';
|
||||
topisto_treemap::DrawBlock($the_block, $img, $parametres);
|
||||
break;
|
||||
|
||||
case 'treemap_fuzzy':
|
||||
require_once APP_PATH.'/methode/treemap_fuzzy/inc/treemap.php';
|
||||
topisto_treemap_fuzzy::DrawBlock($the_block, $img, 0, $bandeau, $width, $height, $mode, $type);
|
||||
break;
|
||||
|
||||
case 'spline':
|
||||
require_once APP_PATH.'/methode/spline/inc/splines.php';
|
||||
topisto_spline::DefaultDrawBlock($the_block, $img, 0, $bandeau, $width, $height, $mode, $type);
|
||||
break;
|
||||
|
||||
case 'spline_2':
|
||||
require_once APP_PATH.'/methode/spline/inc/splines.php';
|
||||
topisto_spline::DrawBlock($the_block, $img, 0, $bandeau, $width, $height, $mode, 200, $type);
|
||||
break;
|
||||
|
||||
case 'treemap' :
|
||||
default:
|
||||
require_once APP_PATH.'/methode/treemap/inc/treemap.php';
|
||||
topisto_treemap::DrawBlock($the_block, $img, 0, $bandeau, $width, $height, $mode, $type);
|
||||
break;
|
||||
}
|
||||
|
||||
// Les textes
|
||||
/*
|
||||
* INUTILE depuis que blockchain::DrawBlockHeaderFooter ajoute elle-même les textes
|
||||
*
|
||||
putenv('GDFONTPATH='.RESS_PATH.'/fonts/');
|
||||
$font = 'DS-DIGIB.TTF';
|
||||
|
||||
$fontColor = imagecolorallocate($img, 227,227,153);
|
||||
$the_texte = "Height : ".$the_block->height;
|
||||
imagettftext($img,18, 0, 5, $bandeau-5, $fontColor, $font, $the_texte);
|
||||
$the_texte = "Inputs : ".$the_block->topisto_inputs;
|
||||
if ($type == 4) $the_texte = "Reward : ".$the_block->topisto_reward;
|
||||
imagettftext($img,15, 0, 5, $bandeau+$height+18, $fontColor, $font, $the_texte);
|
||||
|
||||
if ($the_name == '') $the_name = date('Ymd H:m:s', $the_block->time);
|
||||
$bbox = imagettfbbox(14, 0, $font, $the_name);
|
||||
imagettftext($img, 14, 0, ($img_w-3)-($bbox[2]-$bbox[0]), ($bandeau-5), $fontColor, $font, $the_name);
|
||||
*/
|
||||
|
||||
// Sauvegarder l'image et ajouter
|
||||
// - un lien sur le mode
|
||||
// - un lien dans le dossier "hasard"
|
||||
$imagefilename2 = str_replace(".png","-$mode.png", $imagefilename);
|
||||
imagepng($img,$imagefilename2);
|
||||
|
||||
if (!file_exists($imagefilename)) link($imagefilename2, $imagefilename);
|
||||
|
||||
$imagefilename2 = str_replace("methode/$methode/","methode/hasard/", $imagefilename);
|
||||
if (!file_exists($imagefilename2)) link($imagefilename, $imagefilename2);
|
||||
}
|
||||
|
||||
$seconds_to_cache = 7200;
|
||||
$ts = gmdate("D, d M Y H:i:s", time() + $seconds_to_cache) . " GMT";
|
||||
header("Expires: $ts");
|
||||
header("Pragma: cache");
|
||||
header("Cache-Control: max-age=$seconds_to_cache");
|
||||
header('Content-Type: image/png');
|
||||
|
||||
imagepng($img);
|
||||
|
||||
imagedestroy($img);
|
||||
|
||||
?>
|
||||
59
index.php
59
index.php
@@ -107,6 +107,30 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function changeExploreBlock()
|
||||
{
|
||||
$('#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];
|
||||
$.getJSON(block_url, function( data ) {
|
||||
changeExploreBlockDrawing(data);
|
||||
});
|
||||
}
|
||||
function changeExploreBlockDrawing(le_block)
|
||||
{
|
||||
var downloadingImage = new Image();
|
||||
downloadingImage.onload = function(){
|
||||
$('#img_explorer').attr('src', this.src);
|
||||
};
|
||||
downloadingImage.src = 'images/block_image.php?methode=hasard&hash='+le_block.hash;
|
||||
}
|
||||
$(document).ready(function(){
|
||||
last_block_hooks.push(changeExploreBlockDrawing);
|
||||
});
|
||||
</script>
|
||||
|
||||
<div id="explorer" class="container-fluid bg-grey" style="padding-top:10px">
|
||||
<div class="row">
|
||||
<div class="col-sm-12"> </div>
|
||||
@@ -114,37 +138,22 @@
|
||||
</div>
|
||||
<div class="container-fluid bg-grey" style="padding-top:0px;padding-bottom:10px">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<span class="align-middle">My Blockchain Explorer</span>
|
||||
<div class="col-sm-4">
|
||||
<br><img id="img_explorer" src="images/block_image.php" width="100%; height: auto">
|
||||
</div>
|
||||
<div class="col-sm-8 text-right">
|
||||
<a href="#navigation" onclick="javascript:initBlockchain('GENESIS');" class="btn btn-success btn-lg btn-topisto" data-toggle="tooltip" title="GENESIS">
|
||||
<span class="glyphicon glyphicon-fast-backward"></span>
|
||||
</a>
|
||||
<a href="#navigation" onclick="javascript:gotoBlock('PREVIOUS');" class="btn btn-info btn-lg btn-topisto" data-toggle="tooltip" title="PREVIOUS">
|
||||
<span class="glyphicon glyphicon-backward"></span>
|
||||
</a>
|
||||
<select style="display:none" id="blockSelector" onchange="javascript:blockSelectorChange()" data-width="100%">
|
||||
<option value="LAST">LAST</option>
|
||||
</select>
|
||||
<a id="btn-forward" href="#navigation" onclick="javascript:gotoBlock('NEXT');" class="btn btn-secondary btn-lg btn-topisto" data-toggle="tooltip" title="NEXT">
|
||||
<span class="glyphicon glyphicon-forward"></span>
|
||||
</a>
|
||||
<a href="#navigation" id="fast_forward_btn" onclick="javascript:blockSelectorChange()" class="btn btn-secondary btn-lg btn-topisto" data-toggle="tooltip" title="LAST">
|
||||
<span class="glyphicon glyphicon-fast-forward"></span>
|
||||
</a>
|
||||
<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>
|
||||
<a href="explorer.php">Click here to see the other blocks</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="blockchain"></div>
|
||||
|
||||
<div id="blog" class="container-fluid bg-grey" style="padding-top:50px;align:right">
|
||||
<div id="blog" class="container-fluid bg-white" style="padding-top:50px;align:right">
|
||||
<div class="row">
|
||||
<div class="col-sm-8"> </div>
|
||||
<div class="col-sm-4">
|
||||
<span style="color:black;font-family: Bangers, sans-serif;font-size: 35px;">Blog</span>
|
||||
</div>
|
||||
<div class="col-sm-4"> </div>
|
||||
<div class="col-sm-8 text-right"><h2>Blog</h2></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,4 +1,22 @@
|
||||
// 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 = {
|
||||
'WHALE201810' : '0000000000000000000f9f2dadfb8f312572183272802cbfcc4ff95b4ee6777d',
|
||||
'BLOCK21E800' : '00000000000000000021e800c1e8df51b22c1588e5a624bea17e9faa34b2dc4a',
|
||||
@@ -8,19 +26,21 @@
|
||||
'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',
|
||||
'GENESIS' : '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f'
|
||||
};
|
||||
|
||||
var flag_nav = true;
|
||||
var classes = ['bg-grey-even','bg-grey-odd'];
|
||||
var cur_class = 0;
|
||||
var cur_height = [];
|
||||
|
||||
var flag_nav = true;
|
||||
var classes = ['bg-grey-even','bg-grey-odd'];
|
||||
var cur_class = 0;
|
||||
var cur_height = [];
|
||||
var cur_methode = 'hasard';
|
||||
|
||||
function precisionRound(number) {
|
||||
var precision = 4;
|
||||
@@ -28,6 +48,16 @@
|
||||
return Math.round((number/100000000) * factor) / factor;
|
||||
}
|
||||
|
||||
function getblockNameFromHash(hash)
|
||||
{
|
||||
sHash = String(hash);
|
||||
known_blocks.forEach(function(item){
|
||||
if (sHash == String(liste_blocks[item]))
|
||||
return item;
|
||||
});
|
||||
return '';
|
||||
}
|
||||
|
||||
function addInfoForBlock(block)
|
||||
{
|
||||
var height = '300px';
|
||||
@@ -37,8 +67,11 @@
|
||||
cur_height.push(block.height);
|
||||
|
||||
cur_class = 1 - cur_class;
|
||||
|
||||
blockName = getblockNameFromHash(block.hash);
|
||||
if (blockName != '') blockName = ' ( '+blockName+' )';
|
||||
|
||||
contenu += ' <h2> <span style="font-size:12px">block</span> '+block.height+'</h2>';
|
||||
contenu += ' <h2> <span style="font-size:12px">block</span> '+block.height+blockName+'</h2>';
|
||||
contenu += ' <table width="100%">';
|
||||
//contenu += ' <tr><td>hash</td><td align="right"><b>'+block.hash+'</b></td></tr>';
|
||||
//contenu += ' <tr><td>index</td><td align="right"><b>'+block.block_index+'</b></td></tr>';
|
||||
@@ -59,7 +92,7 @@
|
||||
//$('#img_'+block.height).attr('width','auto');
|
||||
flag_nav = true;
|
||||
};
|
||||
downloadingImage.src = 'images/block_image.php?methode=hasard&hash='+block.hash;
|
||||
downloadingImage.src = 'images/block_image.php?methode='+cur_methode+'&hash='+block.hash;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -219,6 +252,7 @@
|
||||
else
|
||||
addDivForVoid();
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -227,19 +261,25 @@
|
||||
initBlockchain($('#blockSelector').val());
|
||||
$('#fast_forward_btn').attr('data-original-title', $('#blockSelector').val());
|
||||
}
|
||||
|
||||
function initBlockExplorer(leblock)
|
||||
function initBlockSelector()
|
||||
{
|
||||
// Init the selector
|
||||
var select = $('#blockSelector');
|
||||
if (select.length < 2)
|
||||
{
|
||||
$.each(liste_blocks, function (key, text) {
|
||||
select.append(new Option(key, key));
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function initBlockExplorer(leblock)
|
||||
{
|
||||
initBlockSelector();
|
||||
if (cur_height.length == 0) initBlockchain('LAST');
|
||||
return true;
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
last_block_hooks.push(initBlockExplorer);
|
||||
addBlockHook(initBlockExplorer);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
function logBlockHash(leblock)
|
||||
{
|
||||
console.log('Last Block detected : '+leblock.hash);
|
||||
return true;
|
||||
}
|
||||
|
||||
var last_block = null;
|
||||
@@ -29,6 +30,10 @@ function getLastBlockInfo()
|
||||
setTimeout(getLastBlockInfo, 30000);
|
||||
}
|
||||
|
||||
function addBlockHook(addBlockHook){
|
||||
last_block_hooks.push(addBlockHook);
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
getLastBlockInfo();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user