1/* 2 * Modified version of Flickrush 1.3 - A jQuery flickr plugin 3 * 4 * Copyright (c) 2010 Philip Beel (http://www.theodin.co.uk/) 5 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 6 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. 7 * 8 * Revision: $Id: jquery.flickrush.js 2013-09-15 $ 9 * 10 */ 11(function($){ 12 13 $.fn.flickrush=function(options) 14 { 15 16 var defaults = { 17 limit:3, 18 random:true, 19 id:'30005186@N02', 20 tags:false 21 }; 22 23 var options = $.extend(defaults,options) 24 , flickrurl; 25 26 // Is the document secure 27 isSSL = (location.protocol === "https:") ? true : false ; 28 29 if(isSSL) 30 flickrurl = "https://secure.flickr.com/services/feeds/photos_public.gne?format=json"; 31 else 32 flickrurl = "http://api.flickr.com/services/feeds/photos_public.gne?format=json"; 33 34 35 if(defaults.tags === true) 36 flickrurl += '&tags=' + defaults.tags; 37 38 // Return each instance of the flickrush 39 return this.each(function(options) 40 { 41 var act = $(this) 42 , apiCall = flickrurl; 43 44 $.getJSON(apiCall + "&id=" + defaults.id + "&jsoncallback=?", 45 46 function(data) 47 { 48 var flickrImage 49 , integer 50 , flickrImages = [] 51 , flickrLinks = [] 52 ,i; 53 54 // Loop through each image item 55 $.each(data.items, function(i,item) 56 { 57 58 // Create an image DOM node 59 if (i <= defaults.limit-1) 60 { 61 var flickrImg = $('<img/>', { 62 src: item.media.m, 63 alt: item.tags 64 }); 65 66 // Assign the image with attributes 67 flickrImage = $('<a></a>',{ 68 target: '_blank', 69 href: item.link 70 }).append( flickrImg ); 71 72 // Push flickr images into array 73 flickrImages.push(flickrImage); 74 } 75 76 }); 77 78 // Mix the order of flickr images if required 79 if(defaults.random === true) 80 { 81 // Randomise the image array order 82 flickrImages.sort(function() { 83 return 0.5 - Math.random(); 84 }); 85 } 86 87 // append flickr images to the specified DOM element 88 for (var i = 0; i < flickrImages.length; i++) { 89 $(act).append(flickrImages[i]); 90 }; 91 }); 92 93 }); 94 } 95})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.