summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/cctv-control.js29
1 files changed, 20 insertions, 9 deletions
diff --git a/js/cctv-control.js b/js/cctv-control.js
index 40a7bf4..5f18108 100644
--- a/js/cctv-control.js
+++ b/js/cctv-control.js
@@ -14,7 +14,7 @@
var cam = 0;
var camHost = "127.0.0.1:8080";
var controlHost = "127.0.0.1:8080";
-var formActive = false;
+var formActive = 0;
//create event which is triggered when DOM is ready
window.onDomReady = initReady;
@@ -31,9 +31,18 @@ function initReady(fn) {
//hide the form, and switch on camera
function initViewer() {
- document.getElementById('form').style.visibility = "hidden";
- changeCam();
+
+ formActive = localStorage.getItem("formActive");
+
+ if (formActive == 1) {
+ showForm();
}
+ else {
+ formActive == 0;
+ document.getElementById('form').style.visibility = "hidden";
+ changeCam();
+ }
+}
//change currently displayed camera to the one in cam variable
function changeCam() {
@@ -94,14 +103,14 @@ function saveImage() {
};
fileReader.readAsDataURL(blob);
- showImage();
+ showForm();
}
}, false);
xhr.send();
}
-function showImage() {
+function showForm() {
//load snapshot from localstorage an display in background
var display1 = document.getElementById("camImage"),
@@ -115,20 +124,22 @@ function showImage() {
//make form visible
document.getElementById("form").style.visibility = 'visible';
- formActive = true;
+ formActive = 1;
+ localStorage.setItem("formActive", formActive);
}
-function printForm() {
+function hideForm() {
document.getElementById("form").style.visibility = 'hidden';
- formActive = false;
+ formActive = 0;
+ localStorage.setItem("formActive", formActive);
changeCam();
}
function keyDown(event) {
- if (formActive == false) {
+ if (formActive != 1) {
switch(event.keyCode) {
case 49: // 1
cam = 0;