-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathjquery-embedagram.js
More file actions
42 lines (36 loc) · 1000 Bytes
/
jquery-embedagram.js
File metadata and controls
42 lines (36 loc) · 1000 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
* embedagram - embed your instagram photos
* http://embedagram.com/plugin
*
* Copyright (c) 2011 Matthew Hokanson (http://h0ke.com)
* Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
*/
(function($){
$.fn.extend({
embedagram: function(options) {
// set the defaults
var defaults = {
instagram_id: -999,
thumb_width: 100,
wrap_tag: 'li',
limit: 20,
success: function() { return true; },
};
var options = $.extend(defaults, options);
return this.each(function() {
var o = options;
var obj = $(this);
// set the jsonp url
var jsonp_url = "http://embedagram.com/e/plugin/" + o.instagram_id + "/?callback=?";
jsonp_url += "&thumb_width=" + o.thumb_width + "&wrap_tag=" + o.wrap_tag;
jsonp_url += "&limit=" + o.limit;
// get the json yo!
$.getJSON(jsonp_url, function(data) {
obj.html(data.html);
o.success.apply(obj);
});
return obj;
});
}
});
})(jQuery);