From: Mike Taylor Date: Thu, 22 May 2014 16:13:22 +0000 (+0100) Subject: Add Progress widget (progress-meter) X-Git-Tag: 1.0.0~604 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=db46e4d678127a9c80ee5b329ad447c1c522195d;p=mkws-moved-to-github.git Add Progress widget (progress-meter) Fixes bug MKWS-195 ("Progress-bar widget"). --- diff --git a/src/mkws-widget-main.js b/src/mkws-widget-main.js index 9271602..07243e7 100644 --- a/src/mkws-widget-main.js +++ b/src/mkws-widget-main.js @@ -420,6 +420,26 @@ mkws.registerWidgetType('Config', function() { }); +mkws.registerWidgetType('Progress', function() { + var that = this; + + this.node.hide(); + this.team.queue("stat").subscribe(function(data) { + var s = ''; + for (var i = 0; i < data.clients; i++) { + if (i == data.clients - data.activeclients) { + s += ''; + s += ''; + } + s += '█'; + } + s += ''; + that.node.html(s); + that.node.show(); + }); +}); + + // Some elements have mkws* classes that makes them appear as widgets // -- for example, because we want to style them using CSS -- but have // no actual functionality. We register these to prevent ignorable