diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2015-04-30 11:57:20 +0200 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2015-04-30 11:57:29 +0200 |
commit | 3b36848573d07b8b6600df0e0da777530cf23859 (patch) | |
tree | 7463fa07e1e8e2efa3a8cd373c67544c1196c17c /data | |
parent | a3a73c582adc64695c04d0bd17ad32dfd5471b3b (diff) | |
download | comatose-3b36848573d07b8b6600df0e0da777530cf23859.tar.gz comatose-3b36848573d07b8b6600df0e0da777530cf23859.tar.bz2 comatose-3b36848573d07b8b6600df0e0da777530cf23859.zip |
Fix javascript sorting
Sorts case-insensitive now
Diffstat (limited to 'data')
-rw-r--r-- | data/script.js | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/data/script.js b/data/script.js index 997a02e..f1e9a68 100644 --- a/data/script.js +++ b/data/script.js @@ -5,12 +5,10 @@ $(document).ready (function () { items.detach ().sort (function (nodeA, nodeB) { var a = $(nodeA).data (by); var b = $(nodeB).data (by); - if (a > b) { - return 1; - } else if (a < b) { - return -1; + if (typeof a == 'number' || typeof b == 'number') { + return a > b ? 1 : (a < b ? -1 : 0); } else { - return 0; + return a.localeCompare (b); } }); protolist.append (items); |