ソースを参照

temporaire

develop
コミット
62f3ac48bb
2個のファイルの変更45行の追加39行の削除
  1. +13
    -4
      index.php
  2. +32
    -35
      js/blockexplorer.js

+ 13
- 4
index.php ファイルの表示

@ -39,10 +39,15 @@
$(window).scroll(function() { $(window).scroll(function() {
if (isInViewport(document.querySelector('footer'))) if (isInViewport(document.querySelector('footer')))
{ {
blockchainExplorer.addBottomBlock();
//blockchainExplorer.addBottomBlock();
console.log("Scroll to footer detected !"); console.log("Scroll to footer detected !");
} }
/*
if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) {
// blockchainExplorer.addBottomBlock();
console.log("Scroll to footer detected !");
}
$(".slideanim").each(function(){ $(".slideanim").each(function(){
var pos = $(this).offset().top; var pos = $(this).offset().top;
var winTop = $(window).scrollTop(); var winTop = $(window).scrollTop();
@ -51,10 +56,10 @@
$(this).addClass("slide"); $(this).addClass("slide");
} }
}); });
*/
}); });
blockchainExplorer.init(2);
blockchainExplorer.init(0);
//toggleInfos(); //toggleInfos();
}); });
@ -129,6 +134,10 @@
<div id="blockchain" style="position:absolute;top:210px;width:100%"></div> <div id="blockchain" style="position:absolute;top:210px;width:100%"></div>
<div>
Click to see more blocks
</div>
<footer class="container-fluid bg-grey text-center slideanim"> <footer class="container-fluid bg-grey text-center slideanim">
<a href="#myPage" title="To Top"> <a href="#myPage" title="To Top">
<span class="glyphicon glyphicon-chevron-up"></span> <span class="glyphicon glyphicon-chevron-up"></span>

+ 32
- 35
js/blockexplorer.js ファイルの表示

@ -8,6 +8,7 @@ blockchainExplorer = function(){
var _cur_methode = 'hasard'; var _cur_methode = 'hasard';
var _mode = 1; var _mode = 1;
var _infos = false; var _infos = false;
var _flag_nav = true;
function _precisionRound(number) { function _precisionRound(number) {
var precision = 4; var precision = 4;
@ -71,6 +72,8 @@ blockchainExplorer = function(){
_cur_class = 1 - _cur_class; _cur_class = 1 - _cur_class;
_flag_nav = false;
blockName = _getblockNameFromHash(block.hash); blockName = _getblockNameFromHash(block.hash);
// if (blockName != '') blockName = ' ( '+blockName+' )'; // if (blockName != '') blockName = ' ( '+blockName+' )';
@ -113,7 +116,7 @@ blockchainExplorer = function(){
div0.style.backgroundRepeat = "no-repeat"; div0.style.backgroundRepeat = "no-repeat";
div0.style.backgroundPosition = "center"; div0.style.backgroundPosition = "center";
div0.style.backgroundSize = "auto 100%"; div0.style.backgroundSize = "auto 100%";
flag_nav = true;
_ flag_nav = true;
}; };
downloadingImage.src = 'images/block_image.php?methode='+_cur_methode+'&hash='+block.hash; 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() function _addBottomBlock()
{ {
// Mettre les infos du block // Mettre les infos du block
@ -248,23 +273,8 @@ blockchainExplorer = function(){
// Mettre les infos dans le div // Mettre les infos dans le div
_addInfoForBlock(data); _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(); if (_liste_blocks['LENGTH'] % 10) _addBottomBlock();
@ -284,29 +294,16 @@ blockchainExplorer = function(){
if (block_name != 'LAST') block_hash = '?block_hash='+_getblocHashFromName(block_name); if (block_name != 'LAST') block_hash = '?block_hash='+_getblocHashFromName(block_name);
$.getJSON('data/getBlockInfo.php'+block_hash, function( data ) { $.getJSON('data/getBlockInfo.php'+block_hash, function( data ) {
div_label = data.height;
_liste_blocks['TOP'] = data.hash; _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;
}
_maintenirListe(data);
_addDivForBlock(div_label); _addDivForBlock(div_label);
_addInfoForBlock(data); _addInfoForBlock(data);
blockchainListener.addBlockHook(_addTopBlock);
// Cela fout le boxon pour l'instant
// blockchainListener.addBlockHook(_addTopBlock);
_addBottomBlock(); _addBottomBlock();
}); });

読み込み中…
キャンセル
保存