mirror of
https://github.com/transmission/transmission
synced 2025-03-12 23:23:54 +00:00
(trunk web) Add a trackers tab patch from mjpieters, with minor style changes
This commit is contained in:
parent
dcbb1ee872
commit
56466319f5
7 changed files with 149 additions and 3 deletions
|
@ -7,6 +7,7 @@ dist_data_DATA = \
|
|||
info_activity.png \
|
||||
info_files.png \
|
||||
info_general.png \
|
||||
info_trackers.png \
|
||||
tab_backgrounds.png \
|
||||
toolbar_buttons.png \
|
||||
torrent_buttons.png
|
||||
|
|
BIN
web/images/buttons/info_trackers.png
Normal file
BIN
web/images/buttons/info_trackers.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 782 B |
|
@ -68,6 +68,7 @@
|
|||
<div id="inspector_tabs">
|
||||
<div class="inspector_tab selected" id="inspector_tab_info"><a href="#info"><img src="images/buttons/info_general.png" alt="Information"/></a></div>
|
||||
<div class="inspector_tab" id="inspector_tab_activity"><a href="#activity"><img src="images/buttons/info_activity.png" alt="Activity"/></a></div>
|
||||
<div class="inspector_tab" id="inspector_tab_trackers"><a href="#trackers"><img src="images/buttons/info_trackers.png" alt="Trackers"/></a></div>
|
||||
<div class="inspector_tab" id="inspector_tab_files"><a href="#files"><img src="images/buttons/info_files.png" alt="Files"/></a></div>
|
||||
</div>
|
||||
|
||||
|
@ -173,6 +174,11 @@
|
|||
</div><!-- class="inspector_group"-->
|
||||
</div><!-- id="inspector_tab_activity_container" -->
|
||||
|
||||
<div style="display:none;" class="inspector_container" id="inspector_tab_trackers_container">
|
||||
<div id="inspector_trackers_list">
|
||||
</div>
|
||||
</div><!-- id="inspector_tab_trackers_container" -->
|
||||
|
||||
<div style="display:none;" class="inspector_container" id="inspector_tab_files_container">
|
||||
<div id="inspector_file_list">
|
||||
<ul id="select_all_button_container">
|
||||
|
|
|
@ -32,7 +32,7 @@ Torrent._StaticFields = [ 'addedDate', 'comment', 'creator', 'dateCreated',
|
|||
Torrent._DynamicFields = [ 'downloadedEver', 'error', 'errorString', 'eta',
|
||||
'haveUnchecked', 'haveValid', 'leftUntilDone', 'metadataPercentComplete', 'peersConnected',
|
||||
'peersGettingFromUs', 'peersSendingToUs', 'rateDownload', 'rateUpload',
|
||||
'recheckProgress', 'sizeWhenDone', 'status',
|
||||
'recheckProgress', 'sizeWhenDone', 'status', 'trackerStats',
|
||||
'uploadedEver', 'uploadRatio', 'seedRatioLimit', 'seedRatioMode', 'downloadDir' ]
|
||||
|
||||
Torrent.prototype =
|
||||
|
@ -54,6 +54,7 @@ Torrent.prototype =
|
|||
this._sizeWhenDone = data.sizeWhenDone;
|
||||
this._name = data.name;
|
||||
this._name_lc = this._name.toLowerCase( );
|
||||
this._trackerStats = this.buildTrackerStats(data.trackerStats);
|
||||
this._file_model = [ ];
|
||||
this._file_view = [ ];
|
||||
|
||||
|
@ -152,6 +153,21 @@ Torrent.prototype =
|
|||
return $(this._fileList);
|
||||
},
|
||||
|
||||
buildTrackerStats: function(trackerStats) {
|
||||
result = [];
|
||||
for( var i=0, tracker; tracker=trackerStats[i]; ++i ) {
|
||||
tier = result[tracker.tier - 1] || [];
|
||||
tier[tier.length] = {
|
||||
'host': tracker.host,
|
||||
'seederCount': tracker.seederCount,
|
||||
'leecherCount': tracker.leecherCount,
|
||||
'downloadCount': tracker.downloadCount
|
||||
};
|
||||
result[tracker.tier - 1] = tier;
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
/*--------------------------------------------
|
||||
*
|
||||
* S E T T E R S / G E T T E R S
|
||||
|
@ -207,6 +223,7 @@ Torrent.prototype =
|
|||
default: return 'error';
|
||||
}
|
||||
},
|
||||
trackerStats: function() { return this._trackerStats; },
|
||||
uploadSpeed: function() { return this._upload_speed; },
|
||||
uploadTotal: function() { return this._upload_total; },
|
||||
showFileList: function() {
|
||||
|
@ -333,6 +350,7 @@ Torrent.prototype =
|
|||
this._error = data.error;
|
||||
this._error_string = data.errorString;
|
||||
this._eta = data.eta;
|
||||
this._trackerStats = this.buildTrackerStats(data.trackerStats);
|
||||
this._state = data.status;
|
||||
this._download_dir = data.downloadDir;
|
||||
this._metadataPercentComplete = data.metadataPercentComplete;
|
||||
|
|
|
@ -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)
|
||||
*/
|
||||
|
|
|
@ -549,7 +549,7 @@ div#inspector_header {
|
|||
padding-right: 10px;
|
||||
}
|
||||
div#inspector_tabs {
|
||||
width: 189px;
|
||||
width: 243px;
|
||||
margin: 0 auto;
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
@ -593,6 +593,54 @@ div#inspector_tabs {
|
|||
width: 230px; /* inspector_container_width==330 - inspector_label_width==100 */
|
||||
}
|
||||
|
||||
/* Trackers Inspector Tab */
|
||||
#inspector_trackers_list {
|
||||
padding: 0 0 0 0;
|
||||
margin: 0 0 0 0;
|
||||
text-align: left;
|
||||
cursor: default;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#inspector_trackers_list > div.inspector_group {
|
||||
padding-bottom: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
ul.tier_list {
|
||||
width: 100%;
|
||||
margin: 10px 0 0 0;
|
||||
padding-left: 0px;
|
||||
text-align: left;
|
||||
display: block;
|
||||
cursor: default;
|
||||
list-style-type: none;
|
||||
list-style: none;
|
||||
list-style-image: none;
|
||||
clear: both;
|
||||
}
|
||||
.tier_list table{
|
||||
margin-left: 15px;
|
||||
color: #666;
|
||||
}
|
||||
.tier_list th{
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
li.inspector_tracker_entry {
|
||||
padding: 3px 0 3px 2px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
li.inspector_tracker_entry.odd {
|
||||
background-color: #EEEEEE;
|
||||
}
|
||||
div.tracker_host {
|
||||
font-size: 1.2em;
|
||||
font-weight: bold;
|
||||
color: #222;
|
||||
}
|
||||
|
||||
/* Files Inspector Tab */
|
||||
#inspector_file_list {
|
||||
padding: 0 0 0 0;
|
||||
|
|
|
@ -590,7 +590,7 @@ div#inspector_header {
|
|||
padding-right: 10px;
|
||||
}
|
||||
div#inspector_tabs {
|
||||
width: 189px;
|
||||
width: 243px;
|
||||
margin: 0 auto;
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
@ -634,6 +634,50 @@ div#inspector_tabs {
|
|||
width: 230px; /* inspector_container_width==330 - inspector_label_width==100 */
|
||||
}
|
||||
|
||||
/* Trackers Inspector Tab */
|
||||
#inspector_trackers_list {
|
||||
padding: 0 0 0 0;
|
||||
margin: 0 0 0 0;
|
||||
text-align: left;
|
||||
cursor: default;
|
||||
overflow: hidden;
|
||||
}
|
||||
#inspector_trackers_list > div.inspector_group {
|
||||
padding-bottom: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
ul.tier_list {
|
||||
width: 100%;
|
||||
margin: 10px 0 0 0;
|
||||
padding-left: 0px;
|
||||
text-align: left;
|
||||
display: block;
|
||||
cursor: default;
|
||||
list-style-type: none;
|
||||
list-style: none;
|
||||
list-style-image: none;
|
||||
clear: both;
|
||||
}
|
||||
.tier_list table{
|
||||
margin-left: 15px;
|
||||
color: #666;
|
||||
}
|
||||
.tier_list th{
|
||||
text-align: right;
|
||||
}
|
||||
li.inspector_tracker_entry {
|
||||
padding: 3px 0 3px 2px;
|
||||
display: block;
|
||||
}
|
||||
li.inspector_tracker_entry.odd {
|
||||
background-color: #EEEEEE;
|
||||
}
|
||||
div.tracker_host {
|
||||
font-size: 1.2em;
|
||||
font-weight: bold;
|
||||
color: #222;
|
||||
}
|
||||
|
||||
/* Files Inspector Tab */
|
||||
#inspector_file_list {
|
||||
padding: 0 0 0 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue