Changeset 398
- Timestamp:
- 07/01/08 08:41:15 (2 months ago)
- Files:
-
- branches/rpc/web/javascript/torrent.js (modified) (8 diffs)
- branches/rpc/web/javascript/transmission.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/rpc/web/javascript/torrent.js
r394 r398 130 130 peersDownloading: function() { return this._peers_downloading; }, 131 131 peersUploading: function() { return this._peers_uploading; }, 132 percentCompleted: function() { return this._percent_completed; },133 132 size: function() { return this._size; }, 134 133 state: function() { return this._state; }, … … 260 259 this._completed = data.haveUnchecked + data.haveValid; 261 260 this._verified = data.haveValid; 262 this._percent_completed = 100 * this._completed / this._size;263 261 this._download_total = data.downloadedEver; 264 262 this._upload_total = data.uploadedEver; … … 271 269 this._error_message = data.errorString; 272 270 this._eta = data.eta; 273 this._swarm_speed = data.swarm _speed;271 this._swarm_speed = data.swarmSpeed; 274 272 this._total_leechers = data.leechers; 275 273 this._total_seeders = data.seeders; … … 301 299 302 300 // Figure out the percent completed 303 var css_percent_completed = Math.floor(this._percent_completed * Torrent._MaxProgressBarWidth / 100);304 var int_percent_completed = Math.floor(this._percent_completed);301 var percent_completed = this._completed / this._size; 302 var css_completed_width = Math.floor(this._percent_completed * Torrent._MaxProgressBarWidth ); 305 303 306 304 // Sometimes get figures greater that the max 307 if (css_ percent_completed> Torrent._MaxProgressBarWidth) {308 css_ percent_completed= Torrent._MaxProgressBarWidth;305 if (css_completed_width > Torrent._MaxProgressBarWidth) { 306 css_completed_width = Torrent._MaxProgressBarWidth; 309 307 } 310 308 311 309 // Add the progress bar 312 if (int_percent_completed < 100 && this.state() != "seeding") 310 var notDone = this._completed < this._size; 311 if( notDone ) 313 312 { 314 // Add the decimals if the percentage is an integer315 if ((this._percent_completed % 1) == 0) {316 this._percent_completed = this._percent_completed + '.00';317 }318 313 // Create the 'progress details' label 319 314 // Eg: '101 MB of 631 MB (16.02%) - 2 hr 30 min remaining' 320 315 progress_details = Math.formatBytes(this._completed) + ' of '; 321 316 progress_details += Math.formatBytes(this._size) + ' ('; 322 progress_details += this._percent_completed+ '%)';317 progress_details += Math.ratio( this._completed, this._size ) + '%)'; 323 318 if ((this._eta < 0 || this._eta >= Torrent._InfiniteTimeRemaining) && this.isActive()) { 324 319 progress_details += ' - remaining time unknown'; … … 332 327 root._progress_complete_container.addClass('torrent_progress_bar'); 333 328 root._progress_complete_container.addClass(class_name); 334 root._progress_complete_container.css('width', css_ percent_completed+ '%');329 root._progress_complete_container.css('width', css_completed_width + '%'); 335 330 336 331 // Update the 'incomplete' bar … … 339 334 root._progress_incomplete_container.addClass('torrent_progress_bar in_progress'); 340 335 } 341 root._progress_incomplete_container.css('width', (Torrent._MaxProgressBarWidth - css_ percent_completed) + '%');336 root._progress_incomplete_container.css('width', (Torrent._MaxProgressBarWidth - css_completed_width) + '%'); 342 337 root._progress_incomplete_container.show(); 343 338 … … 370 365 progress_details += Math.ratio(this._completed, this._size) + ')'; 371 366 372 // Hide the 'incomplete' bar367 // Hide the 'incomplete' bar 373 368 root._progress_incomplete_container.hide(); 374 369 375 370 // Set progress to maximum 376 371 root._progress_complete_container.css('width', Torrent._MaxProgressBarWidth + '%'); … … 503 498 break; 504 499 } 505 500 506 501 if( sortDirection == Prefs._SortDescending ) 507 502 torrents.reverse( ); 508 503 509 504 return torrents; 510 505 } branches/rpc/web/javascript/transmission.js
r396 r398 889 889 $(ti+'secure')[0].innerHTML = private_string; 890 890 $(ti+'creator_date')[0].innerHTML = date_created; 891 $(ti+'progress')[0].innerHTML = Math.ratio( total_completed , total_size ) + '% (' +892 Math.ratio( total_completed , total_size ) + '% Selected)';891 $(ti+'progress')[0].innerHTML = Math.ratio( total_completed * 100, total_size ) + '% (' + 892 Math.ratio( total_completed * 100, total_size ) + '% Selected)'; 893 893 }, 894 894
