Changeset 8504


Ignore:
Timestamp:
May 24, 2009, 12:02:43 AM (14 years ago)
Author:
charles
Message:

(trunk web) possibly fix bug seen by bmw

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/web/javascript/torrent.js

    r8503 r8504  
    646646                this._dirty = true;
    647647                this._torrent = file_data.torrent;
     648                this._index = file_data.index;
    648649                var pos = file_data.name.indexOf('/');
    649650                if (pos >= 0)
     
    654655
    655656                var li = document.createElement('li');
     657                li.classNameConst = 'inspector_torrent_file_list_entry ' + ((this._index%2)?'odd':'event');
     658                li.className = li.classNameConst;
    656659
    657660                var wanted_div = document.createElement('div');
     
    659662
    660663                var pri_div = document.createElement('div');
    661                 pri_div.className = "file_priority_control";
     664                pri_div.classNameConst = "file_priority_control";
     665                pri_div.className = pri_div.classNameConst;
    662666
    663667                var file_div = document.createElement('div');
     
    674678               
    675679                this._element = li;
    676                 this._priority_control = $(pri_div);
     680                this._priority_control = pri_div;
    677681                this._progress = $(prog_div);
    678682
    679683                $(wanted_div).bind('click', { file: this }, this.fileWantedControlClicked);
    680                 this._priority_control.bind('click', { file: this }, this.filePriorityControlClicked);
     684                $(pri_div).bind('click', { file: this }, this.filePriorityControlClicked);
    681685        },
    682686
     
    758762       
    759763        refreshWantedHTML: function() {
    760                 var element = this.element();
    761                 var c = element[0].className.replace(/ skip| complete/g, '').split(' ');
    762 
    763                 if(!this._wanted)
    764                         c.push('skip');
    765                 if(this._done>=this._size)
    766                         c.push('complete');
    767 
    768                 element[0].className = c.join(' ');
     764                var e = this.element()[0];
     765                var c = e.classNameConst;
     766                if(!this._wanted) c += ' skip';
     767                if(this._done>=this._size) c += ' complete';
     768                e.className = c;
    769769        },
    770770       
    771771        refreshPriorityHTML: function() {
    772                 var priority = { '1': 'high', '0': 'normal', '-1': 'low' }[new String(this._prio)];
    773                 var c = this._priority_control[0].className.replace(/ high| normal| low/g, '').split(' ');
    774 
    775                 c.push(priority)
    776                 this._priority_control[0].className = class.join(' ');
     772                var e = this._priority_control;
     773                var c = e.classNameConst;
     774                switch( this._prio ) {
     775                        case 1: c += ' high'; break;
     776                        case -1: c += ' low'; break;
     777                        default: c += ' normal'; break;
     778                }
     779                e.className = c;
    777780        },
    778781       
Note: See TracChangeset for help on using the changeset viewer.