mirror of
https://github.com/transmission/transmission
synced 2025-02-02 12:32:54 +00:00
(trunk web) keep handles to each of the inspector's info tab's widgets, so we don't have to search for them every time
This commit is contained in:
parent
e6479e1e64
commit
353e76ea1e
1 changed files with 71 additions and 46 deletions
|
@ -87,6 +87,32 @@ Transmission.prototype =
|
|||
this._toolbar_delete_button = $('li#removedata')[0];
|
||||
this._context_pause_button = $('li#context_pause_selected')[0];
|
||||
this._context_start_button = $('li#context_resume_selected')[0];
|
||||
|
||||
var ti = '#torrent_inspector_';
|
||||
this._inspector = { };
|
||||
this._inspector._info_tab = { };
|
||||
this._inspector._info_tab.comment = $(ti+'comment')[0];
|
||||
this._inspector._info_tab.creator_date = $(ti+'creator_date')[0];
|
||||
this._inspector._info_tab.creator = $(ti+'creator')[0];
|
||||
this._inspector._info_tab.downloaded = $(ti+'downloaded')[0];
|
||||
this._inspector._info_tab.download_from = $(ti+'download_from')[0];
|
||||
this._inspector._info_tab.download_speed = $(ti+'download_speed')[0];
|
||||
this._inspector._info_tab.error = $(ti+'error')[0];
|
||||
this._inspector._info_tab.hash = $(ti+'hash')[0];
|
||||
this._inspector._info_tab.have = $(ti+'have')[0];
|
||||
this._inspector._info_tab.name = $(ti+'name')[0];
|
||||
this._inspector._info_tab.progress = $(ti+'progress')[0];
|
||||
this._inspector._info_tab.ratio = $(ti+'ratio')[0];
|
||||
this._inspector._info_tab.secure = $(ti+'secure')[0];
|
||||
this._inspector._info_tab.size = $(ti+'size')[0];
|
||||
this._inspector._info_tab.state = $(ti+'state')[0];
|
||||
this._inspector._info_tab.swarm_speed = $(ti+'swarm_speed')[0];
|
||||
this._inspector._info_tab.total_leechers = $(ti+'total_leechers')[0];
|
||||
this._inspector._info_tab.total_seeders = $(ti+'total_seeders')[0];
|
||||
this._inspector._info_tab.tracker = $(ti+'tracker')[0];
|
||||
this._inspector._info_tab.uploaded = $(ti+'uploaded')[0];
|
||||
this._inspector._info_tab.upload_speed = $(ti+'upload_speed')[0];
|
||||
this._inspector._info_tab.upload_to = $(ti+'upload_to')[0];
|
||||
|
||||
// Setup the preference box
|
||||
this.setupPrefConstraints();
|
||||
|
@ -901,34 +927,34 @@ Transmission.prototype =
|
|||
var total_upload_speed = 0;
|
||||
var total_verified = 0;
|
||||
var na = 'N/A';
|
||||
var tab = this._inspector._info_tab;
|
||||
|
||||
$("#torrent_inspector_size, .inspector_row div").css('color', '#222');
|
||||
|
||||
if( torrents.length == 0 )
|
||||
{
|
||||
var ti = '#torrent_inspector_';
|
||||
setInnerHTML( $(ti+'name')[0], 'No Selection' );
|
||||
setInnerHTML( $(ti+'size')[0], na );
|
||||
setInnerHTML( $(ti+'tracker')[0], na );
|
||||
setInnerHTML( $(ti+'hash')[0], na );
|
||||
setInnerHTML( $(ti+'state')[0], na );
|
||||
setInnerHTML( $(ti+'download_speed')[0], na );
|
||||
setInnerHTML( $(ti+'upload_speed')[0], na );
|
||||
setInnerHTML( $(ti+'uploaded')[0], na );
|
||||
setInnerHTML( $(ti+'downloaded')[0], na );
|
||||
setInnerHTML( $(ti+'ratio')[0], na );
|
||||
setInnerHTML( $(ti+'total_seeders')[0], na );
|
||||
setInnerHTML( $(ti+'total_leechers')[0], na );
|
||||
setInnerHTML( $(ti+'swarm_speed')[0], na );
|
||||
setInnerHTML( $(ti+'have')[0], na );
|
||||
setInnerHTML( $(ti+'upload_to')[0], na );
|
||||
setInnerHTML( $(ti+'download_from')[0], na );
|
||||
setInnerHTML( $(ti+'secure')[0], na );
|
||||
setInnerHTML( $(ti+'creator_date')[0], na );
|
||||
setInnerHTML( $(ti+'progress')[0], na );
|
||||
setInnerHTML( $(ti+'comment')[0], na );
|
||||
setInnerHTML( $(ti+'creator')[0], na );
|
||||
setInnerHTML( $(ti+'error')[0], na );
|
||||
setInnerHTML( tab.name, 'No Selection' );
|
||||
setInnerHTML( tab.size, na );
|
||||
setInnerHTML( tab.tracker, na );
|
||||
setInnerHTML( tab.hash, na );
|
||||
setInnerHTML( tab.state, na );
|
||||
setInnerHTML( tab.download_speed, na );
|
||||
setInnerHTML( tab.upload_speed, na );
|
||||
setInnerHTML( tab.uploaded, na );
|
||||
setInnerHTML( tab.downloaded, na );
|
||||
setInnerHTML( tab.ratio, na );
|
||||
setInnerHTML( tab.total_seeders, na );
|
||||
setInnerHTML( tab.total_leechers, na );
|
||||
setInnerHTML( tab.swarm_speed, na );
|
||||
setInnerHTML( tab.have, na );
|
||||
setInnerHTML( tab.upload_to, na );
|
||||
setInnerHTML( tab.download_from, na );
|
||||
setInnerHTML( tab.secure, na );
|
||||
setInnerHTML( tab.creator_date, na );
|
||||
setInnerHTML( tab.progress, na );
|
||||
setInnerHTML( tab.comment, na );
|
||||
setInnerHTML( tab.creator, na );
|
||||
setInnerHTML( tab.error, na );
|
||||
this.updateVisibleFileLists();
|
||||
$("#torrent_inspector_size, .inspector_row > div:contains('N/A')").css('color', '#666');
|
||||
return;
|
||||
|
@ -992,29 +1018,28 @@ Transmission.prototype =
|
|||
else if( have_private ) private_string = 'Private Torrent';
|
||||
else if( have_public ) private_string = 'Public Torrent';
|
||||
|
||||
var ti = '#torrent_inspector_';
|
||||
setInnerHTML( $(ti+'name')[0], name );
|
||||
setInnerHTML( $(ti+'size')[0], torrents.length ? Math.formatBytes( total_size ) : 'N/A' );
|
||||
setInnerHTML( $(ti+'tracker')[0], total_tracker.replace(/\//g, '/​') );
|
||||
setInnerHTML( $(ti+'hash')[0], hash );
|
||||
setInnerHTML( $(ti+'state')[0], total_state );
|
||||
setInnerHTML( $(ti+'download_speed')[0], torrents.length ? Math.formatBytes( total_download_speed ) + '/s' : 'N/A' );
|
||||
setInnerHTML( $(ti+'upload_speed')[0], torrents.length ? Math.formatBytes( total_upload_speed ) + '/s' : 'N/A' );
|
||||
setInnerHTML( $(ti+'uploaded')[0], torrents.length ? Math.formatBytes( total_upload ) : 'N/A' );
|
||||
setInnerHTML( $(ti+'downloaded')[0], torrents.length ? Math.formatBytes( total_download ) : 'N/A' );
|
||||
setInnerHTML( $(ti+'ratio')[0], torrents.length ? Math.ratio( total_upload, total_download ) : 'N/A' );
|
||||
setInnerHTML( $(ti+'total_seeders')[0], torrents.length ? total_seeders : 'N/A' );
|
||||
setInnerHTML( $(ti+'total_leechers')[0], torrents.length ? total_leechers : 'N/A' );
|
||||
setInnerHTML( $(ti+'swarm_speed')[0], torrents.length ? Math.formatBytes(total_swarm_speed) + '/s' : 'N/A' );
|
||||
setInnerHTML( $(ti+'have')[0], torrents.length ? Math.formatBytes(total_completed) + ' (' + Math.formatBytes(total_verified) + ' verified)' : 'N/A' );
|
||||
setInnerHTML( $(ti+'upload_to')[0], torrents.length ? total_upload_peers : 'N/A' );
|
||||
setInnerHTML( $(ti+'download_from')[0], torrents.length ? total_download_peers : 'N/A' );
|
||||
setInnerHTML( $(ti+'secure')[0], private_string );
|
||||
setInnerHTML( $(ti+'creator_date')[0], date_created );
|
||||
setInnerHTML( $(ti+'progress')[0], torrents.length ? Math.ratio( sizeDone*100, sizeWhenDone ) + '%' : 'N/A' );
|
||||
setInnerHTML( $(ti+'comment')[0], comment.replace(/\//g, '/​') );
|
||||
setInnerHTML( $(ti+'creator')[0], creator );
|
||||
setInnerHTML( $(ti+'error')[0], error );
|
||||
setInnerHTML( tab.name, name );
|
||||
setInnerHTML( tab.size, torrents.length ? Math.formatBytes( total_size ) : na );
|
||||
setInnerHTML( tab.tracker, total_tracker.replace(/\//g, '/​') );
|
||||
setInnerHTML( tab.hash, hash );
|
||||
setInnerHTML( tab.state, total_state );
|
||||
setInnerHTML( tab.download_speed, torrents.length ? Math.formatBytes( total_download_speed ) + '/s' : na );
|
||||
setInnerHTML( tab.upload_speed, torrents.length ? Math.formatBytes( total_upload_speed ) + '/s' : na );
|
||||
setInnerHTML( tab.uploaded, torrents.length ? Math.formatBytes( total_upload ) : na );
|
||||
setInnerHTML( tab.downloaded, torrents.length ? Math.formatBytes( total_download ) : na );
|
||||
setInnerHTML( tab.ratio, torrents.length ? Math.ratio( total_upload, total_download ) : na );
|
||||
setInnerHTML( tab.total_seeders, torrents.length ? total_seeders : na );
|
||||
setInnerHTML( tab.total_leechers, torrents.length ? total_leechers : na );
|
||||
setInnerHTML( tab.swarm_speed, torrents.length ? Math.formatBytes(total_swarm_speed) + '/s' : na );
|
||||
setInnerHTML( tab.have, torrents.length ? Math.formatBytes(total_completed) + ' (' + Math.formatBytes(total_verified) + ' verified)' : na );
|
||||
setInnerHTML( tab.upload_to, torrents.length ? total_upload_peers : na );
|
||||
setInnerHTML( tab.download_from, torrents.length ? total_download_peers : na );
|
||||
setInnerHTML( tab.secure, private_string );
|
||||
setInnerHTML( tab.creator_date, date_created );
|
||||
setInnerHTML( tab.progress, torrents.length ? Math.ratio( sizeDone*100, sizeWhenDone ) + '%' : na );
|
||||
setInnerHTML( tab.comment, comment.replace(/\//g, '/​') );
|
||||
setInnerHTML( tab.creator, creator );
|
||||
setInnerHTML( tab.error, error );
|
||||
|
||||
$(".inspector_row > div:contains('N/A')").css('color', '#666');
|
||||
this.updateVisibleFileLists();
|
||||
|
|
Loading…
Reference in a new issue