Skip to content

beth-panx/jquery.facebook

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jQuery Facebook-Plugin

Facebook Like-Button

	$(document).ready(function() {
		$('.likebutton').facebook("likebutton", {
			url : "http://jquery.com",
			action : "like"
		});
	});

This code will add a Facebook like button to the divs with the class .likebutton

Like-Button-Settings

  • url String - the url to like
  • action String - action type of the button: "like" or "recommend"

Facebook Login (Facebook 2.0 API ready)

		var facebook = $.facebook({
			appid : 0,      // <------------------------- PUT YOUR APP ID IN HERE !!!!!!!!!!!!!
			locale : "en_EN",
			scope : "email"
		});
		
		facebook.onLoginConnected = function(response) {
			// the user is logged in and has authenticated your
			// app. it's now time to send the access token to the server to log the user into your app
			// after that you would redirect the user to the member area -> window.location = "http:// ...";
			var uid = response.authResponse.userID;
			var accessToken = response.authResponse.accessToken;
			alert("The user " + uid + " is logged in into Facebook AND connected to your app! (access token: " + accessToken + ")");
		};
		
		facebook.onLoginNotAuthorized = facebook.onLoginNotLoggedIn = function() {
			// the user is logged in to Facebook,
			// but has not authenticated your app
		};
		
		facebook.onLoginCancelled = function() {
			// the user has canceled the login dialog or has not granted all permissions
			// best practise is to tell the user why you need the permissions.
			alert("Please grant the permissions in order to have full access to all the good things in the app!");
		};

Settings

  • appid BigInt - the app id which can be found in the developer center of Facebook
  • locale String - the country and language code like en_EN or de_DE
  • scope String - comma seperated string of Facebook permissions

Demo

http://jquery.grizzly.cc/facebook/

License

http://opensource.org/licenses/MIT

About

Facebook wrapper

Resources

Stars

Watchers

Forks

Packages

No packages published