1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-13 07:33:02 +00:00

(web) #3281:Filter by active

This commit is contained in:
Daniel Lee 2010-06-17 04:38:03 +00:00
parent 0988fd3ead
commit 2db4b86a12
4 changed files with 13 additions and 0 deletions

View file

@ -55,6 +55,7 @@
<div id="torrent_filter_bar">
<ul>
<li><a href="#all" id="filter_all_link" class="active">All</a></li>
<li><a href="#active" id="filter_active_link">Active</a></li>
<li><a href="#downloading" id="filter_downloading_link">Downloading</a></li>
<li><a href="#seeding" id="filter_seeding_link">Seeding</a></li>
<li><a href="#paused" id="filter_paused_link">Paused</a></li>

View file

@ -339,6 +339,7 @@ Prefs._ShowInspector = 'show_inspector';
Prefs._FilterMode = 'filter';
Prefs._FilterAll = 'all';
Prefs._FilterActive = 'active';
Prefs._FilterSeeding = 'seeding';
Prefs._FilterDownloading = 'downloading';
Prefs._FilterPaused = 'paused';

View file

@ -221,6 +221,9 @@ Torrent.prototype =
downloadTotal: function() { return this._download_total; },
hash: function() { return this._hashString; },
id: function() { return this._id; },
isActiveFilter: function() { return this.peersGettingFromUs() > 0
|| this.peersSendingToUs() > 0
|| this.state() == Torrent._StatusChecking; },
isActive: function() { return this.state() != Torrent._StatusPaused; },
isDownloading: function() { return this.state() == Torrent._StatusDownloading; },
isSeeding: function() { return this.state() == Torrent._StatusSeeding; },
@ -667,6 +670,9 @@ Torrent.prototype =
switch( filter )
{
case Prefs._FilterActive:
pass = this.isActiveFilter();
break;
case Prefs._FilterSeeding:
pass = this.isSeeding();
break;

View file

@ -41,6 +41,7 @@ Transmission.prototype =
$('#resume_selected_link').bind('click', function(e){ tr.startSelectedClicked(e); });
$('#remove_link').bind('click', function(e){ tr.removeClicked(e); });
$('#filter_all_link').parent().bind('click', function(e){ tr.showAllClicked(e); });
$('#filter_active_link').parent().bind('click', function(e){ tr.showActiveClicked(e); });
$('#filter_downloading_link').parent().bind('click', function(e){ tr.showDownloadingClicked(e); });
$('#filter_seeding_link').parent().bind('click', function(e){ tr.showSeedingClicked(e); });
$('#filter_paused_link').parent().bind('click', function(e){ tr.showPausedClicked(e); });
@ -765,6 +766,7 @@ Transmission.prototype =
var c;
switch( mode ) {
case Prefs._FilterAll: c = '#filter_all_link'; break;
case Prefs._FilterActive: c = '#filter_active_link'; break;
case Prefs._FilterSeeding: c = '#filter_seeding_link'; break;
case Prefs._FilterDownloading: c = '#filter_downloading_link'; break;
case Prefs._FilterPaused: c = '#filter_paused_link'; break;
@ -779,6 +781,9 @@ Transmission.prototype =
showAllClicked: function( event ) {
this.setFilter( Prefs._FilterAll );
},
showActiveClicked: function( event ) {
this.setFilter( Prefs._FilterActive );
},
showDownloadingClicked: function( event ) {
this.setFilter( Prefs._FilterDownloading );
},