src-lite: totalDifficultyFilter filter added

pull/5/head
hackyminer 7 years ago committed by Ikmyeong Na
parent 18e208bdce
commit cd98725ab8
No known key found for this signature in database
GPG Key ID: EC674310ADADE2CA
  1. 15
      src-lite/js/filters.js
  2. 2
      src-lite/views/index.jade

@ -54,6 +54,21 @@ angular.module('netStatsApp.filters', [])
return $sce.trustAsHtml('<span class="small">' + filter('number')(result.toFixed(1)) + ' <span class="small-hash">' + unit + 'H/s</span></span>'); return $sce.trustAsHtml('<span class="small">' + filter('number')(result.toFixed(1)) + ' <span class="small-hash">' + unit + 'H/s</span></span>');
}; };
}]) }])
.filter('totalDifficultyFilter', function() {
return function(hashes) {
var result = hashes;
var units = ['', 'K', 'M', 'G', 'T', 'P'];
var unit = '';
for(var i = 1; result > 1000; i++)
{
result /= 1000;
unit = units[i];
}
return result.toFixed(2) + ' ' + unit + 'H';
};
})
.filter('nodeVersion', function($sce) { .filter('nodeVersion', function($sce) {
return function(version) { return function(version) {
if(typeof version !== 'undefined') if(typeof version !== 'undefined')

@ -52,7 +52,7 @@ block content
div.big-details-holder div.big-details-holder
span.small-title difficulty span.small-title difficulty
span.big-details span.big-details
span.small-hash {{ lastDifficulty | number }} span.small-hash {{ lastDifficulty | totalDifficultyFilter }}
div.clearfix div.clearfix
div.clearfix div.clearfix

Loading…
Cancel
Save