Changeset 12764


Ignore:
Timestamp:
Aug 26, 2011, 11:30:07 PM (10 years ago)
Author:
jordan
Message:

(trunk web) Stop poking the torrent-row's progressbar's style.display fields unless the new value differs from the old. It's probably browser-dependent on whether or not this speeds anything up, but FF seems to like it.

File:
1 edited

Legend:

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

    r12747 r12764  
    6565TorrentRendererHelper.renderProgressbar = function(controller, t, progressbar)
    6666{
     67        var e;
     68        var display;
    6769        var info = TorrentRendererHelper.getProgressInfo(controller, t);
    68         var e;
     70
     71        // update the complete progressbar
    6972        e = progressbar.complete;
    70         e.style.width = '' + info.percent + "%";
    71         if (e.className !== info.complete)
    72                 e.className = info.complete;
    73         e.style.display = info.percent<=0 ? 'none' : 'block';
     73        if (info.percent > 0) {
     74                display = 'block';
     75                e.style.width = '' + info.percent + '%';
     76        } else {
     77                display = 'none';
     78        }
     79        if (e.style.display !== display)
     80                e.style.display = display;
     81        if (e.style.className !== info.complete)
     82                e.style.className = info.complete;
     83
     84        // update the incomplete progressbar
    7485        e = progressbar.incomplete;
    75         if (e.className !== info.incomplete)
    76                 e.className = info.incomplete;
    77         e.style.display = info.percent>=100 ? 'none' : 'block';
     86        display = (info.percent < 100) ? 'block' : 'none';
     87        if (e.style.display !== display)
     88                e.style.display = display;
     89        if (e.style.className !== info.incomplete)
     90                e.style.className = info.incomplete;
    7891};
    7992
Note: See TracChangeset for help on using the changeset viewer.