-
Notifications
You must be signed in to change notification settings - Fork 0
/
location.html
executable file
·179 lines (152 loc) · 5.95 KB
/
location.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<!--
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no"/>
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=default-width, height=default-height, target-densitydpi=device-dpi" />
<link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery.min.js" ></script>
<script type="text/javascript" src="js/jquery.mobile.min.js"></script>
<link rel="stylesheet" href="css/jalf_theme.min.css" />
<link rel="stylesheet" href="css/jquery.mobile.structure.min.css" />
<script type="text/javascript" src="cordova.js"></script>
<link rel="stylesheet" type="text/css" href="css/index.css" />
</head>
<body>
<div data-role="page" data-theme="a">
<div data-role="header" data-position="fixed" data-tap-toggle="false">
<h1>MailBox</h1>
</div>
<div data-role="content" data-theme="a">
<script type="text/javascript">
var map, mapOptions, currentLocation, currentLocationMarker;
function loadMapScript() {
var script = document.createElement("script");
script.type = "text/javascript";
script.id = "googleMaps"
script.src = "https://maps.googleapis.com/maps/api/js?key=AIzaSyDLF_ybu7cbNaWfMzhUSIWIOrTBGjXl3iw&callback=initializeMap";
document.body.appendChild(script);
}
function initializeMap(mapOptions) {
var myLatlng = new google.maps.LatLng(currentLocation.coords.latitude, currentLocation.coords.longitude);
var mapOptions = {
center : myLatlng,
zoom : 18,
mapTypeId : google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
updateCurrentLocationMarker();
}
function updateCurrentLocationMarker() {
var myLatlng = new google.maps.LatLng(currentLocation.coords.latitude, currentLocation.coords.longitude);
if (currentLocationMarker) {
currentLocationMarker.setMap(null);
} else {
currentLocationMarker = new google.maps.Marker({
position : myLatlng,
animation : google.maps.Animation.DROP,
title : "You!",
map : map
});
}
}
function onSuccess(position) {
currentLocation = position;
if (!map) {
loadMapScript();
}
}
function onError(error) {
alert('code: ' + error.code + '\n' + 'message: ' + error.message + '\n');
}
function onDeviceReady() {
navigator.geolocation.getCurrentPosition(onSuccess, onError);
}
document.addEventListener("deviceready", onDeviceReady, false);
</script>
<div id="map_canvas">
Couldn't load map because there was no internet connection available
</div>
</div>
<div data-theme="a" data-role="footer" data-position="fixed">
<div data-role="navbar" >
<ul>
<li><a id="amailbox" href="mailbox.html" data-icon="jalf-email" > MailBox </a></li>
<li><a id="afavorites" href="favorites.html" data-icon="jalf-favorites"> Favorites </a></li>
<li><a id="asearch" href="search.html" data-icon="jalf-search"> Search </a></li>
<li><a id="aphotos" href="AlbumCategory.html" data-icon="jalf-photos"> Photos </a></li>
<li><a id="alocation" href="location.html" data-icon="jalf-location"> Location </a></li>
</ul>
</div>
</div>
</div>
</body>
</html>
-->
<!--this is second example not working but only in browser-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="stylesheet" href="css/jalf_theme.min.css" />
<link rel="stylesheet" href="css/jquery.mobile.structure.min.css" />
<link rel="stylesheet" href="css/index.css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8" src="js/jquery.mobile.min.js"></script>
</head>
<body>
<div data-role="page" data-theme="a" data-add-back-btn="false">
<div data-role="header">
<h1>Location</h1>
</div>
<div data-role="content">
<script type="text/javascript" src="js/main.js"></script>
<script type="text/javascript" src="js/location.js"></script>
<!--
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=true"></script>
<script type="text/javascript" charset="utf-8" src="js/jquery.ui.map.js"></script>
<script type="text/javascript" charset="utf-8" src="js/jquery.ui.map.extensions.js"></script>
-->
<style type="text/css">
html { height: 100%; }
body { height: 100%; margin: 0; padding: 0; }
#map-canvas { height: 100%; }
</style>
<!--
<script type="text/javascript">
var initialize= function () {
try{
var mapOptions = {
center: new google.maps.LatLng(-34.397, 150.644),
zoom: 8
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
mapOptions);
}
catch(e)
{
alert(e);
}
};
google.maps.event.addDomListener(window, 'load', initialize);
</script>
-->
<div id="map_canvas" style="width:100%;height:250px"></div>
</div>
<div data-theme="a" data-role="footer" data-position="fixed" data-tap-toggle="false">
<div data-role="navbar" >
<ul>
<li><a id="amailbox" href="mailbox.html" data-icon="jalf-email" > MailBox </a></li>
<li><a id="afavorites" href="favorites.html" data-icon="jalf-favorites"> Favorites </a></li>
<li><a id="asearch" href="search.html" data-icon="jalf-search"> Search </a></li>
<li><a id="aphotos" href="AlbumCategory.html" data-icon="jalf-photos"> Photos </a></li>
<!-- <li><a id="alocation" href="location.html" data-icon="jalf-location"> Location </a></li> -->
</ul>
</div>
</div>
</div>
</body>
</html>
<!--this is third example-->