|
|
@ -59,35 +59,17 @@ angular.module('netStatsApp.filters', []) |
|
|
|
}) |
|
|
|
}) |
|
|
|
.filter('hashrateFilter', ['$sce', '$filter', function($sce, filter) { |
|
|
|
.filter('hashrateFilter', ['$sce', '$filter', function($sce, filter) { |
|
|
|
return function(hashes, isMining) { |
|
|
|
return function(hashes, isMining) { |
|
|
|
var result = 0; |
|
|
|
|
|
|
|
var unit = 'K'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( !isMining ) |
|
|
|
if( !isMining ) |
|
|
|
return $sce.trustAsHtml('<i class="icon-cancel"></i>'); |
|
|
|
return $sce.trustAsHtml('<i class="icon-cancel"></i>'); |
|
|
|
|
|
|
|
|
|
|
|
if(hashes !== 0 && hashes < 1000) { |
|
|
|
var result = hashes; |
|
|
|
result = hashes; |
|
|
|
var units = ['', 'K', 'M', 'G', 'T', 'P']; |
|
|
|
unit = ''; |
|
|
|
var unit = 'K'; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(hashes >= 1000 && hashes < Math.pow(1000, 2)) { |
|
|
|
|
|
|
|
result = hashes / 1000; |
|
|
|
|
|
|
|
unit = 'K'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(hashes >= Math.pow(1000, 2) && hashes < Math.pow(1000, 3)) { |
|
|
|
|
|
|
|
result = hashes / Math.pow(1000, 2); |
|
|
|
|
|
|
|
unit = 'M'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(hashes >= Math.pow(1000, 3) && hashes < Math.pow(1000, 4)) { |
|
|
|
|
|
|
|
result = hashes / Math.pow(1000, 3); |
|
|
|
|
|
|
|
unit = 'G'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(hashes >= Math.pow(1000, 4) && hashes < Math.pow(1000, 5)) { |
|
|
|
for(var i = 1; result > 1000; i++) |
|
|
|
result = hashes / Math.pow(1000, 4); |
|
|
|
{ |
|
|
|
unit = 'T'; |
|
|
|
result /= 1000; |
|
|
|
|
|
|
|
unit = units[i]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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>'); |
|
|
@ -95,32 +77,14 @@ angular.module('netStatsApp.filters', []) |
|
|
|
}]) |
|
|
|
}]) |
|
|
|
.filter('totalDifficultyFilter', function() { |
|
|
|
.filter('totalDifficultyFilter', function() { |
|
|
|
return function(hashes) { |
|
|
|
return function(hashes) { |
|
|
|
var result = 0; |
|
|
|
var result = hashes; |
|
|
|
|
|
|
|
var units = ['', 'K', 'M', 'G', 'T', 'P']; |
|
|
|
var unit = ''; |
|
|
|
var unit = ''; |
|
|
|
|
|
|
|
|
|
|
|
if(hashes !== 0 && hashes < 1000) { |
|
|
|
for(var i = 1; result > 1000; i++) |
|
|
|
result = hashes; |
|
|
|
{ |
|
|
|
unit = ''; |
|
|
|
result /= 1000; |
|
|
|
} |
|
|
|
unit = units[i]; |
|
|
|
|
|
|
|
|
|
|
|
if(hashes >= 1000 && hashes < Math.pow(1000, 2)) { |
|
|
|
|
|
|
|
result = hashes / 1000; |
|
|
|
|
|
|
|
unit = 'K'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(hashes >= Math.pow(1000, 2) && hashes < Math.pow(1000, 3)) { |
|
|
|
|
|
|
|
result = hashes / Math.pow(1000, 2); |
|
|
|
|
|
|
|
unit = 'M'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(hashes >= Math.pow(1000, 3) && hashes < Math.pow(1000, 4)) { |
|
|
|
|
|
|
|
result = hashes / Math.pow(1000, 3); |
|
|
|
|
|
|
|
unit = 'G'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(hashes >= Math.pow(1000, 4) && hashes < Math.pow(1000, 5)) { |
|
|
|
|
|
|
|
result = hashes / Math.pow(1000, 4); |
|
|
|
|
|
|
|
unit = 'T'; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return result.toFixed(2) + ' ' + unit + 'H'; |
|
|
|
return result.toFixed(2) + ' ' + unit + 'H'; |
|
|
@ -327,32 +291,14 @@ angular.module('netStatsApp.filters', []) |
|
|
|
if(hashes === null) |
|
|
|
if(hashes === null) |
|
|
|
hashes = 0; |
|
|
|
hashes = 0; |
|
|
|
|
|
|
|
|
|
|
|
var result = 0; |
|
|
|
var result = hashes; |
|
|
|
|
|
|
|
var units = ['', 'K', 'M', 'G', 'T', 'P']; |
|
|
|
var unit = 'K'; |
|
|
|
var unit = 'K'; |
|
|
|
|
|
|
|
|
|
|
|
if(hashes !== 0 && hashes < 1000) { |
|
|
|
for(var i = 1; result > 1000; i++) |
|
|
|
result = hashes; |
|
|
|
{ |
|
|
|
unit = ''; |
|
|
|
result /= 1000; |
|
|
|
} |
|
|
|
unit = units[i]; |
|
|
|
|
|
|
|
|
|
|
|
if(hashes >= 1000 && hashes < Math.pow(1000, 2)) { |
|
|
|
|
|
|
|
result = hashes / 1000; |
|
|
|
|
|
|
|
unit = 'K'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(hashes >= Math.pow(1000, 2) && hashes < Math.pow(1000, 3)) { |
|
|
|
|
|
|
|
result = hashes / Math.pow(1000, 2); |
|
|
|
|
|
|
|
unit = 'M'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(hashes >= Math.pow(1000, 3) && hashes < Math.pow(1000, 4)) { |
|
|
|
|
|
|
|
result = hashes / Math.pow(1000, 3); |
|
|
|
|
|
|
|
unit = 'G'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(hashes >= Math.pow(1000, 4) && hashes < Math.pow(1000, 5)) { |
|
|
|
|
|
|
|
result = hashes / Math.pow(1000, 4); |
|
|
|
|
|
|
|
unit = 'T'; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if( !isMining ) |
|
|
|
if( !isMining ) |
|
|
|