1/*! jQuery Instagram - v0.3.0 - 2013-08-10 2* http://potomak.github.com/jquery-instagram 3* Copyright (c) 2013 Giovanni Cappellotto; Licensed MIT */ 4(function($) { 5 6 function composeRequest(options) { 7 var url = 'https://api.instagram.com/v1'; 8 var data = {}; 9 10 if (options.accessToken == null && options.clientId == null) { 11 throw 'You must provide an access token or a client id'; 12 } 13 14 data = $.extend(data, { 15 access_token: options.accessToken, 16 client_id: options.clientId, 17 count: options.count 18 }); 19 20 if (options.url != null) { 21 url = options.url; 22 } 23 else if (options.hash != null) { 24 url += '/tags/' + options.hash + '/media/recent'; 25 } 26 else if (options.search != null) { 27 url += '/media/search'; 28 data = $.extend(data, options.search); 29 } 30 else if (options.userId != null) { 31 if (options.accessToken == null) { 32 throw 'You must provide an access token'; 33 } 34 url += '/users/' + options.userId + '/media/recent'; 35 } 36 else if (options.location != null) { 37 url += '/locations/' + options.location.id + '/media/recent'; 38 delete options.location.id; 39 data = $.extend(data, options.location); 40 } 41 else { 42 url += '/media/popular'; 43 } 44 45 return {url: url, data: data}; 46 } 47 48 $.fn.instagram = function(options) { 49 var that = this; 50 options = $.extend({}, $.fn.instagram.defaults, options); 51 var request = composeRequest(options); 52 53 $.ajax({ 54 dataType: "jsonp", 55 url: request.url, 56 data: request.data, 57 success: function(response) { 58 that.trigger('didLoadInstagram', response); 59 } 60 }); 61 62 this.trigger('willLoadInstagram', options); 63 64 return this; 65 }; 66 67 $.fn.instagram.defaults = { 68 accessToken: null, 69 clientId: null, 70 count: null, 71 url: null, 72 hash: null, 73 userId: null, 74 location: null, 75 search: null 76 }; 77 78}(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.