-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
303 lines (172 loc) · 7.25 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
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
<!DOCTYPE html>
<!--
/*
* mapsV3APIkeys
*
* Cord Phelps
* Copyright 2014, MIT License
* http://www.opensource.org/licenses/MIT
*
* Software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<html>
<head>
<meta charset="utf-8">
<title>mapsV3key</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/jquery.mobile-1.4.3.min.css" />
<!-- secret sauce to get phonegapBuild to include cordova -->
<!-- http://stackoverflow.com/questions/20924734/cant-use-navigator-camera-getpicture-on-ios-phonegap-adobe-build -->
<script src="cordova.js"></script>
<!-- end secret sauce -->
<script src="js/vendor/jquery-1.10.2.min.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?v=3&sensor=true" >
</script>
<!--
enable this script tag to test your key in a browser (replacing the string "INSERT-YOUR-KEY-HERE")
<script src="https://maps.googleapis.com/maps/api/js?v=3&key=INSERT-YOUR-KEY-HERE&sensor=true" >
</script>
the browser will report that google is unhappy if a bad key is presented
// Google has disabled use of the Maps API for this application. The provided key is not a valid Google
// API Key, or it is not authorized for the Google Maps Javascript API v3 on this site. If you are the
// owner of this application, you can learn about obtaining a valid key
// here: https://developers.google.com/maps/documentation/javascript/tutorial#api_key
</script>
-->
<script>
$(document).bind("mobileinit", function() {
$.support.cors = true;
$.mobile.allowCrossDomainPages = true;
$.mobile.defaultPageTransition = "fade";
});
var map = new Object;
</script>
<!-- the last script to load -->
<script src="js/vendor/jquery.mobile-1.4.3.min.js"></script>
</head>
<body style="text-align:center">
<div data-role="page" id="page2" data-fullscreen="true" data-theme="c">
<div data-role="header" data-fullscreen="true" id="page2Header" class="headerClass">
<div data-role="controlgroup" data-type="horizontal">
<!--
-->
<button data-inline="true" data-icon="camera" id='cameraBtn'>.</button>
<button data-inline="true" data-icon="refresh" id='refreshBtn'>.</button>
<button data-inline="true" data-icon="search" id='navigateBtn'>.</button>
<button data-inline="true" data-icon="eye" id='eyeBtn'>.</button>
</div>
</div>
<div id='page2Content' class='pageContent' data-role="content" style="padding:1px">
<div id="mapCanvas" class='mapCanvas' ></div>
</div> <!-- end of content -->
<div id='page2Footer' data-role="footer" class="footerClass" data-position="fixed" data-tap-toggle="false">
<!-- <div id='page2Footer' data-role="footer" class="ui-bar headerClass" data-position="fixed"> -->
<div data-role="controlgroup" data-type="horizontal" >
<button data-inline="true" id='infoButton' data-icon="info" >tap me</button>
<!-- <div id="infoButton" ></div> -->
</div> <!-- end control group -->
</div> <!-- end footer -->
<script>
$("#infoButton").click(function() {
$.mobile.changePage($("#info"), { transition: 'fade' });
}); // end click
</script>
</div> <!-- end of page2 -->
<!- ----------------------------------------------------------------------------- -->
<!- ----------------------------------------------------------------------------- -->
<!- ----------------------------------------------------------------------------- -->
<div data-role="page" id="info" data-cache="false" data-theme="c">
<div data-role="header" id="infoHeader" data-theme="c" class="headerClass">
<div data-role="controlgroup" data-type="horizontal">
</div> <!-- end control group -->
</div>
<div data-role="content" id="infoContent" class='pageContent'>
<div class='infoContentWrapper' >
<div id="smallPrint" style="width:60%;text-align:justify;left:20%" >
<p>
Mystery solved! (at least for iOS in version 1 of this cookbook)
</p>
<p>
Pure html5 apps using a private google maps v3 API key via phonegapBuild.
</p>
</div >
</div> <!-- end content wrapper -->
</div> <!-- end page content -->
<div data-role="footer" id="infoFooter" class="footerClass" data-theme="c" data-position="fixed" data-tap-toggle="false">
<div data-role="controlgroup" data-type="horizontal">
<button data-inline="true" id="infoBackBtn" data-icon="back" >tap me</button>
</div> <!-- end control group -->
</div> <!-- end footer -->
<script>
$("#infoBackBtn").click(function() {
$.mobile.changePage($("#page2"), { transition: 'fade' });
}); // end backbtn click
</script>
</div> <!-- end page pageInfo -->
<!-- end of pages -->
<!- ----------------------------------------------------------------------------- -->
<!- ----------------------------------------------------------------------------- -->
<!- ----------------------------------------------------------------------------- -->
<script>
$(document).on('pageshow', '#page2', function() {
$(window).resize(); // ensure tiles are loaded
} );
google.maps.event.addDomListener(window, 'load', initialize);
function initialize() {
var defaultPosition = {
latitude: 37.429793,
longitude: -122.169546,
zoom: 13
}
var latLng = new google.maps.LatLng(defaultPosition.latitude, defaultPosition.longitude);
var mapOptions = {
zoom: defaultPosition.zoom,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: latLng,
panControl: false,
zoomControl: false,
mapTypeControl: false,
scaleControl: false,
streetViewControl: false,
overviewMapControl: false
};
map = new google.maps.Map(document.getElementById('mapCanvas'), mapOptions);
var view = getAvailableDimensions();
$('#mapCanvas').css({height: ((view.availableContentHeight)-4) + 'px' });
}
function getAvailableDimensions() {
var imagePixels = 300;
// http://www.gajotres.net/using-google-maps-javascript-api-v3-with-jquery-mobile/
var header = $('.headerClass').height();
//console.log("header: " + header);
var footer = $('.footerClass').height();
//console.log("footer (should be 1% larger than header): " + footer);
var viewport_height = $(window).height();
//console.log("viewport_height: " + viewport_height);
var content_height = viewport_height - header - footer ;
//console.log("content_height: " + content_height);
// if (!isMobile) {
var fromTop = 0;
// adjust the vertical position of .swipe-wrap inside of .swipe
if (imagePixels <= content_height) {
var remainderPct = ((content_height - imagePixels)/content_height) * 100;
// console.log("remainderPct: " + remainderPct);
var mysteryAdjustment = 5;
fromTop = (remainderPct / 2) - mysteryAdjustment;
}
else {
fromTop = 0;
}
return {
viewportHeight: viewport_height,
availableContentHeight: content_height,
imageFromTop: fromTop
}
}
</script>
</body>
</html>