Last active
December 30, 2015 21:17
-
-
Save MicBrain/d1f6fcdd04fd988623f0 to your computer and use it in GitHub Desktop.
Sending request to your Facebook friends
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<head> | |
<title>First Meteor App.</title> | |
</head> | |
<body> | |
<h1> fb-welcome</h1> | |
<script> | |
window.fbAsyncInit = function() { | |
FB.init({ | |
appId : '444506449070273', | |
xfbml : true, | |
version : 'v2.5' | |
}); | |
/* FB.ui({method: 'apprequests', | |
message: 'This is just a simple test.', | |
}, function(response){ | |
console.log(response); | |
});*/ | |
FB.ui({ | |
method: 'send', | |
link: 'https://codefights.com', | |
}); | |
// ADD ADDITIONAL FACEBOOK CODE HERE | |
function onLogin(response) { | |
if (response.status == 'connected') { | |
FB.api('/me?fields=first_name', function(data) { | |
var welcomeBlock = document.getElementById('fb-welcome'); | |
welcomeBlock.innerHTML = 'Hello, ' + data.first_name + '!'; | |
}); | |
} | |
} | |
FB.getLoginStatus(function(response) { | |
// Check login status on load, and if the user is | |
// already logged in, go directly to the welcome message. | |
if (response.status == 'connected') { | |
onLogin(response); | |
} else { | |
// Otherwise, show Login dialog first. | |
FB.login(function(response) { | |
onLogin(response); | |
}, {scope: 'user_friends, email'}); | |
} | |
}); | |
}; | |
(function(d, s, id){ | |
var js, fjs = d.getElementsByTagName(s)[0]; | |
if (d.getElementById(id)) {return;} | |
js = d.createElement(s); js.id = id; | |
js.src = "//connect.facebook.net/en_US/sdk.js"; | |
fjs.parentNode.insertBefore(js, fjs); | |
}(document, 'script', 'facebook-jssdk')); | |
</script> | |
<h1> Testing Facebook Intergration with Like and Share Buttons. </h1> | |
<div | |
class="fb-like" | |
data-share="true" | |
data-width="450" | |
data-show-faces="true"> | |
</div> | |
</body> | |
<template name="hello"> | |
<button>Click Me</button> | |
<p>You've pressed the button {{counter}} times.</p> | |
</template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment