Takes advantage of Facebook Connect api to ease make use of it
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



Takes advantage of Facebook Connect api to ease make use of it.

How to use

First you need to follow Facebook instructions on how to include it on a site.
You can read about at http://developers.facebook.com/docs/

As a simple example, you could use the following lines at Document Head:

		<title>My Fantastic Facebook App</title>
		<script type="text/javascript" src="mootools-core.js" />
		<script type="text/javascript" src="Class.SubObjectMapping.js" />
		<script type="text/javascript" src="MooFB.js" />
		[... whatever else you have in your document head]
		<h1>Connect JavaScript - MooTools Login Example</h1>
		  <button id="login">Login</button>
		  <button id="logout">Logout</button>
		  <button id="perms">Ask for perms</button>
		[... whatever else code you have in your document body]

You have to register a Facebook app at (you have to login to Facebook): http://www.facebook.com/developers/createapp.php
then use the Facebook app id to create an instance of MooFB this way:
var moofb = new MooFB.Base(myFBAppId);

My personal recommendation is that use automatic options, which are enabled by default.
Otherwise you would have to read how to include and load the Facebook api by yourself.

Facebook documentation is a little messy but with some effort you can find what you need.
Read about at: http://developers.facebook.com/docs/reference/javascript/

How to make api calls

After you FB api has loaded, you can call for other methods, like login, logout, etc:

$('login').addEvent('click', function() {
	moofb.login(function(response) {
		if(response.session) {
			if(response.perms) {

Or better make use of events for asynchronous calls:

var moofb = new MooFB.Base(myFBAppId).addEvents({
	login: function(response) {
	logout: function(response) {

How to ask for permissions

$('perms').addEvent('click', function() {
	moofb.login(function(response) {
		if(response.session) {
			if(response.perms) {
	}.bind(moofb), {perms: 'read_stream,publish_stream'});

You can see the whole table of permissions you can request at http://developers.facebook.com/docs/authentication/permissions/

Coming Soon

You can already request for user's data, pictures, albums and other, but, I'm writing a class to make it even easier.
Please be patient.


Donations are welcome. By donating you contribute to this and other Open Source efforts.