Browse Source

Merge pull request #40 from BlockTester/master

A little bit more mining information
master
miguelfreitas 11 years ago
parent
commit
03e77ec3c9
  1. 3
      css/style.css
  2. 2
      home.html
  3. 13
      network.html
  4. 1
      twister_following.js
  5. 30
      twister_network.js

3
css/style.css

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

2
home.html

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

13
network.html

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

1
twister_following.js

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

30
twister_network.js

@ -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() { function getGenerate() {
twisterRpc("getgenerate", [], twisterRpc("getgenerate", [],
function(args, ret) { function(args, ret) {
@ -222,6 +248,10 @@ function initInterfaceNetwork() {
}); });
networkUpdate(); networkUpdate();
setInterval("networkUpdate()", 2000); setInterval("networkUpdate()", 2000);
miningUpdate();
setInterval("miningUpdate()", 2000);
getGenerate(); getGenerate();
interfaceNetworkHandlers(); interfaceNetworkHandlers();

Loading…
Cancel
Save