tera/Source/SITE/explorer.html
progr76@gmail.com d436ca1710 0.905
2019-02-26 04:55:33 +03:00

345 lines
10 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Explorer</title>
<script type="text/javascript" src="/HTML/JS/coinlib.js"></script>
<script type="text/javascript" src="../HTML/JS/client.js"></script>
<script type="text/javascript" src="../HTML/JS/diagram.js"></script>
<script>
//Pagination
var CONFIG_DATA={};
var CountViewRows=20;
var DefAccounts={BlockName:"idPaginationAccount", NumName:"idViewAccountNum", TabName:"grid_accounts_all",APIName:"GetAccountList"};
var DefBlock={BlockName:"idPaginationBlock", NumName:"idViewBlockNum", TabName:"grid_block_all",APIName:"GetBlockList"};
function SaveValues() {};
function SetImg() {};
function UpdatesConfigData(bFirst)
{
GetData("GetCurrentInfo",{Diagram:IsVisibleBlock("idStatBlock")?1:0}, function (Data)
{
SetConfigData(Data,bFirst);
var arr=Data.arr;
for(var i=0;arr && i<arr.length;i++)
{
var ItemServer=arr[i];
var ItemClient=DiagramMap[ItemServer.name];
if(!ItemClient || ItemClient.Extern)
continue;
ItemClient.arr=ItemServer.arr;
ItemClient.AvgValue=ItemServer.AvgValue;
ItemClient.steptime=ItemServer.steptime;
ItemClient.fillStyle="#c7c7c7";
DrawDiagram(ItemClient);
}
});
}
function SetConfigData(Data,bFirst)
{
if(!Data || !Data.result)
return;
CONFIG_DATA=Data;
window.FIRST_TIME_BLOCK=Data.FIRST_TIME_BLOCK;
if(bFirst)
{
ViewEnd(DefAccounts,CONFIG_DATA.MaxAccID,1);
ViewEnd(DefBlock,CONFIG_DATA.MaxNumBlockDB,1);
InitDiagram();
}
var StrVersion=" 0."+Data.VersionNum;
var Str="Blockchain height: <B>"+Data.MaxNumBlockDB+"</B> Current create: <B>"+Data.CurBlockNum+"</B> Wallet ver:"+"<B>"+StrVersion+"</B>";
document.getElementById("idCurrentBlockNum").innerHTML=Str;
}
window.onload=function()
{
UpdatesConfigData(1);
setInterval(UpdatesConfigData,1000);
if(!localStorage["idSelStyle"])
localStorage["idSelStyle"]="styleDark";
//COMMON MOUSE MOVING
window.onmousemove = function(event)
{
SetDiagramMouseX(event);
}
};
</script>
<script>
var DiagramArr=
[
{name:"MAX:ALL_NODES",text:"All nodes count",value:0,red:"#1d506b"},
{name:"MAX:HASH_RATE_G",text:"HashRate Gh/s",value:0,red:"#286b16"},
];
function InitDiagram()
{
InitDiagramByArr(DiagramArr,800);
}
function ViewCounters(This)
{
var BlockName="idStatBlock";
var element=$(BlockName);
var bVisible=IsVisibleBlock(BlockName);
if(!bVisible)
MoveUp(element);
SetVisibleBlock(BlockName,!bVisible);
var ResVisible=IsVisibleBlock(BlockName);
if(This && This.className)
{
This.className=This.className.replace("btpress", "");
if(ResVisible)
This.className+=" btpress";
}
}
</script>
<style>
.DIAGRAM
{
border-radius: 6px;
width: 800px;
}
body
{
background: #282828;
color: white;
}
table
{
border-collapse: collapse;
width:100%;
max-width: 800px;
margin: 10px;
}
.grid th, .grid td
{
border: 1px solid #777678;
padding: 4px;
}
.grid td
{
width: 60px;
vertical-align:top;
}
button
{
background-color: #525453;
border-color: #696369;
border-width: 1px;
color: white;
}
button:hover
{
filter: brightness(120%);
cursor: pointer;
}
.openblock
{
background-color: #7a7a7b;
padding: 2px;
}
.btview
{
height: 120px;
width: 150px;
padding-top: 0px;
cursor: pointer;
font-size: large;
}
.btview:hover
{
border: 1px solid #264378;
}
.btpress, .btpress:hover
{
border: 1px solid #000;
filter: brightness(150%);
color:black;
}
.btnav
{
font-family: monospace;
height: 32px;
}
#idViewBlockNum,#idViewAccountNum
{
border-radius: 4px;
height: 26px;
margin: 2px;
}
td
{
font-size: small;
}
td.num
{
text-align: right;
width: 50px;
}
td.sum
{
text-align: right;
font-family: "courier new", "times new roman", monospace;
min-width: 150px;
max-width: 150px;
}
td.cur
{
min-width: 80px;
max-width: 80px;
}
td.date
{
text-align: left;
width: 90px;
}
td.hash
{
max-width: 113px;
min-width: 113px;
font-family: "courier new", "times new roman", monospace;
font-size: 60%;
align-content: left;
text-align: left;
word-break: break-all;
}
td.pubkey
{
min-width: 195px;
max-width: 195px;
}
.accname
{
width: 180px;
min-width: 140px;
align-content: left;
text-align: left;
word-break: break-all;
}
#idCurrentBlockNum
{
margin: 10px;
height: 20px;
}
.delete
{
position: absolute;
display: none;
}
</style>
</head>
<body>
<DIV align='center'>
<DIV id="idCurrentBlockNum"></DIV>
<button onclick="ViewCurrent(DefAccounts,1,this);" class="btview">Accounts</button>
<button onclick="ViewCurrent(DefBlock,1,this)" class="btview">Blocks & Tr</button>
<!--<button onclick="ViewCurrent(DefBlock,1,this)" class="btview">DApps</button>-->
<button onclick="ViewCounters(this)" class="btview">Counters</button>
<DIV>
<DIV id="idPaginationAccount" style="display: none">
<BR>
<button onclick="ViewBegin(DefAccounts)" class="btnav">|<-</button>
<button onclick="ViewPrev(DefAccounts)" class="btnav"><< Prev</button>
<INPUT type="number" id="idViewAccountNum" style="text-align: center" value="0" min=0 onchange="ViewCurrent(DefAccounts)">
<button onclick="ViewNext(DefAccounts,CONFIG_DATA.MaxAccID)" class="btnav">Next >></button>
<button onclick="ViewEnd(DefAccounts,CONFIG_DATA.MaxAccID)" class="btnav">->|</button>
<table id="grid_accounts_all" class="grid">
<tr>
<th id="Item.Num" class="num">ID</th>
<th id="SUM_TO_STRING(Item.Value)" class="sum">Amount</th>
<th id="CurrencyNameItem(Item)" class="cur">Cur</th>
<th id="Item.Name" class="accname">Name</th>
<th id="Item.PubKeyStr" class="hash pubkey">PubKey</th>
<th id="Item.Value.OperationID" class="num">Operation</th>
<th id="Item.Value.Smart" class="num">Smart</th>
<th id="(RetOpenBlock(Item.BlockNumCreate,1))" class="num">Block Num</th>
</tr>
</table>
</DIV>
<DIV id="idPaginationBlock" style="display: none">
<BR>
<DIV>Blocks<BR></DIV>
<button onclick="ViewBegin(DefBlock)" class="btnav">|<-</button>
<button onclick="ViewPrev(DefBlock)" class="btnav"><< Prev</button>
<INPUT type="number" id="idViewBlockNum" style="text-align: center" value="0" min=0 onchange="ViewCurrent(DefBlock)">
<button onclick="ViewNext(DefBlock,CONFIG_DATA.MaxNumBlockDB)" class="btnav">Next >></button>
<button onclick="ViewEnd(DefBlock,CONFIG_DATA.MaxNumBlockDB)" class="btnav">->|</button>
<table id="grid_block_all" class="grid">
<tr>
<th id="(RetOpenBlock(Item.BlockNum,Item.TrDataLen))" class="num">Num</th>
<th id="(DateFromBlock(Item.BlockNum))" class="date">Date</th>
<th id="GetHexFromArr(Item.TreeHash)" class="hash">Data Hash</th>
<th id="GetHexFromArr(Item.PowHash)" class="hash">PowHash</th>
<th id="GetHexFromArr(Item.Hash)" class="hash">Block Hash</th>
<th id="Item.TrDataLen" class="num">Bytes</th>
<th id="Item.Power" class="num">Pow</th>
<th id="Item.Miner" class="num">Miner</th>
</tr>
</table>
</DIV>
<DIV id="idStatBlock" style="display: none">
<BR>
<DIV id="diagr_content" align='center'>
<DIV id="diargams" align='center'>
</DIV>
</DIV>
</DIV>
</DIV>
</DIV>
</body>
</html>