';
@@ -809,7 +809,7 @@ FaxMessagePanel.prototype.pushMessage = function(msg) {
var f = msg.frequency>0? ' at ' + Math.floor(msg.frequency/1000) + 'kHz' : '';
var h = '
' + msg.timestamp + ' ' + msg.width + 'x' + msg.height +
' ' + msg.faxMode + f + '
' +
+ var c = '
' +
'
';
diff --git a/htdocs/lib/UI.js b/htdocs/lib/UI.js
index 6228fbad..15c903cc 100644
--- a/htdocs/lib/UI.js
+++ b/htdocs/lib/UI.js
@@ -139,6 +139,25 @@ UI.updateNR = function() {
}));
}
+//
+// Audio Recording Controls
+//
+
+UI.toggleRecording = function(on) {
+ // If no argument given, toggle audio recording
+ var toggle = typeof(on) === 'undefined';
+
+ var $recButton = $('.openwebrx-record-button');
+
+ if (audioEngine.recording && (toggle || !on)) {
+ audioEngine.stopRecording();
+ $recButton.css('animation-name', '');
+ } else if (toggle || on) {
+ audioEngine.startRecording();
+ $recButton.css('animation-name', 'openwebrx-record-animation');
+ }
+};
+
//
// Look & Feel Controls
//
diff --git a/htdocs/lib/Utils.js b/htdocs/lib/Utils.js
index e565ac68..af6056a2 100644
--- a/htdocs/lib/Utils.js
+++ b/htdocs/lib/Utils.js
@@ -233,6 +233,30 @@ Utils.mmsiIsGround = function(mmsi) {
return mmsi.substring(0, 2) === '00';
};
+// Save given canvas into a PNG file.
+Utils.saveCanvas = function(canvas) {
+ // Get canvas by its ID
+ var c = document.getElementById(canvas);
+ if (c == null) return;
+
+ // Convert canvas to a data blob
+ c.toBlob(function(blob) {
+ // Create and click a link to the canvas data URL
+ var a = document.createElement('a');
+ a.href = window.URL.createObjectURL(blob);
+ a.style = 'display: none';
+ a.download = canvas + ".png";
+ document.body.appendChild(a);
+ a.click();
+
+ // Get rid of the canvas data URL
+ setTimeout(function() {
+ document.body.removeChild(a);
+ window.URL.revokeObjectURL(a.href);
+ }, 0);
+ }, 'image/png');
+};
+
//
// Local Storage Access
//
diff --git a/htdocs/openwebrx.js b/htdocs/openwebrx.js
index 47574c66..ea521b13 100644
--- a/htdocs/openwebrx.js
+++ b/htdocs/openwebrx.js
@@ -35,54 +35,6 @@ var secondary_fft_size;
var tuning_step_default = 1;
var tuning_step = 1;
-function toggleSection(el) {
- var next_el = el.nextElementSibling;
- if (next_el) {
- if (next_el.style.display === "none") {
- el.innerHTML = el.innerHTML.replace("\u25B4", "\u25BE");
- next_el.style.display = "block";
- } else {
- el.innerHTML = el.innerHTML.replace("\u25BE", "\u25B4");
- next_el.style.display = "none";
- }
- }
-}
-
-function toggleRecording() {
- var $recButton = $('.openwebrx-record-button');
-
- if (audioEngine.recording) {
- audioEngine.stopRecording();
- $recButton.css('animation-name', '');
- } else {
- audioEngine.startRecording();
- $recButton.css('animation-name', 'openwebrx-record-animation');
- }
-}
-
-function saveCanvas(canvas) {
- // Get canvas by its ID
- var c = document.getElementById(canvas);
- if (c == null) return;
-
- // Convert canvas to a data blob
- c.toBlob(function(blob) {
- // Create and click a link to the canvas data URL
- var a = document.createElement('a');
- a.href = window.URL.createObjectURL(blob);
- a.style = 'display: none';
- a.download = canvas + ".png";
- document.body.appendChild(a);
- a.click();
-
- // Get rid of the canvas data URL
- setTimeout(function() {
- document.body.removeChild(a);
- window.URL.revokeObjectURL(a.href);
- }, 0);
- }, 'image/png');
-}
-
function zoomInOneStep() {
zoom_set(zoom_level + 1);
}