mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 20:35:36 +00:00
(trunk web) Add a trackers tab patch from mjpieters, with minor style changes
This commit is contained in:
@@ -75,6 +75,7 @@ Transmission.prototype =
|
||||
|
||||
this._torrent_list = $('#torrent_list')[0];
|
||||
this._inspector_file_list = $('#inspector_file_list')[0];
|
||||
this._inspector_trackers_list = $('#inspector_trackers_list')[0];
|
||||
this._inspector_tab_files = $('#inspector_tab_files')[0];
|
||||
this._toolbar_buttons = $('#torrent_global_menu ul li');
|
||||
this._toolbar_pause_button = $('li#pause_selected')[0];
|
||||
@@ -682,6 +683,7 @@ Transmission.prototype =
|
||||
this.hideiPhoneAddressbar();
|
||||
|
||||
this.updateVisibleFileLists();
|
||||
this.updateTrackersLists();
|
||||
},
|
||||
|
||||
fileWantedClicked: function(event, element){
|
||||
@@ -1085,6 +1087,7 @@ Transmission.prototype =
|
||||
setInnerHTML( tab.download_dir, na );
|
||||
setInnerHTML( tab.error, na );
|
||||
this.updateVisibleFileLists();
|
||||
this.updateTrackersLists();
|
||||
$("#torrent_inspector_size, .inspector_row > div:contains('N/A')").css('color', '#666');
|
||||
return;
|
||||
}
|
||||
@@ -1159,6 +1162,7 @@ Transmission.prototype =
|
||||
setInnerHTML( tab.download_dir, download_dir == na ? download_dir : download_dir.replace(/([\/_\.])/g, "$1​") );
|
||||
setInnerHTML( tab.error, error );
|
||||
|
||||
this.updateTrackersLists();
|
||||
$(".inspector_row > div:contains('N/A')").css('color', '#666');
|
||||
this.updateVisibleFileLists();
|
||||
},
|
||||
@@ -1183,6 +1187,31 @@ Transmission.prototype =
|
||||
}
|
||||
},
|
||||
|
||||
updateTrackersLists: function() {
|
||||
// By building up the HTML as as string, then have the browser
|
||||
// turn this into a DOM tree, this is a fast operation.
|
||||
var html = '';
|
||||
var na = 'N/A';
|
||||
var torrents = this.getSelectedTorrents( );
|
||||
if( $(this._inspector_trackers_list).is(':visible') && torrents.length == 1 ) {
|
||||
for( var i=0, tier; tier=torrents[0]._trackerStats[i]; ++i ) {
|
||||
html += '<div class="inspector_group"><div class="inspector_group_label">';
|
||||
html += 'Tier ' + (i + 1) + '</div><ul class="tier_list">';
|
||||
for( var j=0, tracker; tracker=tier[j]; ++j ) {
|
||||
var parity = ((j+1) % 2 == 0 ? 'even' : 'odd');
|
||||
html += '<li class="inspector_tracker_entry ' + parity + '"><div class="tracker_host">'
|
||||
html += tracker.host + '</div><table class="tracker_stats">';
|
||||
html += '<tr><th>Seeders:</th><td>' + (tracker.seederCount > -1 ? tracker.seederCount : na) + '</td></tr>';
|
||||
html += '<tr><th>Leechers:</th><td>' + (tracker.leecherCount > -1 ? tracker.leecherCount : na) + '</td></tr>';
|
||||
html += '<tr><th>Downloads:</th><td>' + (tracker.downloadCount > -1 ? tracker.downloadCount : na)+ '</td></tr>';
|
||||
html += '</table></li>';
|
||||
}
|
||||
html += '</ul></div>';
|
||||
}
|
||||
}
|
||||
setInnerHTML(this._inspector_trackers_list, html);
|
||||
},
|
||||
|
||||
/*
|
||||
* Toggle the visibility of the inspector (used by the context menu)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user