From 94b4a6a3a322045e16429fd6d61e8cd051b21dd1 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 29 Sep 2011 22:01:44 -0500 Subject: Slight rework of package size sort function Signed-off-by: Dan McGee --- media/archweb.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'media') diff --git a/media/archweb.js b/media/archweb.js index 52f3cba..2414331 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' }); -- cgit v1.2.3-24-g4f1b