Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

0.0.15 pinboard & dailymotion support. Changes to pinboard:

 - formatting to 2 spaces indentation
 - add example
  • Loading branch information...
commit 00e122286310d1f7d5354c55feee19b419af9cce 1 parent b957a04
@christianv authored
View
2  README.md
@@ -19,6 +19,7 @@ Currently supports the following feeds natively:
* [Github](http://github.com)
* [Google Reader](http://google.com/reader)
* [Last.fm](http://last.fm)
+* [Pinboard](http://pinboard.com)
* [Reddit](http://reddit.com)
* [Slideshare](http://slideshare.com)
* [Stackoverflow](http://stackoverflow.com)
@@ -121,6 +122,7 @@ Places on the web where this plug-in got mentioned:
## Version log
+* 0.0.15 Dailymotion & Pinboard support
* 0.0.14 Slideshare support
* 0.0.13 Vimeo support
* 0.0.12 Reddit support
View
4 example.html
@@ -114,6 +114,10 @@
user: "denbuzze"
},
{
+ service: "pinboard",
+ user: "mattandrews"
+ },
+ {
service: "reddit",
user: "simongee"
},
View
21 jquery.lifestream-compiled.js
@@ -12,13 +12,14 @@ c+'">'+a.payload.name+"</a>"}else if(a.type==="CommitCommentEvent"||a.type==="Is
"tag")){f=d(a);j=a.payload.ref_type||a.payload.object;c=a.payload.ref||a.payload.object_name;e+="created "+j+' <a href="'+a.url+'">'+c+'</a> for <a href="http://github.com/'+f+'">'+f+"</a>"}else if(a.type==="CreateEvent"){c=a.payload.object_name==="null"?a.payload.name:a.payload.object_name;e+="created "+a.payload.object+' <a href="'+a.url+'">'+c+"</a>"}else if(a.type==="DeleteEvent")e+="deleted "+a.payload.ref_type+' <a href="http://github.com/'+a.repository.owner+"/"+a.repository.name+'">'+a.payload.ref+
"</a>";return e};h.ajax({url:k('select json.repository.owner,json.repository.name,json.payload,json.type,json.url, json.created_at from json where url="http://github.com/'+g.user+'.json"'),dataType:"jsonp",success:function(a){var e=[],c=0,f;if(a.query&&a.query.count&&a.query.count>0)for(f=a.query.count;c<f;c++){var j=a.query.results.json[c].json;e.push({date:new Date(j.created_at),service:g.service,html:b(j)})}i(e)}})};h.fn.lifestream.feeds.googlereader=function(g,i){h.ajax({url:k('select * from xml where url="www.google.com/reader/public/atom/user%2F'+
g.user+'%2Fstate%2Fcom.google%2Fstarred"'),dataType:"jsonp",success:function(d){var b=[],a=0,e;if(d.query&&d.query.count&&d.query.count>0){d=d.query.results.feed.entry;for(e=d.length;a<e;a++){var c=d[a];b.push({date:new Date(parseInt(c["crawl-timestamp-msec"],10)),service:g.service,html:'starred post <a href="'+c.link.href+'">'+c.title.content+"</a>"})}}i(b)}})};h.fn.lifestream.feeds.lastfm=function(g,i){var d=function(b){var a="";a+='loved <a href="'+b.url+'">'+b.name+'</a> by <a href="'+b.artist.url+
-'">'+b.artist.name+"</a>";return a};h.ajax({url:k('select * from xml where url="http://ws.audioscrobbler.com/2.0/user/'+g.user+'/lovedtracks.xml"'),dataType:"jsonp",success:function(b){var a=[],e=0,c;if(b.query&&b.query.count&&b.query.count>0&&b.query.results.lovedtracks&&b.query.results.lovedtracks.track){b=b.query.results.lovedtracks.track;for(c=b.length;e<c;e++){var f=b[e];a.push({date:new Date(parseInt(f.date.uts*1E3,10)),service:g.service,html:d(f)})}}i(a)}})};h.fn.lifestream.feeds.reddit=function(g,
-i){var d=function(b){var a="",e="",c="http://www.reddit.com/r/"+b.data.subreddit,f=b.data.ups-b.data.downs;f=f>0?"+"+f:f;if(b.kind==="t1"){e="http://www.reddit.com/r/"+b.data.subreddit+"/comments/"+b.data.link_id.substring(3)+"/u/"+b.data.name.substring(3)+"?context=3";a+='<a href="'+e+'">commented ('+f+")</a> "}else if(b.kind==="t3")a+='<a href="http://www.reddit.com'+b.data.permalink+'">created new thread ('+f+")</a> ";a+=' in <a href="'+c+'">/r/'+b.data.subreddit+"</a>";return a};h.ajax({url:"http://www.reddit.com/user/"+
-g.user+".json",dataType:"jsonp",jsonp:"jsonp",success:function(b){var a=[],e=0,c;if(b&&b.data&&b.data.children&&b.data.children.length>0)for(c=b.data.children.length;e<c;e++){var f=b.data.children[e];a.push({date:new Date(f.data.created*1E3),service:g.service,html:d(f)})}i(a)}})};h.fn.lifestream.feeds.slideshare=function(g,i){h.ajax({url:k('select * from xml where url="http://www.slideshare.net/rss/user/'+g.user+'"'),dataType:"jsonp",success:function(d){var b=[],a=0,e,c;if(d.query&&d.query.count&&
-d.query.count>0){d=d.query.results.rss.channel.item;for(e=d.length;a<e;a++){c=d[a];b.push({date:new Date(c.pubDate),service:g.service,html:'uploaded a presentation <a href="'+c.link+'">'+c.title+"</a>"})}}i(b)}})};h.fn.lifestream.feeds.stackoverflow=function(g,i){var d=function(b){var a="",e="",c="",f="",j="http://stackoverflow.com/users/"+g.user;if(b.timeline_type==="badge"){e=b.timeline_type+" "+b.action+": "+b.description;c=b.detail;f=j+"?tab=reputation"}else if(b.timeline_type==="revision"||b.timeline_type===
-"comment"||b.timeline_type==="accepted"||b.timeline_type==="askoranswered"){e=b.post_type+" "+b.action;c=b.detail||b.description||"";f="http://stackoverflow.com/questions/"+b.post_id}a+='<a href="'+f+'" title="'+c+'">'+e+"</a> - "+c;return a};h.ajax({url:"http://api.stackoverflow.com/1.1/users/"+g.user+"/timeline?jsonp",dataType:"jsonp",jsonp:"jsonp",success:function(b){var a=[],e=0,c;if(b&&b.total&&b.total>0&&b.user_timelines)for(c=b.user_timelines.length;e<c;e++){var f=b.user_timelines[e];a.push({date:new Date(f.creation_date*
-1E3),service:g.service,html:d(f)})}i(a)}})};h.fn.lifestream.feeds.tumblr=function(g,i){var d=function(b,a){return{date:new Date(a.date),service:b.service,html:"posted a "+a.type+' <a href="'+a.url+'">'+(a["regular-title"]||a["quote-text"]||a["conversation-title"]||a["photo-caption"]||a["video-caption"]||a["audio-caption"]||a["regular-body"]||a["link-text"]||a.type||"").replace(/\<.+?\>/gi," ")+"</a>"}};h.ajax({url:k('select * from tumblr.posts where username="'+g.user+'"'),dataType:"jsonp",success:function(b){var a=
-[],e=0,c,f;if(b.query&&b.query.count&&b.query.count>0)if(h.isArray(b.query.results.posts.post))for(c=b.query.results.posts.post.length;e<c;e++){f=b.query.results.posts.post[e];a.push(d(g,f))}else h.isPlainObject(b.query.results.posts.post)&&a.push(d(g,b.query.results.posts.post));i(a)}})};h.fn.lifestream.feeds.twitter=function(g,i){var d=function(b){return h.fn.lifestream.linkify(b).replace(/ #([A-Za-z0-9\/\.]*)/g,function(a){return' <a target="_new" href="http://twitter.com/search?q='+a.replace(" #",
-"%23")+'">'+a+"</a>"}).replace(/@[\w]+/g,function(a){return'<a href="http://www.twitter.com/'+a.replace("@","")+'">'+a+"</a>"})};h.ajax({url:k('select status.id, status.created_at, status.text from twitter.user.timeline where screen_name="'+g.user+'"'),dataType:"jsonp",success:function(b){var a=[],e=0,c;if(b.query&&b.query.count&&b.query.count>0)for(c=b.query.count;e<c;e++){var f=b.query.results.statuses[e].status;a.push({date:new Date(f.created_at),service:g.service,html:d(f.text)})}i(a)}})};h.fn.lifestream.feeds.vimeo=
-function(g,i){h.ajax({url:"http://vimeo.com/api/v2/"+g.user+"/videos.json",dataType:"jsonp",crossDomain:true,success:function(d){var b=[],a=0,e,c;if(d)for(e=d.length;a<e;a++){c=d[a];b.push({date:new Date(c.upload_date),service:g.service,html:'published a video <a href="'+c.url+'" title="'+c.description.replace(/"/g,"'").replace(/\<.+?\>/gi,"")+'">'+c.title+"</a>"})}i(b)}})};h.fn.lifestream.feeds.youtube=function(g,i){h.ajax({url:"http://gdata.youtube.com/feeds/api/users/"+g.user+"/favorites?v=2&alt=jsonc",
-dataType:"jsonp",success:function(d){var b=[],a=0,e,c;if(d.data&&d.data.items)for(e=d.data.items.length;a<e;a++){c=d.data.items[a];b.push({date:new Date(c.created),service:g.service,html:' favorited <a href="'+c.video.player["default"]+'" title="'+c.video.description+'">'+c.video.title+"</a>"})}i(b)}})}})(jQuery);
+'">'+b.artist.name+"</a>";return a};h.ajax({url:k('select * from xml where url="http://ws.audioscrobbler.com/2.0/user/'+g.user+'/lovedtracks.xml"'),dataType:"jsonp",success:function(b){var a=[],e=0,c;if(b.query&&b.query.count&&b.query.count>0&&b.query.results.lovedtracks&&b.query.results.lovedtracks.track){b=b.query.results.lovedtracks.track;for(c=b.length;e<c;e++){var f=b[e];a.push({date:new Date(parseInt(f.date.uts*1E3,10)),service:g.service,html:d(f)})}}i(a)}})};h.fn.lifestream.feeds.pinboard=
+function(g,i){h.ajax({url:k('select * from xml where url="http://feeds.pinboard.in/rss/u:'+g.user+'"'),dataType:"jsonp",success:function(d){var b=[],a=0,e,c;if(d.query&&d.query.count&&d.query.count>0){d=d.query.results.RDF.item;for(e=d.length;a<e;a++){c=d[a];b.push({date:new Date(c.date),service:g.service,html:'added bookmark <a href="'+c.link+'">'+c.title+"</a>"})}}i(b)}})};h.fn.lifestream.feeds.reddit=function(g,i){var d=function(b){var a="",e="",c="http://www.reddit.com/r/"+b.data.subreddit,f=
+b.data.ups-b.data.downs;f=f>0?"+"+f:f;if(b.kind==="t1"){e="http://www.reddit.com/r/"+b.data.subreddit+"/comments/"+b.data.link_id.substring(3)+"/u/"+b.data.name.substring(3)+"?context=3";a+='<a href="'+e+'">commented ('+f+")</a> "}else if(b.kind==="t3")a+='<a href="http://www.reddit.com'+b.data.permalink+'">created new thread ('+f+")</a> ";a+=' in <a href="'+c+'">/r/'+b.data.subreddit+"</a>";return a};h.ajax({url:"http://www.reddit.com/user/"+g.user+".json",dataType:"jsonp",jsonp:"jsonp",success:function(b){var a=
+[],e=0,c;if(b&&b.data&&b.data.children&&b.data.children.length>0)for(c=b.data.children.length;e<c;e++){var f=b.data.children[e];a.push({date:new Date(f.data.created*1E3),service:g.service,html:d(f)})}i(a)}})};h.fn.lifestream.feeds.slideshare=function(g,i){h.ajax({url:k('select * from xml where url="http://www.slideshare.net/rss/user/'+g.user+'"'),dataType:"jsonp",success:function(d){var b=[],a=0,e,c;if(d.query&&d.query.count&&d.query.count>0){d=d.query.results.rss.channel.item;for(e=d.length;a<e;a++){c=
+d[a];b.push({date:new Date(c.pubDate),service:g.service,html:'uploaded a presentation <a href="'+c.link+'">'+c.title+"</a>"})}}i(b)}})};h.fn.lifestream.feeds.stackoverflow=function(g,i){var d=function(b){var a="",e="",c="",f="",j="http://stackoverflow.com/users/"+g.user;if(b.timeline_type==="badge"){e=b.timeline_type+" "+b.action+": "+b.description;c=b.detail;f=j+"?tab=reputation"}else if(b.timeline_type==="revision"||b.timeline_type==="comment"||b.timeline_type==="accepted"||b.timeline_type==="askoranswered"){e=
+b.post_type+" "+b.action;c=b.detail||b.description||"";f="http://stackoverflow.com/questions/"+b.post_id}a+='<a href="'+f+'" title="'+c+'">'+e+"</a> - "+c;return a};h.ajax({url:"http://api.stackoverflow.com/1.1/users/"+g.user+"/timeline?jsonp",dataType:"jsonp",jsonp:"jsonp",success:function(b){var a=[],e=0,c;if(b&&b.total&&b.total>0&&b.user_timelines)for(c=b.user_timelines.length;e<c;e++){var f=b.user_timelines[e];a.push({date:new Date(f.creation_date*1E3),service:g.service,html:d(f)})}i(a)}})};h.fn.lifestream.feeds.tumblr=
+function(g,i){var d=function(b,a){return{date:new Date(a.date),service:b.service,html:"posted a "+a.type+' <a href="'+a.url+'">'+(a["regular-title"]||a["quote-text"]||a["conversation-title"]||a["photo-caption"]||a["video-caption"]||a["audio-caption"]||a["regular-body"]||a["link-text"]||a.type||"").replace(/\<.+?\>/gi," ")+"</a>"}};h.ajax({url:k('select * from tumblr.posts where username="'+g.user+'"'),dataType:"jsonp",success:function(b){var a=[],e=0,c,f;if(b.query&&b.query.count&&b.query.count>0)if(h.isArray(b.query.results.posts.post))for(c=
+b.query.results.posts.post.length;e<c;e++){f=b.query.results.posts.post[e];a.push(d(g,f))}else h.isPlainObject(b.query.results.posts.post)&&a.push(d(g,b.query.results.posts.post));i(a)}})};h.fn.lifestream.feeds.twitter=function(g,i){var d=function(b){return h.fn.lifestream.linkify(b).replace(/ #([A-Za-z0-9\/\.]*)/g,function(a){return' <a target="_new" href="http://twitter.com/search?q='+a.replace(" #","%23")+'">'+a+"</a>"}).replace(/@[\w]+/g,function(a){return'<a href="http://www.twitter.com/'+a.replace("@",
+"")+'">'+a+"</a>"})};h.ajax({url:k('select status.id, status.created_at, status.text from twitter.user.timeline where screen_name="'+g.user+'"'),dataType:"jsonp",success:function(b){var a=[],e=0,c;if(b.query&&b.query.count&&b.query.count>0)for(c=b.query.count;e<c;e++){var f=b.query.results.statuses[e].status;a.push({date:new Date(f.created_at),service:g.service,html:d(f.text)})}i(a)}})};h.fn.lifestream.feeds.vimeo=function(g,i){h.ajax({url:"http://vimeo.com/api/v2/"+g.user+"/videos.json",dataType:"jsonp",
+crossDomain:true,success:function(d){var b=[],a=0,e,c;if(d)for(e=d.length;a<e;a++){c=d[a];b.push({date:new Date(c.upload_date),service:g.service,html:'published a video <a href="'+c.url+'" title="'+c.description.replace(/"/g,"'").replace(/\<.+?\>/gi,"")+'">'+c.title+"</a>"})}i(b)}})};h.fn.lifestream.feeds.youtube=function(g,i){h.ajax({url:"http://gdata.youtube.com/feeds/api/users/"+g.user+"/favorites?v=2&alt=jsonc",dataType:"jsonp",success:function(d){var b=[],a=0,e,c;if(d.data&&d.data.items)for(e=
+d.data.items.length;a<e;a++){c=d.data.items[a];b.push({date:new Date(c.created),service:g.service,html:' favorited <a href="'+c.video.player["default"]+'" title="'+c.video.description+'">'+c.video.title+"</a>"})}i(b)}})}})(jQuery);
View
52 jquery.lifestream.js
@@ -1,6 +1,6 @@
/*!
* jQuery Lifestream Plug-in
- * @version 0.0.14
+ * @version 0.0.15
* Show a stream of your online activity
*
* Copyright 2011, Christian Vuerings - http://denbuzze.com
@@ -663,38 +663,38 @@
$.fn.lifestream.feeds.pinboard = function (obj, callback) {
- var parsePinboard = function (input) {
- var output = [], list, i = 0, j, item;
+ var parsePinboard = function (input) {
+ var output = [], list, i = 0, j, item;
- if (input.query && input.query.count && input.query.count > 0) {
- list = input.query.results.RDF.item;
- j = list.length;
- for ( ; i < j; i++) {
- item = list[i];
+ if (input.query && input.query.count && input.query.count > 0) {
+ list = input.query.results.RDF.item;
+ j = list.length;
+ for ( ; i < j; i++) {
+ item = list[i];
- output.push({
- date: new Date(item.date),
- service: obj.service,
- html: 'added bookmark <a href="' + item.link + '">'
- + item.title + '</a>'
- });
+ output.push({
+ date: new Date(item.date),
+ service: obj.service,
+ html: 'added bookmark <a href="' + item.link + '">'
+ + item.title + '</a>'
+ });
- }
}
+ }
- return output;
- };
+ return output;
+ };
- $.ajax({
- url: createYqlUrl('select * from xml where '
- + 'url="http://feeds.pinboard.in/rss/u:' + obj.user + '"'),
- dataType: "jsonp",
- success: function (data) {
- callback(parsePinboard(data));
- }
- });
+ $.ajax({
+ url: createYqlUrl('select * from xml where '
+ + 'url="http://feeds.pinboard.in/rss/u:' + obj.user + '"'),
+ dataType: "jsonp",
+ success: function (data) {
+ callback(parsePinboard(data));
+ }
+ });
- };
+ };
$.fn.lifestream.feeds.reddit = function(obj, callback){
View
4 jquery.lifestream.min.js
@@ -1,8 +1,8 @@
/*!
* jQuery Lifestream Plug-in
- * @version 0.0.14
+ * @version 0.0.15
* Show a stream of your online activity
*
* Copyright 2011, Christian Vuerings - http://denbuzze.com
*/
-(function($){var createYqlUrl=function(query){return("http://query.yahooapis.com/v1/public/yql?q=__QUERY__&env=store://datatables.org/alltableswithkeys&format=json").replace("__QUERY__",encodeURIComponent(query))};$.fn.lifestream=function(config){var outputElement=this,settings=jQuery.extend({classname:"lifestream",limit:10},config),data={count:settings.list.length,items:[]},itemsettings=jQuery.extend(true,{},settings),finished=function(inputdata){$.merge(data.items,inputdata);data.items.sort(function(a,b){if(a.date>b.date){return -1}else{if(a.date===b.date){return 0}else{return 1}}});var ul=$('<ul class="'+settings.classname+'"/>'),length=(data.items.length<settings.limit)?data.items.length:settings.limit,i=0;for(;i<length;i++){if(data.items[i].html){ul.append('<li class="'+settings.classname+"-"+data.items[i].service+'">'+data.items[i].html+"</li>")}}outputElement.html(ul)},load=function(){var i=0,j=settings.list.length;delete itemsettings.list;for(;i<j;i++){var item=settings.list[i];if($.fn.lifestream.feeds[item.service]&&$.isFunction($.fn.lifestream.feeds[item.service])&&item.user){item._settings=itemsettings;$.fn.lifestream.feeds[item.service](item,finished)}}};load()};$.fn.lifestream.linkify=(function(){var SCHEME="[a-z\\d.-]+://",IPV4="(?:(?:[0-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])\\.){3}(?:[0-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])",HOSTNAME="(?:(?:[^\\s!@#$%^&*()_=+[\\]{}\\\\|;:'\",.<>/?]+)\\.)+",TLD="(?:ac|ad|aero|ae|af|ag|ai|al|am|an|ao|aq|arpa|ar|asia|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|biz|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|cat|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|coop|com|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|info|int|in|io|iq|ir|is|it|je|jm|jobs|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mil|mk|ml|mm|mn|mobi|mo|mp|mq|mr|ms|mt|museum|mu|mv|mw|mx|my|mz|name|na|nc|net|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pro|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tel|tf|tg|th|tj|tk|tl|tm|tn|to|tp|travel|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|xn--0zwm56d|xn--11b5bs3a9aj6g|xn--80akhbyknj4f|xn--9t4b11yi5a|xn--deba0ad|xn--g6w251d|xn--hgbk6aj7f53bba|xn--hlcj6aya9esc7a|xn--jxalpdlp|xn--kgbechtv|xn--zckzah|ye|yt|yu|za|zm|zw)",HOST_OR_IP="(?:"+HOSTNAME+TLD+"|"+IPV4+")",PATH="(?:[;/][^#?<>\\s]*)?",QUERY_FRAG="(?:\\?[^#<>\\s]*)?(?:#[^<>\\s]*)?",URI1="\\b"+SCHEME+"[^<>\\s]+",URI2="\\b"+HOST_OR_IP+PATH+QUERY_FRAG+"(?!\\w)",MAILTO="mailto:",EMAIL="(?:"+MAILTO+")?[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@"+HOST_OR_IP+QUERY_FRAG+"(?!\\w)",URI_RE=new RegExp("(?:"+URI1+"|"+URI2+"|"+EMAIL+")","ig"),SCHEME_RE=new RegExp("^"+SCHEME,"i"),quotes={"'":"`",">":"<",")":"(","]":"[","}":"{","»":"«","›":"‹"},default_options={callback:function(text,href){return href?'<a href="'+href+'" title="'+href+'">'+text+"</a>":text},punct_regexp:/(?:[!?.,:;'"]|(?:&|&amp;)(?:lt|gt|quot|apos|raquo|laquo|rsaquo|lsaquo);)$/};return function(txt,options){options=options||{};var arr,i,link,href,html="",parts=[],idx_prev,idx_last,idx,link_last,matches_begin,matches_end,quote_begin,quote_end;for(i in default_options){if(default_options.hasOwnProperty(i)&&options[i]===undefined){options[i]=default_options[i]}}while(arr=URI_RE.exec(txt)){link=arr[0];idx_last=URI_RE.lastIndex;idx=idx_last-link.length;if(/[\/:]/.test(txt.charAt(idx-1))){continue}do{link_last=link;quote_end=link.substr(-1);quote_begin=quotes[quote_end];if(quote_begin){matches_begin=link.match(new RegExp("\\"+quote_begin+"(?!$)","g"));matches_end=link.match(new RegExp("\\"+quote_end,"g"));if((matches_begin?matches_begin.length:0)<(matches_end?matches_end.length:0)){link=link.substr(0,link.length-1);idx_last--}}if(options.punct_regexp){link=link.replace(options.punct_regexp,function(a){idx_last-=a.length;return""})}}while(link.length&&link!==link_last);href=link;if(!SCHEME_RE.test(href)){href=(href.indexOf("@")!==-1?(!href.indexOf(MAILTO)?"":MAILTO):!href.indexOf("irc.")?"irc://":!href.indexOf("ftp.")?"ftp://":"http://")+href}if(idx_prev!=idx){parts.push([txt.slice(idx_prev,idx)]);idx_prev=idx_last}parts.push([link,href])}parts.push([txt.substr(idx_prev)]);for(i=0;i<parts.length;i++){html+=options.callback.apply(window,parts[i])}return html||txt}}());$.fn.lifestream.feeds=$.fn.lifestream.feeds||{};$.fn.lifestream.feeds.dailymotion=function(obj,callback){var parseDailymotion=function(input){var output=[],list,i=0,j,item;if(input.query&&input.query.count&&input.query.count>0&&input.query.results.rss.channel.item){list=input.query.results.rss.channel.item;j=list.length;for(;i<j;i++){item=list[i];output.push({date:new Date(item.pubDate),service:obj.service,html:'uploaded a video <a href="'+item.link+'">'+item.title+"</a>"})}}return output};$.ajax({url:createYqlUrl('select * from xml where url="http://www.dailymotion.com/rss/user/'+obj.user+'"'),dataType:"jsonp",success:function(data){callback(parseDailymotion(data))}})};$.fn.lifestream.feeds.delicious=function(obj,callback){var parseDeliciousItem=function(item){var output="";output+='added bookmark <a href="'+item.u+'">'+item.d+"</a>";return output};$.ajax({url:"http://feeds.delicious.com/v2/json/"+obj.user,dataType:"jsonp",success:function(data){var output=[],i=0,j;if(data&&data.length&&data.length>0){j=data.length;for(;i<j;i++){var item=data[i];output.push({date:new Date(item.dt),service:obj.service,html:parseDeliciousItem(item)})}}callback(output)}})};$.fn.lifestream.feeds.deviantart=function(obj,callback){$.ajax({url:createYqlUrl('select title,link,pubDate from rss where url="http://backend.deviantart.com/rss.xml?q=gallery%3A'+encodeURIComponent(obj.user)+'&type=deviation" | unique(field="title")'),dataType:"jsonp",success:function(resp){var output=[],items,item,i=0,j;if(resp.query&&resp.query.count>0){items=resp.query.results.item;j=items.length;for(;i<j;++i){item=items[i];output.push({date:new Date(item.pubDate),service:obj.service,html:'posted <a href="'+item.link+'">'+item.title+"</a>"})}}callback(output)}})};$.fn.lifestream.feeds.dribbble=function(obj,callback){var parseDribbbleItem=function(item){var output='posted a shot <a href="'+item.url+'">'+item.title+"</a>";return output};$.ajax({url:"http://api.dribbble.com/players/"+obj.user+"/shots",dataType:"jsonp",success:function(data){var output=[],i=0,j;if(data&&data.total){j=data.shots.length;for(;i<j;i++){var item=data.shots[i];output.push({date:new Date(item.created_at),service:obj.service,html:parseDribbbleItem(item)})}}callback(output)}})};$.fn.lifestream.feeds.flickr=function(obj,callback){var parseFlickrItem=function(item){var output='posted a photo <a href="'+item.link+'">'+item.title+"</a>";return output};$.ajax({url:"http://api.flickr.com/services/feeds/photos_public.gne?id="+obj.user+"&lang=en-us&format=json",dataType:"jsonp",jsonp:"jsoncallback",success:function(data){var output=[],i=0,j;if(data&&data.items&&data.items.length>0){j=data.items.length;for(;i<j;i++){var item=data.items[i];output.push({date:new Date(item.published),service:obj.service,html:parseFlickrItem(item)})}}callback(output)}})};$.fn.lifestream.feeds.foursquare=function(obj,callback){var parseFoursquareStatus=function(item){var output='checked in @ <a href="'+item.link+'">'+item.title+"</a>";return output},parseFoursquare=function(input){var output=[],i=0,j;if(input.query&&input.query.count&&input.query.count>0){j=input.query.count;for(;i<j;i++){var status=input.query.results.item[i];output.push({date:new Date(status.pubDate),service:obj.service,html:parseFoursquareStatus(status)})}}return output};$.ajax({url:createYqlUrl('select * from rss where url="https://feeds.foursquare.com/history/'+obj.user+'.rss"'),dataType:"jsonp",success:function(data){callback(parseFoursquare(data))}})};$.fn.lifestream.feeds.github=function(obj,callback){var returnRepo=function(status){return status.payload.repo||status.repository.owner+"/"+status.repository.name},parseGithubStatus=function(status){var output="",name,repo,title,type;if(status.type==="PushEvent"){title="";repo=returnRepo(status);if(status.payload&&status.payload.shas&&status.payload.shas.json&&status.payload.shas.json[2]){title=status.payload.shas.json[2]+" by "+status.payload.shas.json[3]}output+='<a href="'+status.url+'" title="'+title+'">pushed</a> to <a href="http://github.com/'+repo+'">'+repo+"</a>"}else{if(status.type==="GistEvent"){title=status.payload.desc||"";output+=status.payload.action+'d <a href="'+status.payload.url+'" title ="'+title+'">'+status.payload.name+"</a>"}else{if(status.type==="CommitCommentEvent"||status.type==="IssueCommentEvent"){repo=returnRepo(status);output+='<a href="'+status.url+'">commented</a> on <a href="http://github.com/'+repo+'">'+repo+"</a>"}else{if(status.type==="PullRequestEvent"){repo=status.payload.repo||status.repository.owner+"/"+status.repository.name;output+='<a href="'+status.url+'">'+status.payload.action+'</a> pull request on <a href="http://github.com/'+repo+'">'+repo+"</a>"}else{if(status.type==="CreateEvent"&&(status.payload.ref_type==="tag"||status.payload.ref_type==="branch"||status.payload.object==="tag")){repo=returnRepo(status);type=status.payload.ref_type||status.payload.object;name=status.payload.ref||status.payload.object_name;output+="created "+type+' <a href="'+status.url+'">'+name+'</a> for <a href="http://github.com/'+repo+'">'+repo+"</a>"}else{if(status.type==="CreateEvent"){name=(status.payload.object_name==="null")?status.payload.name:status.payload.object_name;output+="created "+status.payload.object+' <a href="'+status.url+'">'+name+"</a>"}else{if(status.type==="DeleteEvent"){output+="deleted "+status.payload.ref_type+' <a href="http://github.com/'+status.repository.owner+"/"+status.repository.name+'">'+status.payload.ref+"</a>"}}}}}}}return output},parseGithub=function(input){var output=[],i=0,j;if(input.query&&input.query.count&&input.query.count>0){j=input.query.count;for(;i<j;i++){var status=input.query.results.json[i].json;output.push({date:new Date(status.created_at),service:obj.service,html:parseGithubStatus(status)})}}return output};$.ajax({url:createYqlUrl('select json.repository.owner,json.repository.name,json.payload,json.type,json.url, json.created_at from json where url="http://github.com/'+obj.user+'.json"'),dataType:"jsonp",success:function(data){callback(parseGithub(data))}})};$.fn.lifestream.feeds.googlereader=function(obj,callback){var parseReaderEntry=function(entry){return'starred post <a href="'+entry.link.href+'">'+entry.title.content+"</a>"},parseReader=function(input){var output=[],list,i=0,j;if(input.query&&input.query.count&&input.query.count>0){list=input.query.results.feed.entry;j=list.length;for(;i<j;i++){var entry=list[i];output.push({date:new Date(parseInt(entry["crawl-timestamp-msec"],10)),service:obj.service,html:parseReaderEntry(entry)})}}return output};$.ajax({url:createYqlUrl('select * from xml where url="www.google.com/reader/public/atom/user%2F'+obj.user+'%2Fstate%2Fcom.google%2Fstarred"'),dataType:"jsonp",success:function(data){callback(parseReader(data))}})};$.fn.lifestream.feeds.lastfm=function(obj,callback){var parseLastfmEntry=function(entry){var output="";output+='loved <a href="'+entry.url+'">'+entry.name+'</a> by <a href="'+entry.artist.url+'">'+entry.artist.name+"</a>";return output},parseLastfm=function(input){var output=[],list,i=0,j;if(input.query&&input.query.count&&input.query.count>0&&input.query.results.lovedtracks&&input.query.results.lovedtracks.track){list=input.query.results.lovedtracks.track;j=list.length;for(;i<j;i++){var entry=list[i];output.push({date:new Date(parseInt((entry.date.uts*1000),10)),service:obj.service,html:parseLastfmEntry(entry)})}}return output};$.ajax({url:createYqlUrl('select * from xml where url="http://ws.audioscrobbler.com/2.0/user/'+obj.user+'/lovedtracks.xml"'),dataType:"jsonp",success:function(data){callback(parseLastfm(data))}})};$.fn.lifestream.feeds.reddit=function(obj,callback){var parseRedditItem=function(item){var output="",thread_link="",subreddit_link="http://www.reddit.com/r/"+item.data.subreddit,score=item.data.ups-item.data.downs;score=(score>0)?"+"+score:score;if(item.kind==="t1"){thread_link="http://www.reddit.com/r/"+item.data.subreddit+"/comments/"+item.data.link_id.substring(3)+"/u/"+item.data.name.substring(3)+"?context=3";output+='<a href="'+thread_link+'">commented ('+score+")</a> "}else{if(item.kind==="t3"){output+='<a href="http://www.reddit.com'+item.data.permalink+'">created new thread ('+score+")</a> "}}output+=' in <a href="'+subreddit_link+'">/r/'+item.data.subreddit+"</a>";return output},convertDate=function(date){return new Date(date*1000)};$.ajax({url:"http://www.reddit.com/user/"+obj.user+".json",dataType:"jsonp",jsonp:"jsonp",success:function(data){var output=[],i=0,j;if(data&&data.data&&data.data.children&&data.data.children.length>0){j=data.data.children.length;for(;i<j;i++){var item=data.data.children[i];output.push({date:convertDate(item.data.created),service:obj.service,html:parseRedditItem(item)})}}callback(output)}})};$.fn.lifestream.feeds.slideshare=function(obj,callback){var parseSlideshare=function(input){var output=[],list,i=0,j,item;if(input.query&&input.query.count&&input.query.count>0){list=input.query.results.rss.channel.item;j=list.length;for(;i<j;i++){item=list[i];output.push({date:new Date(item.pubDate),service:obj.service,html:'uploaded a presentation <a href="'+item.link+'">'+item.title+"</a>"})}}return output};$.ajax({url:createYqlUrl('select * from xml where url="http://www.slideshare.net/rss/user/'+obj.user+'"'),dataType:"jsonp",success:function(data){callback(parseSlideshare(data))}})};$.fn.lifestream.feeds.stackoverflow=function(obj,callback){var parseStackoverflowItem=function(item){var output="",text="",title="",link="",stackoverflow_link="http://stackoverflow.com/users/"+obj.user,question_link="http://stackoverflow.com/questions/";if(item.timeline_type==="badge"){text=item.timeline_type+" "+item.action+": "+item.description;title=item.detail;link=stackoverflow_link+"?tab=reputation"}else{if(item.timeline_type==="revision"||item.timeline_type==="comment"||item.timeline_type==="accepted"||item.timeline_type==="askoranswered"){text=item.post_type+" "+item.action;title=item.detail||item.description||"";link=question_link+item.post_id}}output+='<a href="'+link+'" title="'+title+'">'+text+"</a> - "+title;return output},convertDate=function(date){return new Date(date*1000)};$.ajax({url:"http://api.stackoverflow.com/1.1/users/"+obj.user+"/timeline?jsonp",dataType:"jsonp",jsonp:"jsonp",success:function(data){var output=[],i=0,j;if(data&&data.total&&data.total>0&&data.user_timelines){j=data.user_timelines.length;for(;i<j;i++){var item=data.user_timelines[i];output.push({date:convertDate(item.creation_date),service:obj.service,html:parseStackoverflowItem(item)})}}callback(output)}})};$.fn.lifestream.feeds.tumblr=function(obj,callback){var getTitle=function(post){var title=post["regular-title"]||post["quote-text"]||post["conversation-title"]||post["photo-caption"]||post["video-caption"]||post["audio-caption"]||post["regular-body"]||post["link-text"]||post.type||"";return title.replace(/\<.+?\>/gi," ")},createTumblrOutput=function(obj,post){return{date:new Date(post.date),service:obj.service,html:"posted a "+post.type+' <a href="'+post.url+'">'+getTitle(post)+"</a>"}},parseTumblr=function(input){var output=[],i=0,j,post;if(input.query&&input.query.count&&input.query.count>0){if($.isArray(input.query.results.posts.post)){j=input.query.results.posts.post.length;for(;i<j;i++){post=input.query.results.posts.post[i];output.push(createTumblrOutput(obj,post))}}else{if($.isPlainObject(input.query.results.posts.post)){output.push(createTumblrOutput(obj,input.query.results.posts.post))}}}return output};$.ajax({url:createYqlUrl('select * from tumblr.posts where username="'+obj.user+'"'),dataType:"jsonp",success:function(data){callback(parseTumblr(data))}})};$.fn.lifestream.feeds.twitter=function(obj,callback){var addTwitterLinks=function(tweet){return $.fn.lifestream.linkify(tweet).replace(/ #([A-Za-z0-9\/\.]*)/g,function(m){return' <a target="_new" href="http://twitter.com/search?q='+m.replace(" #","%23")+'">'+m+"</a>"}).replace(/@[\w]+/g,function(m){return'<a href="http://www.twitter.com/'+m.replace("@","")+'">'+m+"</a>"})},parseTwitter=function(input){var output=[],i=0,j;if(input.query&&input.query.count&&input.query.count>0){j=input.query.count;for(;i<j;i++){var status=input.query.results.statuses[i].status;output.push({date:new Date(status.created_at),service:obj.service,html:addTwitterLinks(status.text)})}}return output};$.ajax({url:createYqlUrl('select status.id, status.created_at, status.text from twitter.user.timeline where screen_name="'+obj.user+'"'),dataType:"jsonp",success:function(data){callback(parseTwitter(data))}})};$.fn.lifestream.feeds.vimeo=function(obj,callback){var parseVimeoItem=function(item){return'published a video <a href="'+item.url+'" title="'+item.description.replace(/"/g,"'").replace(/\<.+?\>/gi,"")+'">'+item.title+"</a>"},parseVimeo=function(input){var output=[],i=0,j,item;if(input){j=input.length;for(;i<j;i++){item=input[i];output.push({date:new Date(item.upload_date),service:obj.service,html:parseVimeoItem(item)})}}return output};$.ajax({url:"http://vimeo.com/api/v2/"+obj.user+"/videos.json",dataType:"jsonp",crossDomain:true,success:function(data){callback(parseVimeo(data))}})};$.fn.lifestream.feeds.youtube=function(obj,callback){var parseYoutubeItem=function(item){return' favorited <a href="'+item.video.player["default"]+'" title="'+item.video.description+'">'+item.video.title+"</a>"},parseYoutube=function(input){var output=[],i=0,j,item;if(input.data&&input.data.items){j=input.data.items.length;for(;i<j;i++){item=input.data.items[i];output.push({date:new Date(item.created),service:obj.service,html:parseYoutubeItem(item)})}}return output};$.ajax({url:"http://gdata.youtube.com/feeds/api/users/"+obj.user+"/favorites?v=2&alt=jsonc",dataType:"jsonp",success:function(data){callback(parseYoutube(data))}})}}(jQuery));
+(function($){var createYqlUrl=function(query){return("http://query.yahooapis.com/v1/public/yql?q=__QUERY__&env=store://datatables.org/alltableswithkeys&format=json").replace("__QUERY__",encodeURIComponent(query))};$.fn.lifestream=function(config){var outputElement=this,settings=jQuery.extend({classname:"lifestream",limit:10},config),data={count:settings.list.length,items:[]},itemsettings=jQuery.extend(true,{},settings),finished=function(inputdata){$.merge(data.items,inputdata);data.items.sort(function(a,b){if(a.date>b.date){return -1}else{if(a.date===b.date){return 0}else{return 1}}});var ul=$('<ul class="'+settings.classname+'"/>'),length=(data.items.length<settings.limit)?data.items.length:settings.limit,i=0;for(;i<length;i++){if(data.items[i].html){ul.append('<li class="'+settings.classname+"-"+data.items[i].service+'">'+data.items[i].html+"</li>")}}outputElement.html(ul)},load=function(){var i=0,j=settings.list.length;delete itemsettings.list;for(;i<j;i++){var item=settings.list[i];if($.fn.lifestream.feeds[item.service]&&$.isFunction($.fn.lifestream.feeds[item.service])&&item.user){item._settings=itemsettings;$.fn.lifestream.feeds[item.service](item,finished)}}};load()};$.fn.lifestream.linkify=(function(){var SCHEME="[a-z\\d.-]+://",IPV4="(?:(?:[0-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])\\.){3}(?:[0-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])",HOSTNAME="(?:(?:[^\\s!@#$%^&*()_=+[\\]{}\\\\|;:'\",.<>/?]+)\\.)+",TLD="(?:ac|ad|aero|ae|af|ag|ai|al|am|an|ao|aq|arpa|ar|asia|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|biz|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|cat|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|coop|com|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|info|int|in|io|iq|ir|is|it|je|jm|jobs|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mil|mk|ml|mm|mn|mobi|mo|mp|mq|mr|ms|mt|museum|mu|mv|mw|mx|my|mz|name|na|nc|net|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pro|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tel|tf|tg|th|tj|tk|tl|tm|tn|to|tp|travel|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|xn--0zwm56d|xn--11b5bs3a9aj6g|xn--80akhbyknj4f|xn--9t4b11yi5a|xn--deba0ad|xn--g6w251d|xn--hgbk6aj7f53bba|xn--hlcj6aya9esc7a|xn--jxalpdlp|xn--kgbechtv|xn--zckzah|ye|yt|yu|za|zm|zw)",HOST_OR_IP="(?:"+HOSTNAME+TLD+"|"+IPV4+")",PATH="(?:[;/][^#?<>\\s]*)?",QUERY_FRAG="(?:\\?[^#<>\\s]*)?(?:#[^<>\\s]*)?",URI1="\\b"+SCHEME+"[^<>\\s]+",URI2="\\b"+HOST_OR_IP+PATH+QUERY_FRAG+"(?!\\w)",MAILTO="mailto:",EMAIL="(?:"+MAILTO+")?[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@"+HOST_OR_IP+QUERY_FRAG+"(?!\\w)",URI_RE=new RegExp("(?:"+URI1+"|"+URI2+"|"+EMAIL+")","ig"),SCHEME_RE=new RegExp("^"+SCHEME,"i"),quotes={"'":"`",">":"<",")":"(","]":"[","}":"{","»":"«","›":"‹"},default_options={callback:function(text,href){return href?'<a href="'+href+'" title="'+href+'">'+text+"</a>":text},punct_regexp:/(?:[!?.,:;'"]|(?:&|&amp;)(?:lt|gt|quot|apos|raquo|laquo|rsaquo|lsaquo);)$/};return function(txt,options){options=options||{};var arr,i,link,href,html="",parts=[],idx_prev,idx_last,idx,link_last,matches_begin,matches_end,quote_begin,quote_end;for(i in default_options){if(default_options.hasOwnProperty(i)&&options[i]===undefined){options[i]=default_options[i]}}while(arr=URI_RE.exec(txt)){link=arr[0];idx_last=URI_RE.lastIndex;idx=idx_last-link.length;if(/[\/:]/.test(txt.charAt(idx-1))){continue}do{link_last=link;quote_end=link.substr(-1);quote_begin=quotes[quote_end];if(quote_begin){matches_begin=link.match(new RegExp("\\"+quote_begin+"(?!$)","g"));matches_end=link.match(new RegExp("\\"+quote_end,"g"));if((matches_begin?matches_begin.length:0)<(matches_end?matches_end.length:0)){link=link.substr(0,link.length-1);idx_last--}}if(options.punct_regexp){link=link.replace(options.punct_regexp,function(a){idx_last-=a.length;return""})}}while(link.length&&link!==link_last);href=link;if(!SCHEME_RE.test(href)){href=(href.indexOf("@")!==-1?(!href.indexOf(MAILTO)?"":MAILTO):!href.indexOf("irc.")?"irc://":!href.indexOf("ftp.")?"ftp://":"http://")+href}if(idx_prev!=idx){parts.push([txt.slice(idx_prev,idx)]);idx_prev=idx_last}parts.push([link,href])}parts.push([txt.substr(idx_prev)]);for(i=0;i<parts.length;i++){html+=options.callback.apply(window,parts[i])}return html||txt}}());$.fn.lifestream.feeds=$.fn.lifestream.feeds||{};$.fn.lifestream.feeds.dailymotion=function(obj,callback){var parseDailymotion=function(input){var output=[],list,i=0,j,item;if(input.query&&input.query.count&&input.query.count>0&&input.query.results.rss.channel.item){list=input.query.results.rss.channel.item;j=list.length;for(;i<j;i++){item=list[i];output.push({date:new Date(item.pubDate),service:obj.service,html:'uploaded a video <a href="'+item.link+'">'+item.title+"</a>"})}}return output};$.ajax({url:createYqlUrl('select * from xml where url="http://www.dailymotion.com/rss/user/'+obj.user+'"'),dataType:"jsonp",success:function(data){callback(parseDailymotion(data))}})};$.fn.lifestream.feeds.delicious=function(obj,callback){var parseDeliciousItem=function(item){var output="";output+='added bookmark <a href="'+item.u+'">'+item.d+"</a>";return output};$.ajax({url:"http://feeds.delicious.com/v2/json/"+obj.user,dataType:"jsonp",success:function(data){var output=[],i=0,j;if(data&&data.length&&data.length>0){j=data.length;for(;i<j;i++){var item=data[i];output.push({date:new Date(item.dt),service:obj.service,html:parseDeliciousItem(item)})}}callback(output)}})};$.fn.lifestream.feeds.deviantart=function(obj,callback){$.ajax({url:createYqlUrl('select title,link,pubDate from rss where url="http://backend.deviantart.com/rss.xml?q=gallery%3A'+encodeURIComponent(obj.user)+'&type=deviation" | unique(field="title")'),dataType:"jsonp",success:function(resp){var output=[],items,item,i=0,j;if(resp.query&&resp.query.count>0){items=resp.query.results.item;j=items.length;for(;i<j;++i){item=items[i];output.push({date:new Date(item.pubDate),service:obj.service,html:'posted <a href="'+item.link+'">'+item.title+"</a>"})}}callback(output)}})};$.fn.lifestream.feeds.dribbble=function(obj,callback){var parseDribbbleItem=function(item){var output='posted a shot <a href="'+item.url+'">'+item.title+"</a>";return output};$.ajax({url:"http://api.dribbble.com/players/"+obj.user+"/shots",dataType:"jsonp",success:function(data){var output=[],i=0,j;if(data&&data.total){j=data.shots.length;for(;i<j;i++){var item=data.shots[i];output.push({date:new Date(item.created_at),service:obj.service,html:parseDribbbleItem(item)})}}callback(output)}})};$.fn.lifestream.feeds.flickr=function(obj,callback){var parseFlickrItem=function(item){var output='posted a photo <a href="'+item.link+'">'+item.title+"</a>";return output};$.ajax({url:"http://api.flickr.com/services/feeds/photos_public.gne?id="+obj.user+"&lang=en-us&format=json",dataType:"jsonp",jsonp:"jsoncallback",success:function(data){var output=[],i=0,j;if(data&&data.items&&data.items.length>0){j=data.items.length;for(;i<j;i++){var item=data.items[i];output.push({date:new Date(item.published),service:obj.service,html:parseFlickrItem(item)})}}callback(output)}})};$.fn.lifestream.feeds.foursquare=function(obj,callback){var parseFoursquareStatus=function(item){var output='checked in @ <a href="'+item.link+'">'+item.title+"</a>";return output},parseFoursquare=function(input){var output=[],i=0,j;if(input.query&&input.query.count&&input.query.count>0){j=input.query.count;for(;i<j;i++){var status=input.query.results.item[i];output.push({date:new Date(status.pubDate),service:obj.service,html:parseFoursquareStatus(status)})}}return output};$.ajax({url:createYqlUrl('select * from rss where url="https://feeds.foursquare.com/history/'+obj.user+'.rss"'),dataType:"jsonp",success:function(data){callback(parseFoursquare(data))}})};$.fn.lifestream.feeds.github=function(obj,callback){var returnRepo=function(status){return status.payload.repo||status.repository.owner+"/"+status.repository.name},parseGithubStatus=function(status){var output="",name,repo,title,type;if(status.type==="PushEvent"){title="";repo=returnRepo(status);if(status.payload&&status.payload.shas&&status.payload.shas.json&&status.payload.shas.json[2]){title=status.payload.shas.json[2]+" by "+status.payload.shas.json[3]}output+='<a href="'+status.url+'" title="'+title+'">pushed</a> to <a href="http://github.com/'+repo+'">'+repo+"</a>"}else{if(status.type==="GistEvent"){title=status.payload.desc||"";output+=status.payload.action+'d <a href="'+status.payload.url+'" title ="'+title+'">'+status.payload.name+"</a>"}else{if(status.type==="CommitCommentEvent"||status.type==="IssueCommentEvent"){repo=returnRepo(status);output+='<a href="'+status.url+'">commented</a> on <a href="http://github.com/'+repo+'">'+repo+"</a>"}else{if(status.type==="PullRequestEvent"){repo=status.payload.repo||status.repository.owner+"/"+status.repository.name;output+='<a href="'+status.url+'">'+status.payload.action+'</a> pull request on <a href="http://github.com/'+repo+'">'+repo+"</a>"}else{if(status.type==="CreateEvent"&&(status.payload.ref_type==="tag"||status.payload.ref_type==="branch"||status.payload.object==="tag")){repo=returnRepo(status);type=status.payload.ref_type||status.payload.object;name=status.payload.ref||status.payload.object_name;output+="created "+type+' <a href="'+status.url+'">'+name+'</a> for <a href="http://github.com/'+repo+'">'+repo+"</a>"}else{if(status.type==="CreateEvent"){name=(status.payload.object_name==="null")?status.payload.name:status.payload.object_name;output+="created "+status.payload.object+' <a href="'+status.url+'">'+name+"</a>"}else{if(status.type==="DeleteEvent"){output+="deleted "+status.payload.ref_type+' <a href="http://github.com/'+status.repository.owner+"/"+status.repository.name+'">'+status.payload.ref+"</a>"}}}}}}}return output},parseGithub=function(input){var output=[],i=0,j;if(input.query&&input.query.count&&input.query.count>0){j=input.query.count;for(;i<j;i++){var status=input.query.results.json[i].json;output.push({date:new Date(status.created_at),service:obj.service,html:parseGithubStatus(status)})}}return output};$.ajax({url:createYqlUrl('select json.repository.owner,json.repository.name,json.payload,json.type,json.url, json.created_at from json where url="http://github.com/'+obj.user+'.json"'),dataType:"jsonp",success:function(data){callback(parseGithub(data))}})};$.fn.lifestream.feeds.googlereader=function(obj,callback){var parseReaderEntry=function(entry){return'starred post <a href="'+entry.link.href+'">'+entry.title.content+"</a>"},parseReader=function(input){var output=[],list,i=0,j;if(input.query&&input.query.count&&input.query.count>0){list=input.query.results.feed.entry;j=list.length;for(;i<j;i++){var entry=list[i];output.push({date:new Date(parseInt(entry["crawl-timestamp-msec"],10)),service:obj.service,html:parseReaderEntry(entry)})}}return output};$.ajax({url:createYqlUrl('select * from xml where url="www.google.com/reader/public/atom/user%2F'+obj.user+'%2Fstate%2Fcom.google%2Fstarred"'),dataType:"jsonp",success:function(data){callback(parseReader(data))}})};$.fn.lifestream.feeds.lastfm=function(obj,callback){var parseLastfmEntry=function(entry){var output="";output+='loved <a href="'+entry.url+'">'+entry.name+'</a> by <a href="'+entry.artist.url+'">'+entry.artist.name+"</a>";return output},parseLastfm=function(input){var output=[],list,i=0,j;if(input.query&&input.query.count&&input.query.count>0&&input.query.results.lovedtracks&&input.query.results.lovedtracks.track){list=input.query.results.lovedtracks.track;j=list.length;for(;i<j;i++){var entry=list[i];output.push({date:new Date(parseInt((entry.date.uts*1000),10)),service:obj.service,html:parseLastfmEntry(entry)})}}return output};$.ajax({url:createYqlUrl('select * from xml where url="http://ws.audioscrobbler.com/2.0/user/'+obj.user+'/lovedtracks.xml"'),dataType:"jsonp",success:function(data){callback(parseLastfm(data))}})};$.fn.lifestream.feeds.pinboard=function(obj,callback){var parsePinboard=function(input){var output=[],list,i=0,j,item;if(input.query&&input.query.count&&input.query.count>0){list=input.query.results.RDF.item;j=list.length;for(;i<j;i++){item=list[i];output.push({date:new Date(item.date),service:obj.service,html:'added bookmark <a href="'+item.link+'">'+item.title+"</a>"})}}return output};$.ajax({url:createYqlUrl('select * from xml where url="http://feeds.pinboard.in/rss/u:'+obj.user+'"'),dataType:"jsonp",success:function(data){callback(parsePinboard(data))}})};$.fn.lifestream.feeds.reddit=function(obj,callback){var parseRedditItem=function(item){var output="",thread_link="",subreddit_link="http://www.reddit.com/r/"+item.data.subreddit,score=item.data.ups-item.data.downs;score=(score>0)?"+"+score:score;if(item.kind==="t1"){thread_link="http://www.reddit.com/r/"+item.data.subreddit+"/comments/"+item.data.link_id.substring(3)+"/u/"+item.data.name.substring(3)+"?context=3";output+='<a href="'+thread_link+'">commented ('+score+")</a> "}else{if(item.kind==="t3"){output+='<a href="http://www.reddit.com'+item.data.permalink+'">created new thread ('+score+")</a> "}}output+=' in <a href="'+subreddit_link+'">/r/'+item.data.subreddit+"</a>";return output},convertDate=function(date){return new Date(date*1000)};$.ajax({url:"http://www.reddit.com/user/"+obj.user+".json",dataType:"jsonp",jsonp:"jsonp",success:function(data){var output=[],i=0,j;if(data&&data.data&&data.data.children&&data.data.children.length>0){j=data.data.children.length;for(;i<j;i++){var item=data.data.children[i];output.push({date:convertDate(item.data.created),service:obj.service,html:parseRedditItem(item)})}}callback(output)}})};$.fn.lifestream.feeds.slideshare=function(obj,callback){var parseSlideshare=function(input){var output=[],list,i=0,j,item;if(input.query&&input.query.count&&input.query.count>0){list=input.query.results.rss.channel.item;j=list.length;for(;i<j;i++){item=list[i];output.push({date:new Date(item.pubDate),service:obj.service,html:'uploaded a presentation <a href="'+item.link+'">'+item.title+"</a>"})}}return output};$.ajax({url:createYqlUrl('select * from xml where url="http://www.slideshare.net/rss/user/'+obj.user+'"'),dataType:"jsonp",success:function(data){callback(parseSlideshare(data))}})};$.fn.lifestream.feeds.stackoverflow=function(obj,callback){var parseStackoverflowItem=function(item){var output="",text="",title="",link="",stackoverflow_link="http://stackoverflow.com/users/"+obj.user,question_link="http://stackoverflow.com/questions/";if(item.timeline_type==="badge"){text=item.timeline_type+" "+item.action+": "+item.description;title=item.detail;link=stackoverflow_link+"?tab=reputation"}else{if(item.timeline_type==="revision"||item.timeline_type==="comment"||item.timeline_type==="accepted"||item.timeline_type==="askoranswered"){text=item.post_type+" "+item.action;title=item.detail||item.description||"";link=question_link+item.post_id}}output+='<a href="'+link+'" title="'+title+'">'+text+"</a> - "+title;return output},convertDate=function(date){return new Date(date*1000)};$.ajax({url:"http://api.stackoverflow.com/1.1/users/"+obj.user+"/timeline?jsonp",dataType:"jsonp",jsonp:"jsonp",success:function(data){var output=[],i=0,j;if(data&&data.total&&data.total>0&&data.user_timelines){j=data.user_timelines.length;for(;i<j;i++){var item=data.user_timelines[i];output.push({date:convertDate(item.creation_date),service:obj.service,html:parseStackoverflowItem(item)})}}callback(output)}})};$.fn.lifestream.feeds.tumblr=function(obj,callback){var getTitle=function(post){var title=post["regular-title"]||post["quote-text"]||post["conversation-title"]||post["photo-caption"]||post["video-caption"]||post["audio-caption"]||post["regular-body"]||post["link-text"]||post.type||"";return title.replace(/\<.+?\>/gi," ")},createTumblrOutput=function(obj,post){return{date:new Date(post.date),service:obj.service,html:"posted a "+post.type+' <a href="'+post.url+'">'+getTitle(post)+"</a>"}},parseTumblr=function(input){var output=[],i=0,j,post;if(input.query&&input.query.count&&input.query.count>0){if($.isArray(input.query.results.posts.post)){j=input.query.results.posts.post.length;for(;i<j;i++){post=input.query.results.posts.post[i];output.push(createTumblrOutput(obj,post))}}else{if($.isPlainObject(input.query.results.posts.post)){output.push(createTumblrOutput(obj,input.query.results.posts.post))}}}return output};$.ajax({url:createYqlUrl('select * from tumblr.posts where username="'+obj.user+'"'),dataType:"jsonp",success:function(data){callback(parseTumblr(data))}})};$.fn.lifestream.feeds.twitter=function(obj,callback){var addTwitterLinks=function(tweet){return $.fn.lifestream.linkify(tweet).replace(/ #([A-Za-z0-9\/\.]*)/g,function(m){return' <a target="_new" href="http://twitter.com/search?q='+m.replace(" #","%23")+'">'+m+"</a>"}).replace(/@[\w]+/g,function(m){return'<a href="http://www.twitter.com/'+m.replace("@","")+'">'+m+"</a>"})},parseTwitter=function(input){var output=[],i=0,j;if(input.query&&input.query.count&&input.query.count>0){j=input.query.count;for(;i<j;i++){var status=input.query.results.statuses[i].status;output.push({date:new Date(status.created_at),service:obj.service,html:addTwitterLinks(status.text)})}}return output};$.ajax({url:createYqlUrl('select status.id, status.created_at, status.text from twitter.user.timeline where screen_name="'+obj.user+'"'),dataType:"jsonp",success:function(data){callback(parseTwitter(data))}})};$.fn.lifestream.feeds.vimeo=function(obj,callback){var parseVimeoItem=function(item){return'published a video <a href="'+item.url+'" title="'+item.description.replace(/"/g,"'").replace(/\<.+?\>/gi,"")+'">'+item.title+"</a>"},parseVimeo=function(input){var output=[],i=0,j,item;if(input){j=input.length;for(;i<j;i++){item=input[i];output.push({date:new Date(item.upload_date),service:obj.service,html:parseVimeoItem(item)})}}return output};$.ajax({url:"http://vimeo.com/api/v2/"+obj.user+"/videos.json",dataType:"jsonp",crossDomain:true,success:function(data){callback(parseVimeo(data))}})};$.fn.lifestream.feeds.youtube=function(obj,callback){var parseYoutubeItem=function(item){return' favorited <a href="'+item.video.player["default"]+'" title="'+item.video.description+'">'+item.video.title+"</a>"},parseYoutube=function(input){var output=[],i=0,j,item;if(input.data&&input.data.items){j=input.data.items.length;for(;i<j;i++){item=input.data.items[i];output.push({date:new Date(item.created),service:obj.service,html:parseYoutubeItem(item)})}}return output};$.ajax({url:"http://gdata.youtube.com/feeds/api/users/"+obj.user+"/favorites?v=2&alt=jsonc",dataType:"jsonp",success:function(data){callback(parseYoutube(data))}})}}(jQuery));
Please sign in to comment.
Something went wrong with that request. Please try again.