From b69d61143ef7e0ef082406b654770409a743b173 Mon Sep 17 00:00:00 2001 From: Florian Date: Fri, 14 Feb 2014 21:58:39 +0100 Subject: added printing window and function --- js/cctv-control.js | 1 + js/print.js | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 js/print.js (limited to 'js') 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 += '

' + formName + '

'; + page.innerHTML += '

' + formDate + '

'; + page.innerHTML += '

' + formAnalysis1 + '

'; + page.innerHTML += '

' + formAnalysis2 + '

'; + page.innerHTML += '

' + formAnalysis3 + '

'; + } + + //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(); + +} + -- cgit v1.2.1