-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathneedium-fetchinfo.min.js
8 lines (6 loc) · 1.67 KB
/
needium-fetchinfo.min.js
1
2
3
4
5
6
7
8
/***
needium-fetchinfo 0.0.0
Needium UI's Detail Fetcher, acts as an operator for 3rd party API info fetching.
Copyright 2011 Francois Lafortune, @quickredfox (http://about.me/quickredfox)
***/
(function(){var a,b,c,d,e,f,g,h,i;h=typeof process!="undefined"&&process.versions&&!!process.versions.node,h?a=i=require("jquery"):a=i=window.jQuery,b=require("jquery-d"),d=require("jquery-fetch"),c=function(a,b){var c,d,e,f;e=a,f=function(c,d){try{return e=d.call(null,a,b)}catch(f){return console.log("Error in filter: "+c)}};for(d in g)c=g[d],f(d,c);return e},g={google_static_map:function(b,c){var d;if(c!=="json")return b;d=function(b){(a.isPlainObject(b)||b instanceof Array)&&a.each(b,function(a,c){a==="coordinates"&&c.type&&c.type==="Point"&&c.coordinates&&(b.google_static_map="http://maps.google.com/maps/api/staticmap?size=500x300&markers=color:blue|label:N|"+c.coordinates.reverse().join(",")+"&sensor=false");return b[a]=d(c)});return b};return d(b)}},e={twitter:{user:function(a){return d({url:"http://api.twitter.com/1/users/show.json?screen_name="+a,dataType:"jsonp",dataFilter:c})},hashtag:function(a){return d({url:"http://search.twitter.com/search.json?q=%23"+a+"&rpp=10",dataType:"jsonp",dataFilter:c}).pipe(function(a){return a.results?a.results:a})},tweets:function(a){return d({url:"http://api.twitter.com/1/statuses/user_timeline.json?screen_name="+a+"&count=10",dataType:"jsonp",dataFilter:c})},profile:function(a){var c;c={user:this.user(a),tweets:this.tweets(a)};return b.deep(c).pipe(function(a){var b;b=a.user,b.public_timeline=a.tweets;return b})}}},f=function(a,b,c){var d;a=e[a];if(a){d=a[b];if(d&&typeof d=="function")return d.call(a,c)}},module.exports=f}).call(this)