From c44ce249d2249e5b8df38f190b3b68f3f90e3d0a Mon Sep 17 00:00:00 2001 From: Jordan Lee Date: Tue, 30 Aug 2011 07:27:59 +0000 Subject: [PATCH] (trunk web) use String.localeCompare() instead of rolling our own compareTo() function. --- web/javascript/common.js | 11 ----------- web/javascript/torrent.js | 2 +- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/web/javascript/common.js b/web/javascript/common.js index ce473bbbc..5fd9af55b 100644 --- a/web/javascript/common.js +++ b/web/javascript/common.js @@ -128,16 +128,6 @@ String.prototype.trim = function () { return this.replace(/^\s*/, "").replace(/\s*$/, ""); } -/** - * @brief strcmp()-style compare useful for sorting - */ -String.prototype.compareTo = function(that) { - // FIXME: how to fold these two comparisons together? - if (this < that) return -1; - if (this > that) return 1; - return 0; -} - /*** **** Preferences ***/ @@ -176,7 +166,6 @@ Prefs._Defaults = { 'filter': 'all', 'refresh_rate' : 5, - 'show_filter': true, 'sort_direction': 'ascending', 'sort_method': 'name', 'turtle-state' : false, diff --git a/web/javascript/torrent.js b/web/javascript/torrent.js index a0ea38924..11553d771 100644 --- a/web/javascript/torrent.js +++ b/web/javascript/torrent.js @@ -358,7 +358,7 @@ Torrent.compareById = function(ta, tb) }; Torrent.compareByName = function(ta, tb) { - return ta.getCollatedName().compareTo(tb.getCollatedName()) + return ta.getCollatedName().localeCompare(tb.getCollatedName()) || Torrent.compareById(ta, tb); }; Torrent.compareByQueue = function(ta, tb)