summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-09-29 22:01:44 -0500
committerDan McGee <dan@archlinux.org>2011-09-29 22:01:44 -0500
commit94b4a6a3a322045e16429fd6d61e8cd051b21dd1 (patch)
tree5e1426ff5e7e419d8148bed1067038637a8df898
parent447c4c4bd56b6364a68068ccf691d048e6c2d65b (diff)
Slight rework of package size sort function
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--media/archweb.js23
1 files changed, 11 insertions, 12 deletions
diff --git a/media/archweb.js b/media/archweb.js
index 52f3cba2..2414331d 100644
--- a/media/archweb.js
+++ b/media/archweb.js
@@ -92,20 +92,19 @@ if (typeof $.tablesorter !== 'undefined') {
var suffix = matches[2];
switch(suffix) {
- case 'byte':
- case 'bytes':
- return size;
- case 'KB':
- return size * 1024;
- case 'MB':
- return size * 1024 * 1024;
- case 'GB':
- return size * 1024 * 1024 * 1024;
- case 'TB':
- return size * 1024 * 1024 * 1024 * 1024;
+ /* intentional fall-through at each level */
case 'PB':
- return size * 1024 * 1024 * 1024 * 1024 * 1024;
+ size *= 1024;
+ case 'TB':
+ size *= 1024;
+ case 'GB':
+ size *= 1024;
+ case 'MB':
+ size *= 1024;
+ case 'KB':
+ size *= 1024;
}
+ return size;
},
type: 'numeric'
});