@@ -6,16 +6,16 @@ angular.module('syncthing.core')
|
||||
}
|
||||
if (input > 1024 * 1024 * 1024) {
|
||||
input /= 1024 * 1024 * 1024;
|
||||
return input.toFixed(decimals(input, 2)) + ' Gi';
|
||||
return input.toLocaleString(undefined, {maximumFractionDigits: 2}) + ' Gi';
|
||||
}
|
||||
if (input > 1024 * 1024) {
|
||||
input /= 1024 * 1024;
|
||||
return input.toFixed(decimals(input, 2)) + ' Mi';
|
||||
return input.toLocaleString(undefined, {maximumFractionDigits: 2}) + ' Mi';
|
||||
}
|
||||
if (input > 1024) {
|
||||
input /= 1024;
|
||||
return input.toFixed(decimals(input, 2)) + ' Ki';
|
||||
return input.toLocaleString(undefined, {maximumFractionDigits: 2}) + ' Ki';
|
||||
}
|
||||
return Math.round(input) + ' ';
|
||||
return Math.round(input).toLocaleString(undefined, {maximumFractionDigits: 2}) + ' ';
|
||||
};
|
||||
});
|
||||
|
||||
9
gui/default/syncthing/core/localeNumberFilter.js
Normal file
9
gui/default/syncthing/core/localeNumberFilter.js
Normal file
@@ -0,0 +1,9 @@
|
||||
angular.module('syncthing.core')
|
||||
.filter('localeNumber', function () {
|
||||
return function (input, decimals) {
|
||||
if (typeof(decimals) !== 'undefined') {
|
||||
return input.toLocaleString(undefined, {maximumFractionDigits: decimals});
|
||||
}
|
||||
return input.toLocaleString();
|
||||
};
|
||||
});
|
||||
@@ -6,16 +6,16 @@ angular.module('syncthing.core')
|
||||
}
|
||||
if (input > 1000 * 1000 * 1000) {
|
||||
input /= 1000 * 1000 * 1000;
|
||||
return input.toFixed(decimals(input, 2)) + ' G';
|
||||
return input.toLocaleString(undefined, {maximumFractionDigits: 2}) + ' G';
|
||||
}
|
||||
if (input > 1000 * 1000) {
|
||||
input /= 1000 * 1000;
|
||||
return input.toFixed(decimals(input, 2)) + ' M';
|
||||
return input.toLocaleString(undefined, {maximumFractionDigits: 2}) + ' M';
|
||||
}
|
||||
if (input > 1000) {
|
||||
input /= 1000;
|
||||
return input.toFixed(decimals(input, 2)) + ' k';
|
||||
return input.toLocaleString(undefined, {maximumFractionDigits: 2}) + ' k';
|
||||
}
|
||||
return Math.round(input) + ' ';
|
||||
return Math.round(input).toLocaleString(undefined, {maximumFractionDigits: 2}) + ' ';
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
angular.module('syncthing.core')
|
||||
.filter('natural', function () {
|
||||
return function (input, valid) {
|
||||
return input.toFixed(decimals(input, valid));
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user