From ee89eb7fd44f22a3685b9cfac7eadcb8af0142be Mon Sep 17 00:00:00 2001 From: Christian Franke Date: Wed, 19 Mar 2014 15:27:46 +0100 Subject: Changes to the webform --- public/cam.html | 8 +++----- public/css/cam.css | 6 +----- public/js/cctv-control.js | 23 +++++------------------ public/js/strftime-min.js | 8 ++++++++ 4 files changed, 17 insertions(+), 28 deletions(-) create mode 100644 public/js/strftime-min.js (limited to 'public') diff --git a/public/cam.html b/public/cam.html index 3c78ff2..5ab2aaf 100644 --- a/public/cam.html +++ b/public/cam.html @@ -2,6 +2,7 @@ + @@ -10,11 +11,6 @@
-
-
-  
-   -

Personalkennzeichnung:    Zeitpunkt:

Analyse der Aufnahme:
@@ -23,6 +19,8 @@
Persönliche Bemerkungen:

+  
+  
diff --git a/public/css/cam.css b/public/css/cam.css index 1302288..dd4959c 100644 --- a/public/css/cam.css +++ b/public/css/cam.css @@ -45,7 +45,7 @@ body { #form { /*visibility: hidden;*/ - width: 1000px; + width: 600px; height: 100%; background-color: rgba(170, 170, 170, 0.9); margin: 0 auto; @@ -66,10 +66,6 @@ body { padding: 0px; } -#formImage { - width: 400px; -} - #formDate { background-color: #ccc; } diff --git a/public/js/cctv-control.js b/public/js/cctv-control.js index ddbdbb4..8f8e777 100644 --- a/public/js/cctv-control.js +++ b/public/js/cctv-control.js @@ -112,6 +112,8 @@ function saveImage() { try { localStorage.setItem("snapShot", result); + localStorage.setItem("timeStamp", + strftime('%Y-%m-%d_%H-%M-%S')); } catch (e) { console.log("Storage failed: " + e); @@ -133,32 +135,16 @@ function showForm() { //load snapshot from localstorage var display1 = document.getElementById("camImage"), - display2 = document.getElementById("formImage"), stor = localStorage.getItem("snapShot"); - - var d = new Date(); - - var date = d.getDay(); - date += '/'; - date += d.getMonth(); - date += '/'; - date += d.getFullYear(); - - var time = d.getHours(); - time += ':'; - time += d.getMinutes(); - time += ':'; - time += d.getSeconds(); - time += ' Uhr'; + timestamp = localStorage.getItem("timeStamp"); //display loaded image if (stor) { display1.setAttribute("src", stor); - display2.setAttribute("src", stor); } //insert date in date-field - document.getElementById("formDate").value = date + ' ' + time; + document.getElementById("formDate").value = timestamp; //make form visible document.getElementById("form").style.visibility = 'visible'; @@ -208,6 +194,7 @@ function completeForm() { request.open("post", "http://" + submitHost + "/submit", false); var post_object = { + 'cam': localStorage.getItem("cam"), 'formName': formName.value, 'formDate': formDate.value, 'formAnalysis1': formAnalysis1.value, diff --git a/public/js/strftime-min.js b/public/js/strftime-min.js new file mode 100644 index 0000000..696e025 --- /dev/null +++ b/public/js/strftime-min.js @@ -0,0 +1,8 @@ +(function(){function i(c,a,b){return g(c,a,b)}function g(c,a,b,j){j=j||{};a&&!n(a)&&(b=a,a=void 0);a=a||new Date;b=b||o;b.formats=b.formats||{};var i=a.getTime(),h=j.timezone,e=typeof h;if(j.utc||e=="number"||e=="string")a=p(a);if(h){if(e=="string")var k=h[0]=="-"?-1:1,q=parseInt(h.slice(1,3),10),r=parseInt(h.slice(3,5),10),h=k*60*q+r;e&&(a=new Date(a.getTime()+h*6E4))}return c.replace(/%([-_0]?.)/g,function(c,e){var d;if(e.length==2){d=e[0];if(d=="-")d="";else if(d=="_")d=" ";else if(d=="0")d="0"; +else return c;e=e[1]}switch(e){case "A":return b.days[a.getDay()];case "a":return b.shortDays[a.getDay()];case "B":return b.months[a.getMonth()];case "b":return b.shortMonths[a.getMonth()];case "C":return f(Math.floor(a.getFullYear()/100),d);case "D":return g(b.formats.D||"%m/%d/%y",a,b);case "d":return f(a.getDate(),d);case "e":return a.getDate();case "F":return g(b.formats.F||"%Y-%m-%d",a,b);case "H":return f(a.getHours(),d);case "h":return b.shortMonths[a.getMonth()];case "I":return f(l(a),d); +case "j":return d=new Date(a.getFullYear(),0,1),d=Math.ceil((a.getTime()-d.getTime())/864E5),f(d,3);case "k":return f(a.getHours(),d==null?" ":d);case "L":return f(Math.floor(i%1E3),3);case "l":return f(l(a),d==null?" ":d);case "M":return f(a.getMinutes(),d);case "m":return f(a.getMonth()+1,d);case "n":return"\n";case "o":return String(a.getDate())+s(a.getDate());case "P":return a.getHours()<12?b.am:b.pm;case "p":return a.getHours()<12?b.AM:b.PM;case "R":return g(b.formats.R||"%H:%M",a,b);case "r":return g(b.formats.r|| +"%I:%M:%S %p",a,b);case "S":return f(a.getSeconds(),d);case "s":return Math.floor(i/1E3);case "T":return g(b.formats.T||"%H:%M:%S",a,b);case "t":return"\t";case "U":return f(m(a,"sunday"),d);case "u":return d=a.getDay(),d==0?7:d;case "v":return g(b.formats.v||"%e-%b-%Y",a,b);case "W":return f(m(a,"monday"),d);case "w":return a.getDay();case "Y":return a.getFullYear();case "y":return d=String(a.getFullYear()),d.slice(d.length-2);case "Z":return j.utc?"GMT":(d=a.toString().match(/\((\w+)\)/))&&d[1]|| +"";case "z":return j.utc?"+0000":(d=typeof h=="number"?h:-a.getTimezoneOffset(),(d<0?"-":"+")+f(Math.abs(d/60))+f(d%60));default:return e}})}function p(c){var a=(c.getTimezoneOffset()||0)*6E4;return new Date(c.getTime()+a)}function n(c){for(var a=0,b=k.length,a=0;a12&&(c-=12);return c} +function s(c){var a=c%10;c%=100;if(c>=11&&c<=13||a===0||a>=4)return"th";switch(a){case 1:return"st";case 2:return"nd";case 3:return"rd"}}function m(c,a){var a=a||"sunday",b=c.getDay();a=="monday"&&(b==0?b=6:b--);var e=new Date(c.getFullYear(),0,1);return Math.floor(((c-e)/864E5+7-b)/7)}var e;e=typeof module!=="undefined"?module.exports=i:function(){return this||(0,eval)("this")}();var o={days:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),shortDays:"Sun Mon Tue Wed Thu Fri Sat".split(" "), +months:"January February March April May June July August September October November December".split(" "),shortMonths:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),AM:"AM",PM:"PM",am:"am",pm:"pm"};e.strftime=i;e.strftimeTZ=i.strftimeTZ=function(c,a,b,e){if((typeof b=="number"||typeof b=="string")&&e==null)e=b,b=void 0;return g(c,a,b,{timezone:e})};e.strftimeUTC=i.strftimeUTC=function(c,a,b){return g(c,a,b,{utc:!0})};e.localizedStrftime=i.localizedStrftime=function(c){return function(a, +b){return g(a,b,c)}};var k=["getTime","getTimezoneOffset","getDay","getDate","getMonth","getFullYear","getYear","getHours","getMinutes","getSeconds"]})(); -- cgit v1.2.1