diff options
author | Johannes Zellner <johannes@nebulon.de> | 2016-03-01 18:21:56 +0100 |
---|---|---|
committer | Johannes Zellner <johannes@nebulon.de> | 2016-03-01 18:21:56 +0100 |
commit | 8fce52f806a1bea0d961c1520c4ef7e1a1371c33 (patch) | |
tree | 9078ccad0c7eb739c0bc859e3ee3b4253e87b5b5 /app/js | |
parent | 572e87c903c749a78ef22b7e521b964b97cc5b28 (diff) | |
download | Surfer-8fce52f806a1bea0d961c1520c4ef7e1a1371c33.tar.gz Surfer-8fce52f806a1bea0d961c1520c4ef7e1a1371c33.tar.zst Surfer-8fce52f806a1bea0d961c1520c4ef7e1a1371c33.zip |
pretty print file size
Diffstat (limited to 'app/js')
-rw-r--r-- | app/js/app.js | 4 | ||||
-rw-r--r-- | app/js/filesize.min.js | 6 |
2 files changed, 10 insertions, 0 deletions
diff --git a/app/js/app.js b/app/js/app.js index 4f84ea2..c7cb133 100644 --- a/app/js/app.js +++ b/app/js/app.js | |||
@@ -185,6 +185,10 @@ Vue.filter('prettyDate', function (value) { | |||
185 | return d.toDateString(); | 185 | return d.toDateString(); |
186 | }); | 186 | }); |
187 | 187 | ||
188 | Vue.filter('prettyFileSize', function (value) { | ||
189 | return filesize(value); | ||
190 | }); | ||
191 | |||
188 | var app = new Vue({ | 192 | var app = new Vue({ |
189 | el: '#app', | 193 | el: '#app', |
190 | data: { | 194 | data: { |
diff --git a/app/js/filesize.min.js b/app/js/filesize.min.js new file mode 100644 index 0000000..9e0d3df --- /dev/null +++ b/app/js/filesize.min.js | |||
@@ -0,0 +1,6 @@ | |||
1 | /* | ||
2 | 2016 | ||
3 | @version 3.2.1 | ||
4 | */ | ||
5 | "use strict";!function(a){function b(a){var b=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],e=[],f=0,g=void 0,h=void 0,i=void 0,j=void 0,k=void 0,l=void 0,m=void 0,n=void 0,o=void 0,p=void 0,q=void 0;if(isNaN(a))throw new Error("Invalid arguments");return i=b.bits===!0,o=b.unix===!0,h=b.base||2,n=void 0!==b.round?b.round:o?1:2,p=void 0!==b.spacer?b.spacer:o?"":" ",q=b.symbols||b.suffixes||{},m=b.output||"string",g=void 0!==b.exponent?b.exponent:-1,l=Number(a),k=0>l,j=h>2?1e3:1024,k&&(l=-l),0===l?(e[0]=0,e[1]=o?"":i?"b":"B"):((-1===g||isNaN(g))&&(g=Math.floor(Math.log(l)/Math.log(j)),0>g&&(g=0)),g>8&&(g=8),f=2===h?l/Math.pow(2,10*g):l/Math.pow(1e3,g),i&&(f=8*f,f>j&&8>g&&(f/=j,g++)),e[0]=Number(f.toFixed(g>0?n:0)),e[1]=10===h&&1===g?i?"kb":"kB":d[i?"bits":"bytes"][g],o&&(e[1]=e[1].charAt(0),c.test(e[1])&&(e[0]=Math.floor(e[0]),e[1]=""))),k&&(e[0]=-e[0]),e[1]=q[e[1]]||e[1],"array"===m?e:"exponent"===m?g:"object"===m?{value:e[0],suffix:e[1],symbol:e[1]}:e.join(p)}var c=/^(b|B)$/,d={bits:["b","Kb","Mb","Gb","Tb","Pb","Eb","Zb","Yb"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]};"undefined"!=typeof exports?module.exports=b:"function"==typeof define&&define.amd?define(function(){return b}):a.filesize=b}("undefined"!=typeof window?window:global); | ||
6 | //# sourceMappingURL=filesize.min.js.map \ No newline at end of file | ||