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 = '
';
+
+ 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(),