From dda482a3384a57f75ca4cec525ffa5a8e97a8a4e Mon Sep 17 00:00:00 2001 From: Roland Schneider Date: Tue, 7 Mar 2017 08:16:12 +0100 Subject: [PATCH] add checked webcam start - only when https... --- frontend/web/js/customer.js | 50 +++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/frontend/web/js/customer.js b/frontend/web/js/customer.js index 81009b9..73a5f2d 100644 --- a/frontend/web/js/customer.js +++ b/frontend/web/js/customer.js @@ -8,27 +8,35 @@ function Customer(o){ init(); function init(){ - - defaults = $.extend(defaults,o); - - Webcam.set({ - width: 160, - height: 120, - dest_width: 320, - dest_height: 240, - image_format: 'jpeg', - jpeg_quality: 90, -// force_flash: false, -// flip_horiz: true, -// fps: 45 - }); - - Webcam.attach( '#my_camera' ); - - $("#snap").click(snap); - - preventSubmit( '#customerupdate-replacementcardnumber' ); - preventSubmit( '#customercreate-cardnumber' ); + + defaults = $.extend(defaults,o); + var url = location.href; + var initCamera; + console.info(url); + if ( url.indexOf("https") >= 0){ + initCamera = true; + }else if ( url.indexOf("localhost") >= 0 ){ + initCamera = true; + } + if ( initCamera ){ + Webcam.set({ + width: 160, + height: 120, + dest_width: 320, + dest_height: 240, + image_format: 'jpeg', + jpeg_quality: 90 + }); + Webcam.attach( '#my_camera' ); + $("#snap").click(snap); + }else{ + $("#snap").hide(); + } + + + + preventSubmit( '#customerupdate-replacementcardnumber' ); + preventSubmit( '#customercreate-cardnumber' ); } function preventSubmit($selector){