From a1c7a20381d5a34855adccf8a19ad7de47db269b Mon Sep 17 00:00:00 2001 From: Daniel O'Connor Date: Sat, 18 Feb 2017 19:08:11 +1030 Subject: [PATCH 1/3] Add a rough facebook login control, and call the graph api with a page url to find out information. --- index.html | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/index.html b/index.html index a244ff8..68c089d 100644 --- a/index.html +++ b/index.html @@ -94,5 +94,54 @@

+ + Facebook auth + From f19a18506e1f1103b6c0804040e13f0b96e8359f Mon Sep 17 00:00:00 2001 From: Daniel O'Connor Date: Sat, 18 Feb 2017 19:15:23 +1030 Subject: [PATCH 2/3] Prefil data from a facebook page URL. --- index.html | 33 +-------------------------------- js/site.js | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 32 deletions(-) diff --git a/index.html b/index.html index 68c089d..900e27a 100644 --- a/index.html +++ b/index.html @@ -45,7 +45,7 @@


- Or use my current location. + Or use my current location, - Facebook auth - diff --git a/js/site.js b/js/site.js index 4a4989f..f61c04a 100644 --- a/js/site.js +++ b/js/site.js @@ -141,3 +141,39 @@ function clearFields() { $("#category").val(''); $("#address").val(''); } + + +function fetch_facebook_page_url() { + + var page_url = prompt("Copy/paste in your businesses facebook page url; ie: https://www.facebook.com/pages/Adelaide-Hills-Stationery/517688011766722?fref=ts'"); + var parts = page_url.split("/"); + var fbid = parts[parts.length-1].split("?")[0]; + + FB.api( + '/' + fbid + '/', + 'GET', + {"fields":"id,name,about,single_line_address,website,is_always_open,payment_options,hours,location,category,category_list,company_overview,description,general_info,is_permanently_closed,link,parking,phone,place_type,public_transit,store_location_descriptor"}, + function(response) { + $('#address').val(response.single_line_address); + $("#find").submit(); + + $('#name').val(response.name); + $('#phone').val(response.phone); + $('#website').val(response.link); + $('#opening_hours').val(response.hours); + } + ); + +} + +$('#fblogin').click(function () { + FB.getLoginStatus(function(response) { + if (response.status === 'connected') { + fetch_facebook_page_url(); + } else { + FB.login(function (response) { + fetch_facebook_page_url(); + }); + } + }); +}); \ No newline at end of file From 91e335b81a4f43836f56ebe28c702beaf4737a64 Mon Sep 17 00:00:00 2001 From: Daniel O'Connor Date: Sat, 18 Feb 2017 19:18:45 +1030 Subject: [PATCH 3/3] Typo --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 900e27a..a47810b 100644 --- a/index.html +++ b/index.html @@ -45,7 +45,7 @@


- Or use my current location, sync a facebook business page.