-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathz_step3_header.txt
37 lines (30 loc) · 987 Bytes
/
z_step3_header.txt
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
<script src="cordova-2.4.0.js" type="text/javascript"></script>
<script>
var deviceReadyDeferred = $.Deferred();
var jqmReadyDeferred = $.Deferred();
document.addEventListener('deviceReady', deviceReady, false);
function deviceReady() {
deviceReadyDeferred.resolve();
}
$(document).one('mobileinit', function () {
jqmReadyDeferred.resolve();
});
$.when(deviceReadyDeferred, jqmReadyDeferred).then(function(e) {
$('#picture_button').click(function(e) {
$.mobile.loading('show');
navigator.camera.getPicture(onSuccess, onFail, {
destinationType: Camera.DestinationType.DATA_URL,
correctOrientation: true
});
function onSuccess(imageData) {
console.log(imageData);
$('#picture').attr('src', 'data:image/jpeg;base64,' + imageData);
$.mobile.loading('hide');
}
function onFail(message) {
$.mobile.loading('hide');
alert('Failed because: ' + message);
}
});
});
</script>