From 2220a40e84df39220092c3c4a4fff1ae3fbbf0a9 Mon Sep 17 00:00:00 2001 From: Kevin Glowacz Date: Tue, 28 Jul 2009 04:52:59 +0000 Subject: [PATCH] (trunk web) progress bar shows seeding progress --- web/images/progress/progress.png | Bin 245 -> 274 bytes web/javascript/torrent.js | 40 +++++++++++++++++++++---------- web/stylesheets/common.css | 10 ++++++++ 3 files changed, 38 insertions(+), 12 deletions(-) diff --git a/web/images/progress/progress.png b/web/images/progress/progress.png index 77c724ebb5deb8535ccbe921089ab7637b8632e5..393a0c3a119134bcda28f214a24f7341fca8741d 100644 GIT binary patch delta 223 zcmV<503iSM0g?ic7YZ^60ssI2(;jSbks&C5v`IukRCwCNmdgzSF%U!ZCkhSF4s=5` zG{J>J(#t9YPm=B4HaV=Vm&3*fIc!g7 zz_tTyhwB~LGm@~eNXiO<`~Cq|ZSky002ovPDHLkV1jjuVs-!k delta 194 zcmV;z06qVb0`&oq7YZl{0ssI2aZ^oGd9kfErG|+J4#yaEY(D}F0PN8|BxcDE8~^|S07*qoM6N<$f&<@Dc>n+a diff --git a/web/javascript/torrent.js b/web/javascript/torrent.js index 51e215cde..dbca73553 100644 --- a/web/javascript/torrent.js +++ b/web/javascript/torrent.js @@ -451,12 +451,6 @@ Torrent.prototype = } else { - // Update the 'in progress' bar - e = root._progress_complete_container; - c = 'torrent_progress_bar'; - c += (this.isActive()) ? ' complete' : ' complete_stopped'; - e.className = c; - // Create the 'progress details' label // Eg: '698.05 MB, uploaded 8.59 GB (Ratio: 12.3)' c = Math.formatBytes( this._size ); @@ -466,12 +460,34 @@ Torrent.prototype = c += Math.round(this._upload_ratio*100)/100; c += ')'; progress_details = c; - - // Hide the 'incomplete' bar - root._progress_incomplete_container.style.display = 'none'; - - // Set progress to maximum - root._progress_complete_container.style.width = MaxBarWidth + '%'; + + var status = this.isActive() ? 'complete' : 'complete_stopped'; + + if(this.isActive() && this.seedRatio() > 0){ + status = 'complete seeding' + var seedRatioRatio = this._upload_ratio / this.seedRatio(); + var seedRatioPercent = Math.round( seedRatioRatio * 100 * MaxBarWidth ) / 100; + + root._progress_incomplete_container.className = 'torrent_progress_bar incomplete seeding' + root._progress_incomplete_container.style.display = 'block'; + root._progress_incomplete_container.style.width = seedRatioPercent + '%'; + + // Set progress to maximum + root._progress_complete_container.style.width = MaxBarWidth - seedRatioPercent + '%'; + } + else + { + // Hide the 'incomplete' bar + root._progress_incomplete_container.className = 'torrent_progress_bar incomplete' + root._progress_incomplete_container.style.display = 'none'; + + // Set progress to maximum + root._progress_complete_container.style.width = MaxBarWidth + '%'; + } + + // Update the 'in progress' bar + e = root._progress_complete_container; + e.className = 'torrent_progress_bar ' + status; } // Update the progress details diff --git a/web/stylesheets/common.css b/web/stylesheets/common.css index 225780034..862c13e0a 100644 --- a/web/stylesheets/common.css +++ b/web/stylesheets/common.css @@ -427,6 +427,11 @@ ul.torrent_list li.torrent div.torrent_progress_bar.complete { background-position: left -10px; border: 1px solid #29AD35; } +ul.torrent_list li.torrent div.torrent_progress_bar.complete.seeding { + background-position: left -40px; + border: 1px solid #269e30; + border-right: none; +} ul.torrent_list li.torrent div.torrent_progress_bar.in_progress { background-position: left 0px; @@ -441,6 +446,11 @@ ul.torrent_list li.torrent div.torrent_progress_bar.incomplete { border-left: none; } +ul.torrent_list li.torrent div.torrent_progress_bar.incomplete.seeding { + background-position: left -10px; + border: 1px solid #29AD35; +} + ul.torrent_list li.torrent div.torrent_progress_bar.incomplete_stopped { background-position: left -30px; border: 1px solid #939393;