Last active
June 28, 2016 15:33
-
-
Save cianclarke/c499c5cef33c1ae603ab to your computer and use it in GitHub Desktop.
Barcode Client Finished Files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"plugins": [ | |
{ | |
"id": "com.phonegap.plugins.barcodescanner", | |
"version": "2.0.1", | |
"url" : "https://github.com/wildabeast/BarcodeScanner.git" | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.getElementById('say_hello').onclick = function () { | |
return cordova.plugins.barcodeScanner.scan(function (result) { | |
document.getElementById('hello_to').value = result.text; | |
document.getElementById('cloudResponse').innerHTML = "<p>Calling Cloud.....</p>"; | |
$fh.cloud( | |
{ | |
path: 'hello', | |
data: { | |
barcode: result.text | |
} | |
}, | |
function (res) { | |
var product = res; | |
document.getElementById('cloudResponse').innerHTML = "<img src='" + product.imageurl + "'>" + | |
"<p>" + product.productname + "</p>"; | |
}, | |
function (code, errorprops, params) { | |
alert('An error occured: ' + code + ' : ' + errorprops); | |
} | |
); | |
}, function (error) { | |
alert("Scanning failed: " + error); | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> | |
<title>Hello World</title> | |
<link rel="stylesheet" href="css/app.css"> | |
</head> | |
<body> | |
<header class="header-footer-bg"> | |
<div class="center"> | |
<h3>FeedHenry | |
<small>Barcode Scanner</small> | |
</h3> | |
</div> | |
</header> | |
<div id="count" class=""> | |
<div id="formWrapper"> | |
<p id="description">This app will take a USP code, send it to the cloud, and return the product name and image.</p> | |
<br> | |
<div class="input-div"> | |
<input id="hello_to" type="text" class="input-text" placeholder="Enter Your USP Code"/> | |
</div> | |
<br> | |
<button id="say_hello" type="button" class="say-hello-button">Scan Barcode</button> | |
<div id="cloudResponse" class="cloudResponse"></div> | |
</div> | |
</div> | |
<footer class="header-footer-bg"> | |
<div> | |
<small class="right"> | |
<!-- v. {{ version }} --> | |
</small> | |
</div> | |
</footer> | |
<script src="feedhenry.js"></script> | |
<script src="hello.js"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment