Changeset 12765
- Timestamp:
- Aug 26, 2011, 11:34:43 PM (12 years ago)
- Location:
- trunk/web/javascript
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/web/javascript/torrent.js
r12763 r12765 209 209 getLeftUntilDone: function() { return this.fields.leftUntilDone; }, 210 210 getMetadataPercentComplete: function() { return this.fields.metadataPercentComplete; }, 211 getName: function() { return this.fields.name ; },211 getName: function() { return this.fields.name || 'Unknown'; }, 212 212 getPeers: function() { return this.fields.peers; }, 213 213 getPeersConnected: function() { return this.fields.peersConnected; }, … … 256 256 case Torrent._StatusSeedWait: return 'Queued for seeding'; 257 257 case Torrent._StatusSeed: return 'Seeding'; 258 default: return 'error'; 258 case null: 259 case undefined: return 'Unknown'; 260 default: return 'Error'; 259 261 } 260 262 }, … … 282 284 var f = this.fields; 283 285 if (!f.collatedName) { 284 var name = this. getName();286 var name = this.fields.name; 285 287 if (name) 286 288 f.collatedName = name.toLowerCase(); -
trunk/web/javascript/transmission.js
r12762 r12765 1048 1048 updateFromTorrentGet: function(updates, removed_ids) 1049 1049 { 1050 var ne w_ids= [];1050 var needinfo = []; 1051 1051 1052 1052 for (var i=0, o; o=updates[i]; ++i) { … … 1059 1059 t = tr._torrents[id] = new Torrent(o); 1060 1060 $(t).bind('dataChanged',function(ev) {tr.onTorrentChanged(ev);}); 1061 new_ids.push(id); 1061 if(!('name' in t.fields) || !('status' in t.fields)) // missing some fields... 1062 needinfo.push(id); 1062 1063 } 1063 1064 } 1064 1065 1065 if (ne w_ids.length) {1066 if (needinfo.length) { 1066 1067 // whee, new torrents! get their initial information. 1067 1068 var fields = ['id'].concat(Torrent.Fields.Metadata, Torrent.Fields.Stats); 1068 this.remote.updateTorrents(ne w_ids, fields, this.updateFromTorrentGet, this);1069 this.remote.updateTorrents(needinfo, fields, this.updateFromTorrentGet, this); 1069 1070 this.refilterSoon(); 1070 1071 } … … 1092 1093 // to bootstrap, we only need to ask for the servers's torrents' ids. 1093 1094 // updateFromTorrentGet() automatically asks for the rest of the info when it gets a new id. 1094 this.remote.updateTorrents(null, ['id'], this.updateFromTorrentGet, this); 1095 var fields = ['id'].concat(Torrent.Fields.Metadata, Torrent.Fields.Stats); 1096 this.remote.updateTorrents(null, fields, this.updateFromTorrentGet, this); 1095 1097 }, 1096 1098
Note: See TracChangeset
for help on using the changeset viewer.