Merge pull request #40 from BlockTester/master

A little bit more mining information
This commit is contained in:
miguelfreitas 2014-01-16 06:01:09 -08:00
commit 03e77ec3c9
5 changed files with 49 additions and 2 deletions

View File

@ -624,7 +624,8 @@ button.disabled:hover
font-size: 13px;
cursor: pointer;
}
.twister-user-name
.twister-user-name,
.twister-by-user-name
{
font-weight: bold;
font-size: 14px;

View File

@ -174,7 +174,9 @@
<span class="twister-user-tag"></span>
</a>
<div class="followers">Followed by
<span class="followed-by"></span>
<a href="#" class="twister-by-user-name open-profile-modal">
<span class="followed-by"></span>
</a>
</div>
<a class="twister-user-remove">&times;</a>
<button class="follow">Follow</button>

View File

@ -121,7 +121,12 @@
<label>Time of the last block:</label>
<span class="last-block-time">Fri Nov 08 2013 08:32:48 </span>
</li>
<li>
<label> Mining difficulty: </label>
<span class="mining-difficulty">0.0</span>
</li>
</ul>
</div>
<h2>Configure block generation</h2>
@ -155,6 +160,14 @@
</div>
</li>
</ul>
<h3> Block generation status</h3>
<ul>
<li>
<label> Current hash rate: </label>
<span class="mining-hashrate">0</span>
</li>
</ul>
</div>
</div>

View File

@ -332,6 +332,7 @@ function processSuggestion(arg, suggestion, followedBy) {
item.find(".twister-user-info").attr("data-screen-name", suggestion);
item.find(".twister-user-name").attr("href", $.MAL.userUrl(suggestion));
item.find(".twister-by-user-name").attr("href", $.MAL.userUrl(followedBy));
item.find(".twister-user-tag").text("@" + suggestion);
getAvatar(suggestion,item.find(".twister-user-photo"));

View File

@ -143,6 +143,32 @@ function networkUpdate(cbFunc, cbArg) {
});
}
function getMiningInfo(cbFunc, cbArg) {
twisterRpc("getmininginfo", [],
function(args, ret) {
miningDifficulty = ret.difficulty;
miningHashRate = ret.hashespersec;
$(".mining-difficulty").text(miningDifficulty);
$(".mining-hashrate").text(miningHashRate);
/*
if( !twisterdConnections ) {
$.MAL.setNetworkStatusMsg("Connection lost.", false);
twisterdConnectedAndUptodate = false;
}
*/
if( args.cbFunc )
args.cbFunc(args.cbArg);
}, {cbFunc:cbFunc, cbArg:cbArg},
function(args, ret) {
console.log("Error connecting to local twister daemon.");
}, {});
}
function miningUpdate(cbFunc, cbArg) {
getMiningInfo(cbFunc, cbArg);
}
function getGenerate() {
twisterRpc("getgenerate", [],
function(args, ret) {
@ -222,6 +248,10 @@ function initInterfaceNetwork() {
});
networkUpdate();
setInterval("networkUpdate()", 2000);
miningUpdate();
setInterval("miningUpdate()", 2000);
getGenerate();
interfaceNetworkHandlers();