From 8949fbb01cf0414bc77376f1549bbb04a65fa1e2 Mon Sep 17 00:00:00 2001 From: Jordan Lee Date: Fri, 26 Aug 2011 23:30:07 +0000 Subject: [PATCH] (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. --- web/javascript/torrent-row.js | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/web/javascript/torrent-row.js b/web/javascript/torrent-row.js index e5abcd4c7..7c8238c83 100644 --- a/web/javascript/torrent-row.js +++ b/web/javascript/torrent-row.js @@ -64,17 +64,30 @@ TorrentRendererHelper.createProgressbar = function(classes) TorrentRendererHelper.renderProgressbar = function(controller, t, progressbar) { - var info = TorrentRendererHelper.getProgressInfo(controller, t); var e; + var display; + var info = TorrentRendererHelper.getProgressInfo(controller, t); + + // update the complete progressbar e = progressbar.complete; - e.style.width = '' + info.percent + "%"; - if (e.className !== info.complete) - e.className = info.complete; - e.style.display = info.percent<=0 ? 'none' : 'block'; + if (info.percent > 0) { + display = 'block'; + e.style.width = '' + info.percent + '%'; + } else { + display = 'none'; + } + if (e.style.display !== display) + e.style.display = display; + if (e.style.className !== info.complete) + e.style.className = info.complete; + + // update the incomplete progressbar e = progressbar.incomplete; - if (e.className !== info.incomplete) - e.className = info.incomplete; - e.style.display = info.percent>=100 ? 'none' : 'block'; + display = (info.percent < 100) ? 'block' : 'none'; + if (e.style.display !== display) + e.style.display = display; + if (e.style.className !== info.incomplete) + e.style.className = info.incomplete; }; TorrentRendererHelper.formatUL = function(t)