diff --git a/README.md b/README.md index 665dcf0..43179e6 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Just edit `example.js` and set your Facebook `appId`, then set the 'Website' fie ### The fun stuff (using the plugin) -1 - Make sure your user has authenticated your Facebook app. `user_photos` is required. `friends_photos` is required if you would like to browse a friend's photos. These are set in `example.js`. +1 - Make sure your user has authenticated your Facebook app. `user_photos` is required. This is set in `example.js`. 2 - Initialise the plugin. Here you can set options like toggling debug messages, your preferred classnames, etc. @@ -56,15 +56,13 @@ Just edit `example.js` and set your Facebook `appId`, then set the 'Website' fie autoDeselection : true }); -4 - Display the plugin instance when you need it. The plugin will automatically load the Facebook photos of the logged in user, or attempt to load the photos of the friend ID passed to the function. +4 - Display the plugin instance when you need it. The plugin will automatically load the Facebook photos of the logged in user. $(".photoSelect").click(function (e) { e.preventDefault(); - id = null; - if ( $(this).attr('data-id') ) id = $(this).attr('data-id'); - fbphotoSelect(id); + fbphotoSelect(); }); ### License -[MIT Licensed](http://en.wikipedia.org/wiki/MIT_License) \ No newline at end of file +[MIT Licensed](http://en.wikipedia.org/wiki/MIT_License) diff --git a/csphotoselector.js b/csphotoselector.js index 2d68491..406b434 100755 --- a/csphotoselector.js +++ b/csphotoselector.js @@ -85,16 +85,14 @@ var CSPhotoSelector = (function(module, $) { albums = []; for (var i=0; i'; }; }; - + /** * Load the Facebook photos and build the markup */ @@ -598,7 +596,7 @@ var CSPhotoSelector = (function(module, $) { buildSecondMarkup(); // Call the callback if (typeof callback === 'function') { - callback(); + callback(); // hide the loader and pagination $loader.hide(); $pagination.hide(); @@ -610,23 +608,23 @@ var CSPhotoSelector = (function(module, $) { return false; } }); - + // Build the markup of the photo selector buildSecondMarkup = function() { //loop through photos var i, len, html = ''; // if photos is empty, we need to try again - + if (!photos) { buildPhotoSelector(null, albumId); } for (i = 0, len = photos.length; i < len; i += 1) { html += buildPhotoMarkup(photos[i]); } - + $photos = $(html); }; - + buildPhotoMarkup = function(photo) { return '' + '' + diff --git a/example.js b/example.js index d0fc706..846804e 100644 --- a/example.js +++ b/example.js @@ -4,16 +4,16 @@ $(document).ready(function () { var selector, logActivity, callbackAlbumSelected, callbackPhotoUnselected, callbackSubmit; var buttonOK = $('#CSPhotoSelector_buttonOK'); var o = this; - - + + /* -------------------------------------------------------------------- * Photo selector functions * ----------------------------------------------------------------- */ - + fbphotoSelect = function(id) { // if no user/friend id is sent, default to current user if (!id) id = 'me'; - + callbackAlbumSelected = function(albumId) { var album, name; album = CSPhotoSelector.getAlbumById(albumId); @@ -66,12 +66,12 @@ $(document).ready(function () { selector.reset(); selector.showAlbumSelector(id); } - - + + /* -------------------------------------------------------------------- * Click events * ----------------------------------------------------------------- */ - + $("#btnLogin").click(function (e) { e.preventDefault(); FB.login(function (response) { @@ -80,23 +80,21 @@ $(document).ready(function () { } else { $("#login-status").html("Not logged in"); } - }, {scope:'user_photos, friends_photos'}); + }, {scope:'user_photos'}); }); - + $("#btnLogout").click(function (e) { e.preventDefault(); FB.logout(); $("#login-status").html("Not logged in"); }); - + $(".photoSelect").click(function (e) { e.preventDefault(); - id = null; - if ( $(this).attr('data-id') ) id = $(this).attr('data-id'); - fbphotoSelect(id); + fbphotoSelect(); }); logActivity = function (message) { $("#results").append('
' + message + '
'); }; -}); \ No newline at end of file +}); diff --git a/index.html b/index.html index 0e830b6..22e15b2 100644 --- a/index.html +++ b/index.html @@ -31,7 +31,6 @@

Example

ACTIVITY LOG

@@ -40,16 +39,12 @@

Example

Features

-

Search your friend's photos

-

Simply pass a friend's ID to fbphotoSelect() via the data-id attribute on the link. If left blank, the current user's photos are selected.

-

Some users have their photos hidden no matter what permissions you ask for, so you may be faced with a brick wall.

-