Created
July 25, 2012 21:28
-
-
Save realrasengan/3178816 to your computer and use it in GitHub Desktop.
Bitcoin Balance 3
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
var Barcode = require("ti.barcode"); | |
Barcode.addEventListener('success', function (e) { | |
// Ti.Platform.openURL("http://blockexplorer.com/address/"+unescape(e.result).match(/([^\?]*)/)[1].replace("bitcoin:","")); | |
// | |
// "If using regex, then why not just use regex to snip out the first contiguous group of say 28-34 characters starting with '1' | |
// and the rest matching the base58 alphabet? This would make it highly universal without adding any complexity." -- casascius | |
var btcAddress = unescape(e.result).match(/([1][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{27,34})/) | |
if(btcAddress!=null) | |
Ti.Platform.openURL("http://blockexplorer.com/address/"+btcAddress[1]); | |
self.close(); | |
var activity = Titanium.Android.currentActivity; | |
activity.finish(); | |
}); | |
Barcode.capture({ | |
animate: false, | |
showCancel: false, | |
showRectangle: true, | |
keepOpen: false, | |
acceptedFormats: [ | |
Barcode.FORMAT_QR_CODE | |
] | |
}); | |
var self = Ti.UI.createWindow({ | |
backgroundColor:'#000000', | |
exitOnClose:true | |
}); | |
self.addEventListener('android:back', function(e){ | |
self.close(); | |
var activity = Titanium.Android.currentActivity; | |
activity.finish(); | |
}); | |
self.open(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment