(trunk web) possibly fix bug seen by bmw
This commit is contained in:
parent
f1afe16889
commit
f357fc013c
|
@ -645,6 +645,7 @@ TorrentFile.prototype = {
|
||||||
//console.log( 'new TorrentFile ' + file_data.name );
|
//console.log( 'new TorrentFile ' + file_data.name );
|
||||||
this._dirty = true;
|
this._dirty = true;
|
||||||
this._torrent = file_data.torrent;
|
this._torrent = file_data.torrent;
|
||||||
|
this._index = file_data.index;
|
||||||
var pos = file_data.name.indexOf('/');
|
var pos = file_data.name.indexOf('/');
|
||||||
if (pos >= 0)
|
if (pos >= 0)
|
||||||
this.name = file_data.name.substring(pos + 1);
|
this.name = file_data.name.substring(pos + 1);
|
||||||
|
@ -653,12 +654,15 @@ TorrentFile.prototype = {
|
||||||
this.readAttributes(file_data);
|
this.readAttributes(file_data);
|
||||||
|
|
||||||
var li = document.createElement('li');
|
var li = document.createElement('li');
|
||||||
|
li.classNameConst = 'inspector_torrent_file_list_entry ' + ((this._index%2)?'odd':'event');
|
||||||
|
li.className = li.classNameConst;
|
||||||
|
|
||||||
var wanted_div = document.createElement('div');
|
var wanted_div = document.createElement('div');
|
||||||
wanted_div.className = "file_wanted_control";
|
wanted_div.className = "file_wanted_control";
|
||||||
|
|
||||||
var pri_div = document.createElement('div');
|
var pri_div = document.createElement('div');
|
||||||
pri_div.className = "file_priority_control";
|
pri_div.classNameConst = "file_priority_control";
|
||||||
|
pri_div.className = pri_div.classNameConst;
|
||||||
|
|
||||||
var file_div = document.createElement('div');
|
var file_div = document.createElement('div');
|
||||||
file_div.className = "inspector_torrent_file_list_entry_name";
|
file_div.className = "inspector_torrent_file_list_entry_name";
|
||||||
|
@ -673,11 +677,11 @@ TorrentFile.prototype = {
|
||||||
li.appendChild(prog_div);
|
li.appendChild(prog_div);
|
||||||
|
|
||||||
this._element = li;
|
this._element = li;
|
||||||
this._priority_control = $(pri_div);
|
this._priority_control = pri_div;
|
||||||
this._progress = $(prog_div);
|
this._progress = $(prog_div);
|
||||||
|
|
||||||
$(wanted_div).bind('click', { file: this }, this.fileWantedControlClicked);
|
$(wanted_div).bind('click', { file: this }, this.fileWantedControlClicked);
|
||||||
this._priority_control.bind('click', { file: this }, this.filePriorityControlClicked);
|
$(pri_div).bind('click', { file: this }, this.filePriorityControlClicked);
|
||||||
},
|
},
|
||||||
|
|
||||||
update: function(file_data) {
|
update: function(file_data) {
|
||||||
|
@ -757,23 +761,22 @@ TorrentFile.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
refreshWantedHTML: function() {
|
refreshWantedHTML: function() {
|
||||||
var element = this.element();
|
var e = this.element()[0];
|
||||||
var c = element[0].className.replace(/ skip| complete/g, '').split(' ');
|
var c = e.classNameConst;
|
||||||
|
if(!this._wanted) c += ' skip';
|
||||||
if(!this._wanted)
|
if(this._done>=this._size) c += ' complete';
|
||||||
c.push('skip');
|
e.className = c;
|
||||||
if(this._done>=this._size)
|
|
||||||
c.push('complete');
|
|
||||||
|
|
||||||
element[0].className = c.join(' ');
|
|
||||||
},
|
},
|
||||||
|
|
||||||
refreshPriorityHTML: function() {
|
refreshPriorityHTML: function() {
|
||||||
var priority = { '1': 'high', '0': 'normal', '-1': 'low' }[new String(this._prio)];
|
var e = this._priority_control;
|
||||||
var c = this._priority_control[0].className.replace(/ high| normal| low/g, '').split(' ');
|
var c = e.classNameConst;
|
||||||
|
switch( this._prio ) {
|
||||||
c.push(priority)
|
case 1: c += ' high'; break;
|
||||||
this._priority_control[0].className = class.join(' ');
|
case -1: c += ' low'; break;
|
||||||
|
default: c += ' normal'; break;
|
||||||
|
}
|
||||||
|
e.className = c;
|
||||||
},
|
},
|
||||||
|
|
||||||
fileWantedControlClicked: function(event) {
|
fileWantedControlClicked: function(event) {
|
||||||
|
|
Loading…
Reference in New Issue