diff --git web/javascript/transmission.js web/javascript/transmission.js
index 6d30b92..4bb4a5e 100644
|
|
Transmission.prototype = |
520 | 520 | { |
521 | 521 | this.updateButtonStates(); |
522 | 522 | this.updateInspector(); |
| 523 | this.updateSelectedData(); |
523 | 524 | }, |
524 | 525 | |
525 | 526 | /*-------------------------------------------- |
… |
… |
Transmission.prototype = |
823 | 824 | }, |
824 | 825 | |
825 | 826 | /* |
| 827 | * Turn the periodic ajax torrents refresh on & off for the selected torrents |
| 828 | */ |
| 829 | periodicTorrentUpdate: function( ids ) { |
| 830 | var tr = this; |
| 831 | if( ids ) { |
| 832 | var curIds = this._extra_data_ids; |
| 833 | if( curIds == null ) |
| 834 | curIds = [ ]; |
| 835 | if( ids.length == curIds.length ) { |
| 836 | var duplicate = true; |
| 837 | for(var i = 0; i < ids.length; i++ ) { |
| 838 | if( ids[i] != curIds[i] ) { |
| 839 | duplicate = false; |
| 840 | break; |
| 841 | } |
| 842 | } |
| 843 | if( duplicate ) return; |
| 844 | } |
| 845 | tr.refreshTorrents(ids); |
| 846 | clearInterval(this._metadata_refresh); |
| 847 | // sanity check |
| 848 | if( !this[Prefs._RefreshRate] ) this[Prefs._RefreshRate] = 5; |
| 849 | this._metadata_refresh = setInterval(function(){ tr.refreshTorrents(ids); }, this[Prefs._RefreshRate] * 1000 ); |
| 850 | this._extra_data_ids = ids; |
| 851 | } else { |
| 852 | clearInterval(this._metadata_refresh); |
| 853 | this._metadata_refresh = null; |
| 854 | this._extra_data_ids = null; |
| 855 | } |
| 856 | }, |
| 857 | |
| 858 | /* |
826 | 859 | * Turn the periodic ajax session refresh on & off |
827 | 860 | */ |
828 | 861 | togglePeriodicSessionRefresh: function(state) { |
… |
… |
Transmission.prototype = |
869 | 902 | this.remote.savePrefs( args ); |
870 | 903 | }, |
871 | 904 | |
| 905 | updateSelectedData: function() |
| 906 | { |
| 907 | var ids = jQuery.map(this.getSelectedTorrents( ), function(t) { return t.id(); } ); |
| 908 | if( ids.length > 0 ) |
| 909 | this.periodicTorrentUpdate( ids ); |
| 910 | else |
| 911 | this.periodicTorrentUpdate( false ); |
| 912 | }, |
| 913 | |
872 | 914 | updateTurtleButton: function() { |
873 | 915 | var w = $('#turtle_button'); |
874 | 916 | var t; |