/** * Plugin: jquery.zFlickrFeed * * Version: 1.0.2 * (c) Copyright 2011, Zazar Ltd * * Description: jQuery plugin for display of Flickr photo feeds * * History: * 1.0.2 - Fixed date option when not displaying * 1.0.1 - Corrected issue with multiple instances * **/ (function($){ $.fn.flickrfeed = function(userid, tags, options) { // Set pluign defaults var defaults = { limit: 10, header: true, imagesize: 'small', titletag: 'h4', title: true, date: true }; var options = $.extend(defaults, options); // Functions return this.each(function(i, e) { var $e = $(e); // Add feed class to user div if (!$e.hasClass('flickrFeed')) $e.addClass('flickrFeed'); // Define Flickr feed API address var api = 'http://api.flickr.com/services/feeds/photos_public.gne?lang=en-us&format=json&jsoncallback=?'; if (userid != '') api += '&id=' + userid; if (tags != '') api += '&tags=' + tags; // Send request $.getJSON(api, function(data){ // Process the feeds _callback(e, data, options); }); }); }; // Callback function to create HTML result var _callback = function(e, data, options) { if (!data) { return false; } var html = ''; var row = 'odd'; // Add header if required if (options.header) var desc = data.description; if (desc == '') desc = data.title; html += '