Browse Source

visual for scan page

Maxence Bacquet 5 years ago
parent
commit
e3f266e159
1 changed files with 76 additions and 46 deletions
  1. 76 46
      WebContent/scan/index.html

+ 76 - 46
WebContent/scan/index.html

@@ -1,55 +1,85 @@
 <!DOCTYPE html>
-<html>
+<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
+  	<meta charset="UTF-8">
     <title>Instascan</title>
     <script type="text/javascript" src="https://rawgit.com/schmich/instascan-builds/master/instascan.min.js"></script>
+    <link rel="stylesheet" type="text/css" href="../css/style.css">
+  	<link rel="stylesheet" href="../css/style1.css" type="text/css"  /> 
+  	<link rel="stylesheet" href="../css/style.css" type="bootstrap/css/bootstrap.min.css"  />
   </head>
   <body>
-	<h1>Scanner QrCODE</h1>
-    <video id="preview"></video>
-    <script type="text/javascript">
-	    //Recupération du cookie espace
-		function getCookieVal(offset) {
-			let endstr = document.cookie.indexOf (";", offset);
-			if (endstr==-1)
-				endstr = document.cookie.length;
-			return unescape(document.cookie.substring(offset, endstr));
-		}
-	
-		function getCookie (name) {
-			let arg = name + "=";
-			let alen = arg.length;
-			let clen = document.cookie.length;
-			let i = 0;
-			while (i < clen) {
-				let j = i+alen;
-				if (document.cookie.substring(i, j) == arg)
-					return getCookieVal(j);
-				i = document.cookie.indexOf(" ",i)+1;
-				if (i == 0)
-					break;
-			}
-			return null;
-		}
-		
-    	let espace = getCookie("microfolies.lens.espace");
-    	console.log(espace);
+  	<div id="principal">
+    	<div class="header">
+        	<div class="navbar">
+            	<ul>
+                	<li><a href="../index.html">Accueil</a></li>
+                	<li><a href="../abonnes.html">nos Abonnés</a></li>                
+            	</ul>
+        	</div><!-- end navbar -->
+    	</div><!-- end of header -->
     	
-  		//Scanner QRcode
-		let scanner = new Instascan.Scanner({ video: document.getElementById('preview') });
-		scanner.addListener('scan', function (content) {
-			espace ? console.log(content + "/" + espace) : console.log(content);
-		});
-		Instascan.Camera.getCameras().then(function (cameras) {
-			if (cameras.length > 0) {
-		    	scanner.start(cameras[0]);
-		    }
-			else {
-		    console.error('No cameras found.');
-		    }
-		}).catch(function (e) {
-		    console.error(e);
-		});
-    </script>
+    	<div class="main">
+
+	        <div class="menu">
+	            <ul>
+	              <li><a href="../index.html">Accueil</a></li>
+	               <li><a href="../abonnes.html">Nos abonnées</a></li>
+	               <li><a href="../inscription.jsp">Inscription</a></li>
+	               
+	            </ul>
+	        </div><!--end menu -->
+        
+        	<div class="content">
+			    <h1>Scanner QrCODE</h1>
+			    <video id="preview"></video>
+			    <script type="text/javascript">
+				    //Recupération du cookie espace
+					function getCookieVal(offset) {
+						let endstr = document.cookie.indexOf (";", offset);
+						if (endstr==-1)
+							endstr = document.cookie.length;
+						return unescape(document.cookie.substring(offset, endstr));
+					}
+				
+					function getCookie (name) {
+						let arg = name + "=";
+						let alen = arg.length;
+						let clen = document.cookie.length;
+						let i = 0;
+						while (i < clen) {
+							let j = i+alen;
+							if (document.cookie.substring(i, j) == arg)
+								return getCookieVal(j);
+							i = document.cookie.indexOf(" ",i)+1;
+							if (i == 0)
+								break;
+						}
+						return null;
+					}
+					
+			    	let espace = getCookie("microfolies.lens.espace");
+			    	console.log(espace);
+			    	
+			  		//Scanner QRcode
+					let scanner = new Instascan.Scanner({ video: document.getElementById('preview') });
+					scanner.addListener('scan', function (content) {
+						espace ? document.getElementById("resultScan").value = content + "/" + espace : document.getElementById("resultScan").value = content;
+					});
+					Instascan.Camera.getCameras().then(function (cameras) {
+						if (cameras.length > 0) {
+					    	scanner.start(cameras[0]);
+					    }
+						else {
+					    console.error('No cameras found.');
+					    }
+					}).catch(function (e) {
+					    console.error(e);
+					});
+			    </script>
+			    <textarea id="resultScan" read_only="true"></textarea>
+        	</div>
+        </div>
+	</div>
   </body>
 </html>