Changeset 8895
- Timestamp:
- Aug 12, 2009, 2:53:45 AM (13 years ago)
- Location:
- trunk/web/javascript
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/web/javascript/transmission.js
r8894 r8895 1382 1382 1383 1383 removeTorrents: function( torrents ) { 1384 this.remote.removeTorrents( torrents ); 1384 var torrent_ids = jQuery.map(torrents, function(t) { return t.id(); } ); 1385 var tr = this; 1386 this.remote.removeTorrents( torrent_ids, function(){ tr.refreshTorrents() } ); 1385 1387 }, 1386 1388 … … 1403 1405 }, 1404 1406 startTorrents: function( torrents ) { 1405 this.remote.startTorrents( torrents ); 1407 var torrent_ids = jQuery.map(torrents, function(t) { return t.id(); } ); 1408 var tr = this; 1409 this.remote.startTorrents( torrent_ids, function(){ tr.refreshTorrents(torrent_ids) } ); 1406 1410 }, 1407 1411 verifyTorrent: function( torrent ) { … … 1409 1413 }, 1410 1414 verifyTorrents: function( torrents ) { 1411 this.remote.verifyTorrents( torrents ); 1415 var torrent_ids = jQuery.map(torrents, function(t) { return t.id(); } ); 1416 var tr = this; 1417 this.remote.verifyTorrents( torrent_ids, function(){ tr.refreshTorrents(torrent_ids) } ); 1412 1418 }, 1413 1419 … … 1422 1428 }, 1423 1429 stopTorrents: function( torrents ) { 1424 this.remote.stopTorrents( torrents ); 1430 var torrent_ids = jQuery.map(torrents, function(t) { return t.id(); } ); 1431 var tr = this; 1432 this.remote.stopTorrents( torrent_ids, function(){ tr.refreshTorrents(torrent_ids )} ); 1425 1433 }, 1426 1434 changeFileCommand: function(command, torrent, file) { -
trunk/web/javascript/transmission.remote.js
r8876 r8895 147 147 }, 148 148 149 sendTorrentCommand: function( method, torrents ) { 150 var remote = this; 149 sendTorrentActionRequests: function( method, torrent_ids, callback ) { 151 150 var o = { 152 151 method: method, 153 arguments: { ids: [ ] } 154 }; 152 arguments: { ids: torrent_ids } 153 }; 154 155 this.sendRequest( o, function( data ) { 156 callback(); 157 }); 158 }, 159 160 startTorrents: function( torrent_ids, callback ) { 161 this.sendTorrentActionRequests( 'torrent-start', torrent_ids, callback ); 162 }, 163 stopTorrents: function( torrent_ids, callback ) { 164 this.sendTorrentActionRequests( 'torrent-stop', torrent_ids, callback ); 165 }, 166 removeTorrents: function( torrent_ids, callback ) { 167 this.sendTorrentActionRequests( 'torrent-remove', torrent_ids, callback ); 168 }, 169 removeTorrentsAndData: function( torrents ) { 170 var remote = this; 171 var o = { 172 method: 'torrent-remove', 173 arguments: { 174 'delete-local-data': true, 175 ids: [ ] 176 } 177 }; 178 155 179 if( torrents != null ) 156 180 for( var i=0, len=torrents.length; i<len; ++i ) … … 160 184 } ); 161 185 }, 162 163 startTorrents: function( torrents ) { 164 this.sendTorrentCommand( 'torrent-start', torrents ); 165 }, 166 stopTorrents: function( torrents ) { 167 this.sendTorrentCommand( 'torrent-stop', torrents ); 168 }, 169 removeTorrents: function( torrents ) { 170 this.sendTorrentCommand( 'torrent-remove', torrents ); 171 }, 172 removeTorrentsAndData: function( torrents ) { 173 var remote = this; 174 var o = { 175 method: 'torrent-remove', 176 arguments: { 177 'delete-local-data': true, 178 ids: [ ] 179 } 180 }; 181 182 if( torrents != null ) 183 for( var i=0, len=torrents.length; i<len; ++i ) 184 o.arguments.ids.push( torrents[i].id() ); 185 this.sendRequest( o, function( ) { 186 remote._controller.refreshTorrents(); 187 } ); 188 }, 189 verifyTorrents: function( torrents ) { 190 this.sendTorrentCommand( 'torrent-verify', torrents ); 186 verifyTorrents: function( torrent_ids, callback ) { 187 this.sendTorrentActionRequests( 'torrent-verify', torrent_ids, callback ); 191 188 }, 192 189 addTorrentByUrl: function( url, options ) {
Note: See TracChangeset
for help on using the changeset viewer.