-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
125 lines (102 loc) · 4.2 KB
/
index.html
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<!doctype html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width" />
<title>Hello World, PhoneGap App</title>
<link rel="stylesheet" href="assets/css/master.css" type="text/css" media="screen" />
<script src="phonegap.js" type="text/javascript" charset="utf-8"></script>
<script src="assets/js/xui.js" type="text/javascript" charset="utf-8"></script>
<script src="assets/js/lawnchair/adaptors/LawnchairAdaptorHelpers.js" type="text/javascript" charset="utf-8"></script>
<script src="assets/js/lawnchair/adaptors/DOMStorageAdaptor.js" type="text/javascript" charset="utf-8"></script>
<script src="assets/js/lawnchair/adaptors/WebkitSQLiteAdaptor.js" type="text/javascript" charset="utf-8"></script>
<script src="assets/js/lawnchair/Lawnchair.js" type="text/javascript" charset="utf-8"></script>
<script src="assets/js/dsl.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
// Wait for PhoneGap to load
//
document.addEventListener("deviceready", onDeviceReady, false);
var watchIDPos = null;
var watchIDHead = null;
// PhoneGap is ready
//
function onDeviceReady() {
// Update every 3 seconds
var options = { frequency: 3000 };
watchIDPos = navigator.geolocation.watchPosition(onSuccesspos, onError, options);
// Update every 1 seconds
var options = { frequency: 1000 };
watchIDHead = navigator.compass.watchHeading(onSuccessheading, onError, options);
// onSuccess Geolocation
//
function onSuccesspos(position) {
var element = document.getElementById('geolocation');
element.innerHTML = 'Latitude: ' + position.coords.latitude + '<br />' +
'Longitude: ' + position.coords.longitude + '<br />';
}
// onSuccess Heading
//
function onSuccessheading(heading) {
var element = document.getElementById('heading');
element.innerHTML = 'Heading: ' + heading+ '<br />' ;
}
// onError Callback receives a PositionError object
//
function onError(error) {
alert('code: ' + error.code + '\n' +
'message: ' + error.message + '\n');
}
// Stop watching the compass and heading
//
function stopWatch() {
if (watchIDHead) {
navigator.compass.clearWatch(watchIDHead);
watchIDHead = null;
}
if (watchIDPos) {
navigator.geolocation.clearWatch(watchIDPos);
watchIDPos = null;
}
}
</script>
<script src="assets/js/app.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div id="title_bar">Phone<strong>Gap</strong> HelloWorld App</div>
<div id="welcome" class="view">
<div class="app_button" id="map_button">Show My Location</div>
<div class="app_button" id="settings_button">Settings</div>
<hr/>
<button onclick="stopWatch();">Stop Watching</button>
</div>
<hr/>
<div id="map" class="view">
<div class="map_image">
<img id="static_map" src="assets/img/staticmap.png">
</div>
<p>This is where you are: </p>
<p id="heading">Heading...</p>
<p id="geolocation">Watching geolocation...</p>
<div class="app_button" id="welcome_button">Go Back</div>
</div>
<div id="settings" class="view">
<form id="settings_form">
<fieldset>
<legend>Map Type</legend>
<input type="radio" name="map" value="roadmap" checked>Road Map<br/>
<input type="radio" name="map" value="satellite">Satellite<br/>
<input type="radio" name="map" value="terrain">Terrain<br/>
<input type="radio" name="map" value="hybrid">Hybrid<br/>
</fieldset>
<fieldset>
<legend>Zoom Level</legend>
<input type="radio" name="zoom" value="10">Super Far<br/>
<input type="radio" name="zoom" value="12">Far<br/>
<input type="radio" name="zoom" value="15" checked>Normal<br/>
<input type="radio" name="zoom" value="18">Close<br/>
<input type="radio" name="zoom" value="20">Super Close<br/>
</fieldset>
<button id="save_button">Save</button>
</form>
</div>
</body>
</html>