summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian <stayawake@lavabit.com>2014-02-14 20:58:39 (GMT)
committerFlorian <stayawake@lavabit.com>2014-02-14 20:58:39 (GMT)
commitb69d61143ef7e0ef082406b654770409a743b173 (patch)
tree2369109ce2aef0358637862115627844ed899507
parent6ef199fe1052502800adbf1b2db8c7886473ce21 (diff)
added printing window and function
-rw-r--r--js/cctv-control.js1
-rw-r--r--js/print.js63
-rw-r--r--print.html15
3 files changed, 79 insertions, 0 deletions
diff --git a/js/cctv-control.js b/js/cctv-control.js
index 8ffefbc..a191752 100644
--- a/js/cctv-control.js
+++ b/js/cctv-control.js
@@ -153,6 +153,7 @@ function hideForm() {
localStorage.setItem("formAnalysis3", document.getElementById('formAnalysis3').value);
//hide form
+ window.open('print.html', 'Printlayout');
document.getElementById("form").style.visibility = 'hidden';
formActive = 0;
localStorage.setItem("formActive", formActive);
diff --git a/js/print.js b/js/print.js
new file mode 100644
index 0000000..8adf297
--- /dev/null
+++ b/js/print.js
@@ -0,0 +1,63 @@
+// CCTV Control
+//
+// Author: Florian Raemisch
+// Email: olf@subsignal.org
+//
+// cctv-control is a webinterface to control and view
+// mjpeg encoded videos by cctv cameras which are
+// proxied by mjpegplexer. camera control is possible
+// with arrow-keys, if mjpegplexer is configured
+// properly.
+//
+// This Software is licensed under the GPL Version 3, 29 June 2007
+
+//create event which is triggered when DOM is ready
+window.onDomReady = initReady;
+
+//change from testbild to default cam when DOM is ready
+window.onDomReady(initViewer);
+
+
+function initReady(fn) {
+ if(document.addEventListener) {
+ document.addEventListener("DOMContentLoaded", fn, false);
+ }
+}
+
+function initViewer() {
+
+ //load contents from localStorage
+ var display = document.getElementById("camImage"),
+ page = document.getElementById("page"),
+ formName = localStorage.getItem("formName"),
+ formDate = localStorage.getItem("formDate"),
+ formAnalysis1 = localStorage.getItem("formAnalysis1"),
+ formAnalysis2 = localStorage.getItem("formAnalysis2"),
+ formAnalysis3 = localStorage.getItem("formAnalysis3"),
+ stor = localStorage.getItem("snapShot");
+
+ //display loaded data
+ if (stor) {
+ display.setAttribute("src", stor);
+ page.innerHTML += '<p>' + formName + '</p>';
+ page.innerHTML += '<p>' + formDate + '</p>';
+ page.innerHTML += '<p>' + formAnalysis1 + '</p>';
+ page.innerHTML += '<p>' + formAnalysis2 + '</p>';
+ page.innerHTML += '<p>' + formAnalysis3 + '</p>';
+ }
+
+ //commented out for debugging and layouting purposes
+ //print();
+
+ //reset localStorage to default values
+ //localStorage.setItem("formName", "Untersucher");
+ //localStorage.setItem("formDate", "Datum");
+ //localStorage.setItem("formAnalysis1", "Dein Bericht 1");
+ //localStorage.setItem("formAnalysis2", "Dein Bericht 2");
+ //localStorage.setItem("formAnalysis3", "Dein Bericht 3"):
+
+ //commented out for debugging and layouting purposes
+ //window.close();
+
+}
+
diff --git a/print.html b/print.html
new file mode 100644
index 0000000..b100351
--- /dev/null
+++ b/print.html
@@ -0,0 +1,15 @@
+<html>
+
+<head>
+ <script src="js/print.js" type="text/javascript"></script>
+</head>
+
+<body>
+
+<div id="page">
+ <img src="about:blank" id="camImage">
+</div>
+
+
+</body>
+</html>