Changeset 8498


Ignore:
Timestamp:
May 23, 2009, 7:02:47 PM (14 years ago)
Author:
kjg
Message:

(trunk web) speed up file refreshHTML

File:
1 edited

Legend:

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

    r8494 r8498  
    754754        refreshWantedHTML: function() {
    755755                var element = this.element();
    756                 this.element().toggleClass('skip', !this._wanted);
    757                 this.element().toggleClass('complete', this._done>=this._size );
     756                var class = element[0].className.replace(/ skip| complete/g, '').split(' ');
     757
     758                if(!this._wanted)
     759                        class.push('skip');
     760                if(this._done>=this._size)
     761                        class.push('complete');
     762
     763                element[0].className = class.join(' ');
    758764        },
    759765       
    760766        refreshPriorityHTML: function() {
    761767                var priority = { '1': 'high', '0': 'normal', '-1': 'low' }[new String(this._prio)];
    762                 var off_priorities = [ 'high', 'normal', 'low' ].sort(function(a,b) { return (a == priority) ? 1 : -1; } );
    763                 this._priority_control.addClass(priority).
    764                         removeClass(off_priorities[0]).
    765                         removeClass(off_priorities[1]);
     768                var class = this._priority_control[0].className.replace(/ high| normal| low/g, '').split(' ');
     769
     770                class.push(priority)
     771                this._priority_control[0].className = class.join(' ');
    766772        },
    767773       
Note: See TracChangeset for help on using the changeset viewer.