lecteur_qrcode/demo/lecteur_qrcode.html
2022-06-01 01:13:14 +02:00

58 lines
1.9 KiB
HTML

<!DOCTYPE html>
<html dir="#LANG_DIR" lang="#LANG" class="[(#LANG_DIR)][ (#LANG)] no-js">
<head>
[(#REM) Page de démo accessible sous /?page=demo/libphonenumber_demo ]
<script src="[(#CHEMIN{js/html5-qrcode.min.js}|timestamp)]" type="text/javascript"></script>
<script type='text/javascript'>/*<![CDATA[*/(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement);/*]]>*/</script>
<title>[(#NOM_SITE_SPIP|textebrut)][ - (#SLOGAN_SITE_SPIP|textebrut)]</title>
[<meta name="description" content="(#DESCRIPTIF_SITE_SPIP|couper{150}|attribut_html)" />]
<INCLURE{fond=inclure/head} />
<style type="text/css">
.page{text-align:center; margin-top:10em}
.libphonenumber{margin:0 auto; width:800px; text-align:left;}
.reponse_formulaire_erreur{color:red}
.editer_force_telephone{display:none}
</style>
<script>
jQuery(function() {
console.log("coucou");
function onScanSuccess(decodedText, decodedResult) {
// handle the scanned code as you like, for example:
console.log(`Code matched = ${decodedText}`, decodedResult);
$('#resultat').fadeIn().val(decodedText);
$('#reader').fadeOut();
}
function onScanFailure(error) {
// handle scan failure, usually better to ignore and keep scanning.
// for example:
console.warn(`Code scan error = ${error}`);
}
let html5QrcodeScanner = new Html5QrcodeScanner(
"reader",
{ fps: 10, qrbox: {width: 400, height: 400}},
/* verbose= */ false);
html5QrcodeScanner.render(onScanSuccess, onScanFailure);
});
</script>
</head>
<body>
<div class="page" style="background-color:white; color:black;">
<div class="inner">
<h1>Lecteur de qrcode</h1>
<div id="reader" width="600px"></div>
<textarea name="" id="resultat" style="display:none; width: 100%"></textarea>
<br>
<br>
<br>
<br>
</div>
</div>
</body>
</html>