From d65042af543b777729921dd24fa49001f1044388 Mon Sep 17 00:00:00 2001 From: benmcmahon100 Date: Mon, 5 Oct 2015 22:46:29 +0100 Subject: [PATCH] Finished the geolocation waypoint. Ready for QA and copy fixes --- challenges/json-apis-and-ajax.json | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/challenges/json-apis-and-ajax.json b/challenges/json-apis-and-ajax.json index fda516722e..cec38c8b65 100644 --- a/challenges/json-apis-and-ajax.json +++ b/challenges/json-apis-and-ajax.json @@ -392,10 +392,22 @@ "difficulty": 3.19, "description": [ "", - "Be descriptive!" + "We can access the users current location by using the built in navigator in the browser.", + "The navigator will get the users current longitude and latitude with a decent level of accuracy.", + "", + "if (navigator.geolocation) {", + " navigator.geolocation.getCurrentPosition(function(position){", + " // Do something in here with the coordinates!", + " ", + " console.log(\"latitiude\", position.coords.latitude);", + " console.log(\"longitude\", position.coords.longitude);", + " ", + " });", + "}", + "" ], "tests": [ - "/*Be Assertive*/')" + "assert(editor.match(/navigator\\.geolocation\\.getCurrentPosition/gi), 'you should make use of the navigator.geolocation to access the users current location')" ], "challengeSeed": [ "var json = {",