diff --git a/htdocs/index.html b/htdocs/index.html
index 9f899ae..1290402 100644
--- a/htdocs/index.html
+++ b/htdocs/index.html
@@ -134,12 +134,12 @@
diff --git a/htdocs/lib/ProgressBar.js b/htdocs/lib/ProgressBar.js
index 0019dc6..59d3a91 100644
--- a/htdocs/lib/ProgressBar.js
+++ b/htdocs/lib/ProgressBar.js
@@ -1,10 +1,15 @@
ProgressBar = function(el) {
this.$el = $(el);
- this.$innerText = this.$el.find('.openwebrx-progressbar-text');
- this.$innerBar = this.$el.find('.openwebrx-progressbar-bar');
+ this.$innerText = $('
' + this.getDefaultText() + '');
+ this.$innerBar = $('
');
+ this.$el.empty().append(this.$innerText, this.$innerBar);
this.$innerBar.css('width', '0%');
};
+ProgressBar.prototype.getDefaultText = function() {
+ return '';
+}
+
ProgressBar.prototype.set = function(val, text, over) {
this.setValue(val);
this.setText(text);
@@ -31,6 +36,10 @@ AudioBufferProgressBar = function(el) {
AudioBufferProgressBar.prototype = new ProgressBar();
+AudioBufferProgressBar.prototype.getDefaultText = function() {
+ return 'Audio buffer [0 ms]';
+};
+
AudioBufferProgressBar.prototype.setSampleRate = function(sampleRate) {
this.sampleRate = sampleRate;
};
@@ -56,6 +65,10 @@ NetworkSpeedProgressBar = function(el) {
NetworkSpeedProgressBar.prototype = new ProgressBar();
+NetworkSpeedProgressBar.prototype.getDefaultText = function() {
+ return 'Network usage [0 kbps]';
+};
+
NetworkSpeedProgressBar.prototype.setSpeed = function(speed) {
var speedInKilobits = speed * 8 / 1000;
this.set(speedInKilobits / 2000, "Network usage [" + speedInKilobits.toFixed(1) + " kbps]", false);
@@ -67,6 +80,10 @@ AudioSpeedProgressBar = function(el) {
AudioSpeedProgressBar.prototype = new ProgressBar();
+AudioSpeedProgressBar.prototype.getDefaultText = function() {
+ return 'Audio stream [0 kbps]';
+};
+
AudioSpeedProgressBar.prototype.setSpeed = function(speed) {
this.set(speed / 500000, "Audio stream [" + (speed / 1000).toFixed(0) + " kbps]", false);
};
@@ -77,6 +94,10 @@ AudioOutputProgressBar = function(el, sampleRate) {
AudioOutputProgressBar.prototype = new ProgressBar();
+AudioOutputProgressBar.prototype.getDefaultText = function() {
+ return 'Audio output [0 sps]';
+};
+
AudioOutputProgressBar.prototype.setSampleRate = function(sampleRate) {
this.maxRate = sampleRate * 1.25;
this.minRate = sampleRate * .25;
@@ -94,6 +115,10 @@ ClientsProgressBar = function(el) {
ClientsProgressBar.prototype = new ProgressBar();
+ClientsProgressBar.prototype.getDefaultText = function() {
+ return 'Clients [1]';
+};
+
ClientsProgressBar.prototype.setClients = function(clients) {
this.clients = clients;
this.render();
@@ -114,6 +139,10 @@ CpuProgressBar = function(el) {
CpuProgressBar.prototype = new ProgressBar();
+CpuProgressBar.prototype.getDefaultText = function() {
+ return 'Server CPU [0%]';
+};
+
CpuProgressBar.prototype.setUsage = function(usage) {
this.set(usage, "Server CPU [" + Math.round(usage * 100) + "%]", usage > .85);
};
diff --git a/htdocs/openwebrx.js b/htdocs/openwebrx.js
index 4238ad6..8f2ca79 100644
--- a/htdocs/openwebrx.js
+++ b/htdocs/openwebrx.js
@@ -1353,9 +1353,12 @@ function init_header() {
}
function initProgressBars() {
- $('#openwebrx-bar-audio-buffer, #openwebrx-bar-audio-output').each(function() {
- $(this).progressbar().setSampleRate(audioEngine.getSampleRate());
- });
+ $(".openwebrx-progressbar").each(function(){
+ var bar = $(this).progressbar();
+ if ('setSampleRate' in bar) {
+ bar.setSampleRate(audioEngine.getSampleRate());
+ }
+ })
}
function audioReporter(stats) {