18
18
* under the License.
19
19
*
20
20
*/
21
+
22
+ /* jshint jasmine: true */
23
+ /* global WinJS, device */
24
+
21
25
exports . defineAutoTests = function ( ) {
22
26
var fail = function ( done , context , message ) {
23
27
// prevents done() to be called several times
@@ -266,6 +270,40 @@ exports.defineAutoTests = function () {
266
270
exports . defineManualTests = function ( contentEl , createActionButton ) {
267
271
var watchLocationId = null ;
268
272
273
+ /**
274
+ * Set location status
275
+ */
276
+ function setLocationStatus ( status ) {
277
+ document . getElementById ( 'location_status' ) . innerHTML = status ;
278
+ }
279
+ function setLocationDetails ( p ) {
280
+ var date = ( new Date ( p . timestamp ) ) ;
281
+ document . getElementById ( 'latitude' ) . innerHTML = p . coords . latitude ;
282
+ document . getElementById ( 'longitude' ) . innerHTML = p . coords . longitude ;
283
+ document . getElementById ( 'altitude' ) . innerHTML = p . coords . altitude ;
284
+ document . getElementById ( 'accuracy' ) . innerHTML = p . coords . accuracy ;
285
+ document . getElementById ( 'heading' ) . innerHTML = p . coords . heading ;
286
+ document . getElementById ( 'speed' ) . innerHTML = p . coords . speed ;
287
+ document . getElementById ( 'altitude_accuracy' ) . innerHTML = p . coords . altitudeAccuracy ;
288
+ document . getElementById ( 'timestamp' ) . innerHTML = date . toDateString ( ) + " " + date . toTimeString ( ) ;
289
+ }
290
+
291
+ /**
292
+ * Stop watching the location
293
+ */
294
+ function stopLocation ( ) {
295
+ var geo = navigator . geolocation ;
296
+ if ( ! geo ) {
297
+ alert ( 'navigator.geolocation object is missing.' ) ;
298
+ return ;
299
+ }
300
+ setLocationStatus ( "Stopped" ) ;
301
+ if ( watchLocationId ) {
302
+ geo . clearWatch ( watchLocationId ) ;
303
+ watchLocationId = null ;
304
+ }
305
+ }
306
+
269
307
/**
270
308
* Start watching location
271
309
*/
@@ -292,22 +330,6 @@ exports.defineManualTests = function (contentEl, createActionButton) {
292
330
setLocationStatus ( "Running" ) ;
293
331
} ;
294
332
295
- /**
296
- * Stop watching the location
297
- */
298
- var stopLocation = function ( ) {
299
- var geo = navigator . geolocation ;
300
- if ( ! geo ) {
301
- alert ( 'navigator.geolocation object is missing.' ) ;
302
- return ;
303
- }
304
- setLocationStatus ( "Stopped" ) ;
305
- if ( watchLocationId ) {
306
- geo . clearWatch ( watchLocationId ) ;
307
- watchLocationId = null ;
308
- }
309
- } ;
310
-
311
333
/**
312
334
* Get current location
313
335
*/
@@ -340,24 +362,6 @@ exports.defineManualTests = function (contentEl, createActionButton) {
340
362
341
363
} ;
342
364
343
- /**
344
- * Set location status
345
- */
346
- var setLocationStatus = function ( status ) {
347
- document . getElementById ( 'location_status' ) . innerHTML = status ;
348
- } ;
349
- var setLocationDetails = function ( p ) {
350
- var date = ( new Date ( p . timestamp ) ) ;
351
- document . getElementById ( 'latitude' ) . innerHTML = p . coords . latitude ;
352
- document . getElementById ( 'longitude' ) . innerHTML = p . coords . longitude ;
353
- document . getElementById ( 'altitude' ) . innerHTML = p . coords . altitude ;
354
- document . getElementById ( 'accuracy' ) . innerHTML = p . coords . accuracy ;
355
- document . getElementById ( 'heading' ) . innerHTML = p . coords . heading ;
356
- document . getElementById ( 'speed' ) . innerHTML = p . coords . speed ;
357
- document . getElementById ( 'altitude_accuracy' ) . innerHTML = p . coords . altitudeAccuracy ;
358
- document . getElementById ( 'timestamp' ) . innerHTML = date . toDateString ( ) + " " + date . toTimeString ( ) ;
359
- } ;
360
-
361
365
/******************************************************************************/
362
366
363
367
var location_div = '<div id="info">' +
@@ -423,8 +427,8 @@ exports.defineManualTests = function (contentEl, createActionButton) {
423
427
note =
424
428
'<h3>Allow use of current location, if prompted</h3>' ;
425
429
426
- contentEl . innerHTML = values_info + location_div + latitude + longitude + altitude + accuracy + heading + speed
427
- + altitude_accuracy + time + note + actions ;
430
+ contentEl . innerHTML = values_info + location_div + latitude + longitude + altitude + accuracy + heading + speed +
431
+ altitude_accuracy + time + note + actions ;
428
432
429
433
createActionButton ( 'Get Location' , function ( ) {
430
434
getLocation ( ) ;
0 commit comments