diff options
-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); |