Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE HTML>
- <html>
- <head>
- <meta name="viewport" content="width=320; user-scalable=no" />
- <meta http-equiv="Content-type" content="text/html; charset=utf-8">
- <title>PhoneGap</title>
- <link rel="stylesheet" href="master.css" type="text/css" media="screen" title="no title" charset="utf-8">
- <script type="text/javascript" charset="utf-8" src="phonegap-1.4.1.js"></script>
- <script type="text/javascript" charset="utf-8" src="barcodescanner.js"></script>
- <script type="text/javascript" charset="utf-8">
- function init(){
- console.log("GOT AN ONLOAD!!!")
- document.addEventListener("touchmove", preventBehavior, false);
- document.addEventListener("deviceready", deviceInfo, true);
- }
- var preventBehavior = function(e) {
- e.preventDefault();
- };
- var deviceInfo = function(){
- console.log("In deviceInfo!");
- document.getElementById("platform").innerHTML = device.platform;
- document.getElementById("version").innerHTML = device.version;
- document.getElementById("uuid").innerHTML = device.uuid;
- }
- function scan() {
- window.plugins.barcodeScanner.scan(function(result) {
- alert("We got a barcode\n" +
- "Result: " + result.text + "\n" +
- "Format: " + result.format);
- }, function(error) {
- alert("Scanning failed: " + error);
- });
- }
- function encode(type, data) {
- window.plugins.barcodeScanner.encode(type, data, function(result) {
- alert("encode success: " + result);
- }, function(error) {
- alert("encoding failed: " + error);
- });
- }
- </script>
- </head>
- <body onload="init();" id="stage" class="theme">
- <h1>Welcome to PhoneGap!</h1>
- <h2>this file is located at assets/index.html</h2>
- <div id="info">
- <h4>Platform: <span id="platform"> </span></h4>
- <h4>Version: <span id="version"> </span></h4>
- <h4>UUID: <span id="uuid"> </span></h4>
- </div>
- <a href="#" class="btn large" onclick="scan();">Scan</a>
- <a href="#" class="btn large" onclick="encode(BarcodeScanner.Encode.TEXT_TYPE, 'http://www.phonegap.com');">Encode Text</a>
- <a href="#" class="btn large" onclick="encode(BarcodeScanner.Encode.EMAIL_TYPE, 'someone@somewhere.com');">Encode Email</a>
- <a href="#" class="btn large" onclick="encode(BarcodeScanner.Encode.PHONE_TYPE, '1800551212');">Encode Phone</a>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement