Skip to content

Instantly share code, notes, and snippets.

@lukegalea
Created March 11, 2013 02:12
Show Gist options
  • Save lukegalea/5131484 to your computer and use it in GitHub Desktop.
Save lukegalea/5131484 to your computer and use it in GitHub Desktop.
A CodePen by Luke Galea.
<img id="face" src="http://www.precisionnutrition.com/wordpress/wp-content/uploads/2008/10/Phil.jpg"/>
<div id="fbdiv">
<div id="fb-root">
<fb:like href="http://precisionnutrition.com/about" send="false" width="450"
show_faces="false" data-layout="button_count"></fb:like>
</div>
</div>
<div id="login">
<p><button onClick="loginUser();">Login</button></p>
</div>
<div id="logout">
<p><button onClick="FB.logout();">Logout</button></p>
</div>
window.loginUser = function() {
console.log("Logging user in");
FB.login(function(response) {
console.log("Login response", response);
}, {scope:'email,user_likes'});
};
window.fbAsyncInit = function () {
FB.init({
appId: '608580832488741',
status: true,
cookie: true,
xfbml: true,
oauth: true
});
FB.Event.subscribe('edge.create', function (response) {
document.getElementById("face").src = 'http://www.precisionnutrition.com/wordpress/wp-content/uploads/2009/04/Alaina.jpg';
//alert('You liked the URL: ' + response);
});
var handleStatusChange = function() {
console.log("staus change:", arguments);
}
FB.Event.subscribe('auth.statusChange', handleStatusChange);
FB.login(function(response) {
console.log("Login response", response);
}, {scope:'email'});
};
(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
//js.src = "//connect.facebook.net/en_US/all.js#appId=608580832488741&xfbml=1";
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
/*(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/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
js.async = true;
}(document, 'script', 'facebook-jssdk'));*/
#fbdiv {
position: relative;
left: 166px;
top: -216px;
width: 200px;
height: 100px;
}
img {
height: 600px;
width: 450px;
}
.fb-like, fb\:like {
transform: scale(3);
-webkit-transform: scale(3);
-moz-transform: scale(3);
-o-transform: scale(3);
-ms-transform: scale(3);
transform: scale(3);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment