mirror of
https://github.com/transmission/transmission
synced 2024-12-23 08:13:27 +00:00
(web) #2908:Retrieve info for selected torrents
This commit is contained in:
parent
5e2b41d868
commit
066d261f8c
1 changed files with 42 additions and 0 deletions
|
@ -522,6 +522,7 @@ Transmission.prototype =
|
|||
{
|
||||
this.updateButtonStates();
|
||||
this.updateInspector();
|
||||
this.updateSelectedData();
|
||||
},
|
||||
|
||||
/*--------------------------------------------
|
||||
|
@ -829,6 +830,38 @@ Transmission.prototype =
|
|||
}
|
||||
},
|
||||
|
||||
/*
|
||||
* Turn the periodic ajax torrents refresh on & off for the selected torrents
|
||||
*/
|
||||
periodicTorrentUpdate: function( ids ) {
|
||||
var tr = this;
|
||||
if( ids ) {
|
||||
var curIds = this._extra_data_ids;
|
||||
if( curIds == null )
|
||||
curIds = [ ];
|
||||
if( ids.length == curIds.length ) {
|
||||
var duplicate = true;
|
||||
for(var i = 0; i < ids.length; i++ ) {
|
||||
if( ids[i] != curIds[i] ) {
|
||||
duplicate = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( duplicate ) return;
|
||||
}
|
||||
tr.refreshTorrents(ids);
|
||||
clearInterval(this._metadata_refresh);
|
||||
// sanity check
|
||||
if( !this[Prefs._RefreshRate] ) this[Prefs._RefreshRate] = 5;
|
||||
this._metadata_refresh = setInterval(function(){ tr.refreshTorrents(ids); }, this[Prefs._RefreshRate] * 1000 );
|
||||
this._extra_data_ids = ids;
|
||||
} else {
|
||||
clearInterval(this._metadata_refresh);
|
||||
this._metadata_refresh = null;
|
||||
this._extra_data_ids = null;
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
* Turn the periodic ajax session refresh on & off
|
||||
*/
|
||||
|
@ -876,6 +909,15 @@ Transmission.prototype =
|
|||
this.remote.savePrefs( args );
|
||||
},
|
||||
|
||||
updateSelectedData: function()
|
||||
{
|
||||
var ids = jQuery.map(this.getSelectedTorrents( ), function(t) { return t.id(); } );
|
||||
if( ids.length > 0 )
|
||||
this.periodicTorrentUpdate( ids );
|
||||
else
|
||||
this.periodicTorrentUpdate( false );
|
||||
},
|
||||
|
||||
updateTurtleButton: function() {
|
||||
var w = $('#turtle_button');
|
||||
var t;
|
||||
|
|
Loading…
Reference in a new issue