mirror of
https://github.com/transmission/transmission.git
synced 2025-12-20 10:28:32 +00:00
(trunk web) use String.localeCompare() instead of rolling our own compareTo() function.
This commit is contained in:
@@ -128,16 +128,6 @@ String.prototype.trim = function () {
|
|||||||
return this.replace(/^\s*/, "").replace(/\s*$/, "");
|
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
|
**** Preferences
|
||||||
***/
|
***/
|
||||||
@@ -176,7 +166,6 @@ Prefs._Defaults =
|
|||||||
{
|
{
|
||||||
'filter': 'all',
|
'filter': 'all',
|
||||||
'refresh_rate' : 5,
|
'refresh_rate' : 5,
|
||||||
'show_filter': true,
|
|
||||||
'sort_direction': 'ascending',
|
'sort_direction': 'ascending',
|
||||||
'sort_method': 'name',
|
'sort_method': 'name',
|
||||||
'turtle-state' : false,
|
'turtle-state' : false,
|
||||||
|
|||||||
@@ -358,7 +358,7 @@ Torrent.compareById = function(ta, tb)
|
|||||||
};
|
};
|
||||||
Torrent.compareByName = 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.compareById(ta, tb);
|
||||||
};
|
};
|
||||||
Torrent.compareByQueue = function(ta, tb)
|
Torrent.compareByQueue = function(ta, tb)
|
||||||
|
|||||||
Reference in New Issue
Block a user