From 9da95552f3750324d2a938cb0d9a413e188372e8 Mon Sep 17 00:00:00 2001 From: Damien Churchill Date: Mon, 20 Apr 2009 22:32:42 +0000 Subject: [PATCH] move the progressbar renderer helper method to deluge.js --- deluge/ui/web/js/deluge.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/deluge/ui/web/js/deluge.js b/deluge/ui/web/js/deluge.js index f46d74bc4..43832a9c5 100644 --- a/deluge/ui/web/js/deluge.js +++ b/deluge/ui/web/js/deluge.js @@ -26,6 +26,28 @@ var Deluge = { version: '1.2-dev' }; +(function() { + var tpl = '
' + + '
' + + '
' + + '
' + + '
{0}
' + + '
' + + '
' + + '
' + + '
{0}
' + + '
' + + '
' + + '
'; + + Deluge.progressBar = function(progress, width, text) { + var progressWidth = (width / 100.0) * progress; + var barWidth = progressWidth.toInt() - 1; + var textWidth = ((progressWidth.toInt() - 10) > 0 ? progressWidth.toInt() - 10 : 0); + return String.format(tpl, text, width, barWidth, textWidth); + } +})(); + Deluge.Events = { _events: new Hash(),