summaryrefslogtreecommitdiff
path: root/media/archweb.js
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-05-02 11:05:56 -0500
committerDan McGee <dan@archlinux.org>2011-05-02 11:05:56 -0500
commit98d2608bf2b120a3dde1128069b4ac89a2601f86 (patch)
tree21fe7542fd579dfe4145ab2d88c9e09fc23477d0 /media/archweb.js
parent8de1bd0639a8b6117bc35dfe0ad1e6a1ac34f715 (diff)
Ensure we can handle all values in file size columns
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'media/archweb.js')
-rw-r--r--media/archweb.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/media/archweb.js b/media/archweb.js
index 78b15670..49f2a319 100644
--- a/media/archweb.js
+++ b/media/archweb.js
@@ -69,12 +69,13 @@ if (typeof $.tablesorter !== 'undefined') {
});
$.tablesorter.addParser({
id: 'filesize',
- re: /^(\d+(?:\.\d+)?) (bytes?|KB|MB|GB|TB)$/,
+ re: /^(\d+(?:\.\d+)?) (bytes?|KB|MB|GB|TB|PB)$/,
is: function(s) {
return this.re.test(s);
},
format: function(s) {
var matches = this.re.exec(s);
+ if (!matches) return 0;
var size = parseFloat(matches[1]);
var suffix = matches[2];
@@ -90,6 +91,8 @@ if (typeof $.tablesorter !== 'undefined') {
return size * 1024 * 1024 * 1024;
case 'TB':
return size * 1024 * 1024 * 1024 * 1024;
+ case 'PB':
+ return size * 1024 * 1024 * 1024 * 1024 * 1024;
}
},
type: 'numeric'