From 3b36848573d07b8b6600df0e0da777530cf23859 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Thu, 30 Apr 2015 11:57:20 +0200 Subject: Fix javascript sorting Sorts case-insensitive now --- data/script.js | 8 +++----- 1 file 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); -- cgit v1.2.3