mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 12:28:52 +00:00
(trunk web) #4637 "sorting by size in the web ui" -- patch added.
This commit is contained in:
@@ -157,6 +157,7 @@ Prefs._SortByAge = 'age';
|
||||
Prefs._SortByActivity = 'activity';
|
||||
Prefs._SortByName = 'name';
|
||||
Prefs._SortByQueue = 'queue_order';
|
||||
Prefs._SortBySize = 'size';
|
||||
Prefs._SortByProgress = 'percent_completed';
|
||||
Prefs._SortByRatio = 'ratio';
|
||||
Prefs._SortByState = 'state';
|
||||
|
||||
@@ -408,6 +408,14 @@ Torrent.compareByProgress = function(ta, tb)
|
||||
return (a - b) || Torrent.compareByRatio(ta, tb);
|
||||
};
|
||||
|
||||
Torrent.compareBySize = function(ta, tb)
|
||||
{
|
||||
var a = ta.getTotalSize(),
|
||||
b = tb.getTotalSize();
|
||||
|
||||
return (a - b) || Torrent.compareByName(ta, tb);
|
||||
}
|
||||
|
||||
Torrent.compareTorrents = function(a, b, sortMethod, sortDirection)
|
||||
{
|
||||
var i;
|
||||
@@ -426,6 +434,9 @@ Torrent.compareTorrents = function(a, b, sortMethod, sortDirection)
|
||||
case Prefs._SortByProgress:
|
||||
i = Torrent.compareByProgress(a,b);
|
||||
break;
|
||||
case Prefs._SortBySize:
|
||||
i = Torrent.compareBySize(a,b);
|
||||
break;
|
||||
case Prefs._SortByState:
|
||||
i = Torrent.compareByState(a,b);
|
||||
break;
|
||||
@@ -464,6 +475,9 @@ Torrent.sortTorrents = function(torrents, sortMethod, sortDirection)
|
||||
case Prefs._SortByProgress:
|
||||
torrents.sort(this.compareByProgress);
|
||||
break;
|
||||
case Prefs._SortBySize:
|
||||
torrents.sort(this.compareBySize);
|
||||
break;
|
||||
case Prefs._SortByState:
|
||||
torrents.sort(this.compareByState);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user