-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathiframe.qr-scanner.php
52 lines (52 loc) · 1.64 KB
/
iframe.qr-scanner.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="IOTA web wallet user area">
<meta name="author" content="Nikola Rogina">
<title>QR Code Scanner | IOTA Web Wallet</title>
<link href="css/loader-default.css" rel="stylesheet">
<style type="text/css">
.loader.is-active {
background-color:rgba(0,0,0,0.99);
}
</style>
</head>
<body>
<div class="loader loader-default is-active"></div>
<video id="qr-preview-video" style="display:none;width:100%;object-fit:cover;"></video>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/jquery.min.js"><\/script>')</script>
<script src="js/instascan.min.js"></script>
<script>
$(document).ready(function() {
let scanner = new Instascan.Scanner({video:document.getElementById('qr-preview-video'),backgroundScan:false,mirror:false});
$('.loader').fadeOut(function() {
$('#qr-preview-video').show();
});
scanner.addListener('scan', function (content) {
window.parent.readQRcode(content);
});
Instascan.Camera.getCameras().then(function(cameras) {
if (cameras.length > 0) {
if (cameras[1]) {
scanner.start(cameras[1]);
}
else {
scanner.start(cameras[0]);
}
}
else {
alert('No cameras found!');
window.parent.$('#modal').modal('toggle');
}
}).catch(function (e) {
alert('No cameras found!');
window.parent.$('#modal').modal('toggle');
});
});
</script>
</body>
</html>