/*! * jQuery Lifestream Plug-in * Show a stream of your online activity * @version 0.5.5 * @author Christian Vuerings et al. * @copyright Copyright 2014, Christian Vuerings - http://denbuzze.com * @license https://github.com/christianvuerings/jquery-lifestream/blob/master/LICENSE MIT */ !function(e){"use strict";e.fn.lifestream=function(t){return this.each(function(){var r=e(this),a=jQuery.extend({classname:"lifestream",feedloaded:null,limit:10,list:[]},t),n={count:a.list.length,items:[]},s=jQuery.extend(!0,{},a),u=function(t){e.merge(n.items,t),n.items.sort(function(e,t){return t.date-e.date});for(var s,u=n.items,o=u.length');o>l;l++)s=u[l],s.html&&e('
  • ').data("name",s.config.service).data("url",s.url||"#").data("time",s.date).append(s.html).appendTo(i);r.html(i),e.isFunction(a.feedloaded)&&a.feedloaded()},o=function(){var t=0,r=a.list.length;for(delete s.list;r>t;t++){var n=a.list[t];e.fn.lifestream.feeds[n.service]&&e.isFunction(e.fn.lifestream.feeds[n.service])&&n.user&&(n._settings=s,e.fn.lifestream.feeds[n.service](n,u))}};jQuery.tmpl?o():jQuery.getScript("//ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js",o)})},e.fn.lifestream.createYqlUrl=function(e){return(("https:"===document.location.protocol?"https":"http")+"://query.yahooapis.com/v1/public/yql?q=__QUERY__&env=store://datatables.org/alltableswithkeys&format=json").replace("__QUERY__",encodeURIComponent(e))},e.fn.lifestream.feeds=e.fn.lifestream.feeds||{},Object.keys||(Object.keys=function(e){if(e!==Object(e))throw new TypeError("Object.keys called on non-object");var t,r=[];for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&r.push(t);return r})}(jQuery),function(e){e.fn.lifestream.feeds.atom=function(t,r){var a=e.extend({},{posted:'posted ${title.content}'},t.template),n=function(r){var n=[],s=[],u=0,o=0;if(r.query&&r.query.count&&r.query.count>0)for(s=r.query.results.feed.entry,o=s.length;o>u;u++){var l=s[u];n.push({url:l.link.href,date:new Date(l.updated),config:t,html:e.tmpl(a.posted,l)})}return n};return e.ajax({url:e.fn.lifestream.createYqlUrl('select * from xml where url="'+t.user+'"'),dataType:"jsonp",success:function(e){r(n(e))}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.bitbucket=function(t,r){var a=e.extend({},{commit:'committed at ${owner}/${name}',pullrequest_fulfilled:'fulfilled a pull request at ${owner}/${name}',pullrequest_rejected:'rejected a pull request at ${owner}/${name}',pullrequest_created:'created a pull request at ${owner}/${name}',create:'created a new project at ${owner}/${name}',fork:'forked ${owner}/${name}'},t.template),n=["commit","pullrequest_fulfilled","pullrequest_rejected","pullrequest_created","create","fork"],s=function(t){return-1!==e.inArray(t.event,n)&&t.repository?"commit"===t.event?e.tmpl(a.commit,{owner:t.repository.owner,name:t.repository.name,node:t.node}):e.tmpl(a[t.event],{owner:t.repository.owner,name:t.repository.name}):void 0},u=function(r){var a=[];return r.query&&r.query.count&&r.query.count>0&&e.each(r.query.results.json,function(){a.push({date:new Date(this.events.created_on.replace(/-/g,"/")),config:t,html:s(this.events)})}),a};return e.ajax({url:e.fn.lifestream.createYqlUrl('select events.event,events.node, events.created_on,events.repository.name, events.repository.owner from json where url = "https://api.bitbucket.org/1.0/users/'+t.user+'/events/"'),dataType:"jsonp",success:function(e){r(u(e))}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.bitly=function(t,r){var a=e.extend({},{created:'created URL ${short_url}'},t.template);return e.ajax({url:e.fn.lifestream.createYqlUrl('select data.short_url, data.created, data.title from json where url="http://bitly.com/u/'+t.user+'.json"'),dataType:"jsonp",success:function(n){var s,u,o=[],l=0;if(n.query&&n.query.count&&n.query.results.json)for(u=n.query.results.json,s=u.length;s>l;l++){var i=u[l].data;o.push({date:new Date(1e3*i.created),config:t,html:e.tmpl(a.created,i)})}r(o)}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.blogger=function(t,r){var a=e.extend({},{posted:'posted ${title}'},t.template),n=function(r){var n,s,u,o,l,i=[],c=0;if(r.query&&r.query.count&&r.query.count>0&&r.query.results.feed.entry)for(n=r.query.results.feed.entry,s=n.length;s>c;c++){if(u=n[c],!u.origLink)for(o=0,l=u.link.length;l>o;o++)"alternate"===u.link[o].rel&&(u.origLink=u.link[o].href);u.origLink&&(u.title.content&&(u.title=u.title.content),i.push({date:new Date(u.published),config:t,html:e.tmpl(a.posted,u)}))}return i};return e.ajax({url:e.fn.lifestream.createYqlUrl('select * from xml where url="http://'+t.user+'.blogspot.com/feeds/posts/default"'),dataType:"jsonp",success:function(e){r(n(e))}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.citeulike=function(t,r){var a=e.extend({},{saved:'saved ${title} by ${authors}'},t.template),n=function(r){var n,s=[],u=0;if(r&&r.length&&r.length>0)for(n=r.length;n>u;u++){var o=r[u];s.push({date:new Date(o.date),config:t,url:"https://www.citeulike.org/user/"+t.user,html:e.tmpl(a.saved,o)})}return s};return e.ajax({url:"https://www.citeulike.org/json/user/"+t.user,dataType:"jsonp",success:function(e){r(n(e))}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.dailymotion=function(t,r){var a=e.extend({},{uploaded:'uploaded a video ${title[0]}'},t.template),n=function(r){var n,s,u,o=[],l=0;if(r.query&&r.query.count&&r.query.count>0&&r.query.results.rss.channel.item)for(n=r.query.results.rss.channel.item,s=n.length;s>l;l++)u=n[l],o.push({date:new Date(u.pubDate),config:t,html:e.tmpl(a.uploaded,u)});return o};return e.ajax({url:e.fn.lifestream.createYqlUrl('select * from xml where url="http://www.dailymotion.com/rss/user/'+t.user+'"'),dataType:"jsonp",success:function(e){r(n(e))}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.delicious=function(t,r){var a=e.extend({},{bookmarked:'bookmarked ${d}'},t.template);return e.ajax({url:"https://api.del.icio.us/v2/json/"+t.user,dataType:"jsonp",success:function(n){var s,u=[],o=0;if(n&&n.length&&n.length>0)for(s=n.length;s>o;o++){var l=n[o];u.push({date:new Date(l.dt),config:t,html:e.tmpl(a.bookmarked,l)})}r(u)}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.deviantart=function(t,r){var a=e.extend({},{posted:'posted ${title}'},t.template);return e.ajax({url:e.fn.lifestream.createYqlUrl('select title,link,pubDate from rss where url="http://backend.deviantart.com/rss.xml?q=gallery%3A'+encodeURIComponent(t.user)+'&type=deviation" | unique(field="title")'),dataType:"jsonp",success:function(n){var s,u,o,l=[],i=0;if(n.query&&n.query.count>0)for(s=n.query.results.item,o=s.length;o>i;i++)u=s[i],l.push({date:new Date(u.pubDate),config:t,html:e.tmpl(a.posted,u)});r(l)}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.disqus=function(t,r){var a=e.extend({},{post:'commented on ${thread.title}',thread_like:'liked ${thread.title}'},t.template),n=function(r){var n,s,u=[],o=0;if(r)for(n=r.length;n>o;o++)s=r[o],"reply"!==s.type&&u.push({date:new Date(s.createdAt),config:t,html:e.tmpl(a[s.type],s.object)});return u};return e.ajax({url:"https://disqus.com/api/3.0/users/listActivity.json",data:{user:t.user,api_key:t.key},dataType:"jsonp",success:function(e){return 2===e.code?(r([]),void(console&&console.error&&console.error("Error loading Disqus stream.",e.response))):void r(n(e.response))}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.dribbble=function(t,r){var a=e.extend({},{posted:'posted a shot ${title}'},t.template);return e.ajax({url:"https://api.dribbble.com/players/"+t.user+"/shots",dataType:"jsonp",success:function(n){var s,u=[],o=0;if(n&&n.total)for(s=n.shots.length;s>o;o++){var l=n.shots[o];u.push({date:new Date(l.created_at),config:t,html:e.tmpl(a.posted,l)})}r(u)}}),{template:a}}}(jQuery),function(e){"use strict";e.fn.lifestream.feeds.facebook_page=function(t,r){var a=e.extend({},{wall_post:'posted ${text}'},t.template),n=function(n){var s=[];if(!n.posts||!n.posts.length)return s;for(var u=0;u${title}'},t.template),n=function(r){var n,s=[],u=0;if(r.query&&r.query.count&&r.query.count>0)for(n=r.query.count;n>u;u++){var o=r.query.results.item[u];s.push({date:new Date(o.pubDate),config:t,html:e.tmpl(a.fancied,o)})}return s};return e.ajax({url:e.fn.lifestream.createYqlUrl('SELECT * FROM xml WHERE url="http://www.fancy.com/rss/'+t.user+'" AND itemPath="/rss/channel/item"'),dataType:"jsonp",success:function(e){r(n(e))}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.flickr=function(t,r){var a=e.extend({},{posted:'posted a photo ${title}'},t.template);return e.ajax({url:"https://api.flickr.com/services/feeds/photos_public.gne?id="+t.user+"&lang=en-us&format=json",dataType:"jsonp",jsonp:"jsoncallback",success:function(n){var s,u=[],o=0;if(n&&n.items&&n.items.length>0)for(s=n.items.length;s>o;o++){var l=n.items[o];u.push({date:new Date(l.published),config:t,html:e.tmpl(a.posted,l)})}r(u)}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.foomark=function(t,r){var a=e.extend({},{bookmarked:'bookmarked ${url}'},t.template);return e.ajax({url:"http://api.foomark.com/urls/list/",data:{format:"jsonp",username:t.user},dataType:"jsonp",success:function(n){var s,u=[],o=0;if(n&&n.length&&n.length>0)for(s=n.length;s>o;o++){var l=n[o];u.push({date:new Date(l.created_at.replace(/-/g,"/")),config:t,html:e.tmpl(a.bookmarked,l)})}r(u)}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.formspring=function(t,r){var a=e.extend({},{answered:'answered a question ${title}'},t.template),n=function(r){var n,s,u,o=[],l=0;if(r.query&&r.query.count&&r.query.count>0&&r.query.results.rss.channel.item)for(n=r.query.results.rss.channel.item,s=n.length;s>l;l++)u=n[l],o.push({date:new Date(u.pubDate),config:t,html:e.tmpl(a.answered,u)});return o};return e.ajax({url:e.fn.lifestream.createYqlUrl('select * from xml where url="http://www.formspring.me/profile/'+t.user+'.rss"'),dataType:"jsonp",success:function(e){r(n(e))}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.forrst=function(t,r){var a=e.extend({},{posted:'posted a ${post_type} ${title}'},t.template);return e.ajax({url:"https://forrst.com/api/v2/users/posts?username="+t.user,dataType:"jsonp",success:function(n){var s,u=[],o=0;if(n&&n.resp.length&&n.resp.length>0)for(s=n.resp.length;s>o;o++){var l=n.resp[o];u.push({date:new Date(l.created_at.replace(" ","T")),config:t,html:e.tmpl(a.posted,l)})}r(u)}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.foursquare=function(t,r){var a=e.extend({},{checkedin:'checked in @ ${title}'},t.template),n=function(r){var n,s=[],u=0;if(r.query&&r.query.count&&r.query.count>0)for(n=r.query.count;n>u;u++){var o=r.query.results.item[u];s.push({date:new Date(o.pubDate),config:t,html:e.tmpl(a.checkedin,o)})}return s};return e.ajax({url:e.fn.lifestream.createYqlUrl('select * from rss where url="https://feeds.foursquare.com/history/'+t.user+'.rss"'),dataType:"jsonp",success:function(e){r(n(e))}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.gimmebar=function(t,r){var a=e.extend({},{bookmarked:'bookmarked ${title}'},t.template);return e.ajax({url:"https://gimmebar.com/api/v0/public/assets/"+t.user+".json?jsonp_callback=?",dataType:"json",success:function(n){n=n.records;var s,u=[],o=0;if(n&&n.length&&n.length>0)for(s=n.length;s>o;o++){var l=n[o];u.push({date:new Date(1e3*l.date),config:t,html:e.tmpl(a.bookmarked,l)})}r(u)}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.github=function(t,r){var a=e.extend({},{commitCommentEvent:'commented on ${status.repo.name}',createBranchEvent:'created branch ${status.payload.ref} at ${status.repo.name}',createRepositoryEvent:'created repository ${status.repo.name}',createTagEvent:'created tag ${status.payload.ref} at ${status.repo.name}',deleteBranchEvent:'deleted branch ${status.payload.ref} at ${status.repo.name}',deleteTagEvent:'deleted tag ${status.payload.ref} at ${status.repo.name}',followEvent:'started following ${status.payload.target.login}',forkEvent:'forked ${status.repo.name}',gistEvent:'${status.payload.action} gist ${status.payload.gist.id}',issueCommentEvent:'commented on issue ${status.payload.issue.number} on ${status.repo.name}',issuesEvent:'${status.payload.action} issue ${status.payload.issue.number} on ${status.repo.name}',pullRequestEvent:'${status.payload.action} pull request ${status.payload.number} on ${status.repo.name}',pushEvent:'pushed to ${status.payload.ref} at ${status.repo.name}',watchEvent:'started watching ${status.repo.name}'},t.template),n=function(t){return"CommitCommentEvent"===t.type?e.tmpl(a.commitCommentEvent,{status:t}):"CreateEvent"===t.type&&"branch"===t.payload.ref_type?e.tmpl(a.createBranchEvent,{status:t}):"CreateEvent"===t.type&&"repository"===t.payload.ref_type?e.tmpl(a.createRepositoryEvent,{status:t}):"CreateEvent"===t.type&&"tag"===t.payload.ref_type?e.tmpl(a.createTagEvent,{status:t}):"DeleteEvent"===t.type&&"branch"===t.payload.ref_type?e.tmpl(a.deleteBranchEvent,{status:t}):"DeleteEvent"===t.type&&"tag"===t.payload.ref_type?e.tmpl(a.deleteTagEvent,{status:t}):"FollowEvent"===t.type?e.tmpl(a.followEvent,{status:t}):"ForkEvent"===t.type?e.tmpl(a.forkEvent,{status:t}):"GistEvent"===t.type?("create"===t.payload.action?t.payload.action="created":"update"===t.payload.action&&(t.payload.action="updated"),e.tmpl(a.gistEvent,{status:t})):"IssueCommentEvent"===t.type?e.tmpl(a.issueCommentEvent,{status:t}):"IssuesEvent"===t.type?e.tmpl(a.issuesEvent,{status:t}):"PullRequestEvent"===t.type?e.tmpl(a.pullRequestEvent,{status:t}):"PushEvent"===t.type?(t.payload.ref=t.payload.ref.split("/")[2],e.tmpl(a.pushEvent,{status:t})):"WatchEvent"===t.type?e.tmpl(a.watchEvent,{status:t}):void 0},s=function(e){var r,a=[],s=0;if(e.query&&e.query.count&&e.query.count>0)for(r=e.query.count;r>s;s++){var u=e.query.results.json[s].json;a.push({date:new Date(u.created_at),config:t,html:n(u),url:"https://github.com/"+t.user})}return a};return e.ajax({url:e.fn.lifestream.createYqlUrl('select json.type, json.actor, json.repo, json.payload, json.created_at from json where url="https://api.github.com/users/'+t.user+'/events/public?per_page=100"'),dataType:"jsonp",success:function(e){r(s(e))}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.googleplus=function(t,r){var a=e.extend({},{posted:'${actor.displayName} has posted a new entry ${title} ${object.replies.totalItems} replies, ${object.plusoners.totalItems} +1s, ${object.resharers.totalItems} Reshares'},t.template),n=function(r){var n,s,u=[],o=0;if(r&&r.items)for(n=r.items.length;n>o;o++)s=r.items[o],u.push({date:new Date(s.published),config:t,html:e.tmpl(a.posted,s)});return u};return e.ajax({url:"https://www.googleapis.com/plus/v1/people/"+t.user+"/activities/public",data:{key:t.key},dataType:"jsonp",success:function(e){return e.error?(r([]),void(console&&console.error&&console.error("Error loading Google+ stream.",e.error))):void r(n(e))}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.hypem=function(t,r){t.type&&"history"===t.type&&"loved"===t.type||(t.type="loved");var a=e.extend({},{loved:'loved ${title} by ${artist}',history:'listened to ${title} by ${artist}'},t.template);return e.ajax({url:"http://hypem.com/playlist/"+t.type+"/"+t.user+"/json/1/data.js",dataType:"json",success:function(n){var s=[],u=0,o=-1;for(var l in n)n.hasOwnProperty(l)&&o++;if(n&&o>0)for(;o>u;u++){var i=n[u];s.push({date:new Date(1e3*("history"===t.type?i.dateplayed:i.dateloved)),config:t,html:e.tmpl("history"===t.type?a.history:a.loved,i)})}r(s)}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.instapaper=function(t,r){var a=e.extend({},{loved:'loved ${title}'},t.template),n=function(r){var n,s,u,o=[],l=0;if(r.query&&r.query.count&&r.query.count>0&&r.query.results.rss.channel.item)for(n=r.query.results.rss.channel.item,s=n.length;s>l;l++)u=n[l],o.push({date:new Date(u.pubDate),config:t,html:e.tmpl(a.loved,u)});return o};return e.ajax({url:e.fn.lifestream.createYqlUrl('select * from xml where url="http://www.instapaper.com/starred/rss/'+t.user+'"'),dataType:"jsonp",success:function(e){r(n(e))}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.iusethis=function(t,r){var a=e.extend({},{global:'${action} ${what} on (${os})'},t.template),n=function(r){var n,s,u,o,l,i,c,p,f,m,d,h,y=[],v=0,g=["iPhone","OS X","Windows"];if(r.query&&r.query.count&&r.query.count>0&&r.query.results.rss)for(i=r.query.results.rss.length,f=["started using","stopped using","stopped loving","Downloaded","commented on","updated entry for","started loving","registered"],l=f.length;i>v;v++)for(h=g[v],n=r.query.results.rss[v].channel.item,s=0,u=n.length;u>s;s++){for(c=n[s],p=c.title.replace(t.user+" ",""),o=0;l>o;o++)if(p.indexOf(f[o])>-1){m=f[o];break}d=p.split(m),y.push({date:new Date(c.pubDate),config:t,html:e.tmpl(a.global,{action:m.toLowerCase(),link:c.link,what:d[1],os:h})})}return y};return e.ajax({url:e.fn.lifestream.createYqlUrl('select * from xml where url="http://iphone.iusethis.com/user/feed.rss/'+t.user+'" or url="http://osx.iusethis.com/user/feed.rss/'+t.user+'" or url="http://win.iusethis.com/user/feed.rss/'+t.user+'"'),dataType:"jsonp",success:function(e){r(n(e))}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.lastfm=function(t,r){var a=e.extend({},{loved:'loved ${name} by ${artist.name}'},t.template),n=function(r){var n,s,u=[],o=0;if(r.query&&r.query.count&&r.query.count>0&&r.query.results.lovedtracks&&r.query.results.lovedtracks.track)for(n=r.query.results.lovedtracks.track,s=n.length;s>o;o++){var l=n[o],i=l.nowplaying?new Date:l.date.uts;u.push({date:new Date(parseInt(1e3*i,10)),config:t,html:e.tmpl(a.loved,l)})}return u};return e.ajax({url:e.fn.lifestream.createYqlUrl('select * from xml where url="http://ws.audioscrobbler.com/2.0/user/'+t.user+'/lovedtracks.xml"'),dataType:"jsonp",success:function(e){r(n(e))}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.librarything=function(t,r){var a=e.extend({},{book:'added ${book.title} by ${book.author_fl} to my library'},t.template),n=function(r){var n=[],s="";if(r.books)for(s in r.books)if(r.books.hasOwnProperty(s)){var u=r.books[s];n.push({date:new Date(1e3*u.entry_stamp),config:t,html:e.tmpl(a.book,{book:u}),url:"http://www.librarything.com/profile/"+t.user})}return n};return e.ajax({url:"https://www.librarything.com/api_getdata.php?booksort=entry_REV&userid="+t.user,dataType:"jsonp",success:function(e){r(n(e))}}),{template:a}}}(jQuery),function(e){"use strict";e.fn.lifestream.feeds.linkedin=function(t,r){var a=e.extend({},{posted:'${title}'},t.template),n="jlsLinkedinCallback"+t.user,s=function(){var e='SELECT * FROM feed WHERE url="'+t.url+'"';return t.user&&(e+=' AND link LIKE "%'+t.user+'%"'),e},u=function(r){return{date:new Date(r.pubDate),config:t,html:e.tmpl(a.posted,r)}};return window[n]=function(e){var t=[],a=0;if(e.query&&e.query.count&&e.query.count>0)if(1===e.query.count)t.push(u(e.query.results.item));else for(a;a${title}',flagged2:'flagged ${title}'},t.template),n=function(r){var n,s,u=[],o=0;if(r.query&&r.query.count&&r.query.count>0)for(n=r.query.results.rss.channel.item,s=n.length;s>o;o++){var l=n[o],i="/"===l.link.charAt(0)?a.flagged1:a.flagged2;u.push({date:new Date(l.pubDate),config:t,url:"http://mendeley.com/groups/"+t.user,html:e.tmpl(i,l)})}return u};return e.ajax({url:e.fn.lifestream.createYqlUrl('select * from xml where url="http://www.mendeley.com/groups/'+t.user+'/feed/rss/"'),dataType:"jsonp",success:function(e){r(n(e))}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.miso=function(t,r){var a=e.extend({},{watched:'checked in to ${title}'},t.template),n=function(r){var n,s,u=[],o=0;if(r.query&&r.query.count&&r.query.count>0)for(n=r.query.results.rss.channel.item,s=n.length;s>o;o++){var l=n[o];u.push({url:"http://www.gomiso.com/feeds/user/"+t.user+"/checkins.rss",date:new Date(l.pubDate),config:t,html:e.tmpl(a.watched,l)})}return u};return e.ajax({url:e.fn.lifestream.createYqlUrl('select * from xml where url="http://www.gomiso.com/feeds/user/'+t.user+'/checkins.rss"'),dataType:"jsonp",success:function(e){r(n(e))}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.mlkshk=function(t,r){var a=e.extend({},{posted:'posted ${title}'},t.template),n=function(r){var n,s,u,o=[],l=0;if(r.query&&r.query.count&&r.query.count>0&&r.query.results.rss.channel.item)for(n=r.query.results.rss.channel.item,s=n.length;s>l;l++)u=n[l],o.push({date:new Date(u.pubDate),config:t,html:e.tmpl(a.posted,u)});return o};return e.ajax({url:e.fn.lifestream.createYqlUrl('select * from xml where url="http://mlkshk.com/user/'+t.user+'/rss"'),dataType:"jsonp",success:function(e){r(n(e))}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.pinboard=function(t,r){var a=e.extend({},{bookmarked:'bookmarked ${title}'},t.template),n=function(r){var n,s,u,o=[],l=0;if(r.query&&r.query.count&&r.query.count>0)for(n=r.query.results.RDF.item,s=n.length;s>l;l++)u=n[l],o.push({date:new Date(u.date),config:t,html:e.tmpl(a.bookmarked,u)});return o};return e.ajax({url:e.fn.lifestream.createYqlUrl('select * from xml where url="http://feeds.pinboard.in/rss/u:'+t.user+'"'),dataType:"jsonp",success:function(e){r(n(e))}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.pocket=function(t,r){var a=e.extend({},{pocketed:'pocketed ${title}'},t.template),n=function(r){var n,s,u=[],o=0;if(r.query&&r.query.results)for(n=r.query.results.rss.channel.item,s=n.length;s>o;o++){var l=n[o],i=a.pocketed;u.push({date:new Date(l.pubDate),config:t,url:"http://getpocket.com",html:e.tmpl(i,l)})}return u};return e.ajax({url:e.fn.lifestream.createYqlUrl('select * from xml where url="http://www.getpocket.com/users/'+t.user+'/feed/all/"'),dataType:"json",success:function(e){r(n(e))}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.posterous=function(t,r){var a=e.extend({},{posted:'posted ${title}'},t.template),n=function(r){var n,s,u,o=[],l=0;if(r.query&&r.query.count&&r.query.count>0&&r.query.results.rss.channel.item)for(n=r.query.results.rss.channel.item,s=n.length;s>l;l++)u=n[l],o.push({date:new Date(u.pubDate),config:t,html:e.tmpl(a.posted,u)});return o};return e.ajax({url:e.fn.lifestream.createYqlUrl('select * from xml where url="http://'+t.user+'.posterous.com/rss.xml"'),dataType:"jsonp",success:function(e){r(n(e))}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.quora=function(t,r){var a=e.extend({},{posted:'${title}'},t.template),n=function(e){for(var t=0,r=e.link.length;r>t;t++){var a=e.link[t];if("string"==typeof a)return a}return""},s=function(r){var s=[],u=[],o=0,l=0,i="";if(r.query&&r.query.count&&r.query.count>0)for(u=r.query.results.rss.channel.item,l=u.length,i=n(r.query.results.rss.channel);l>o;o++){var c=u[o];s.push({url:i,date:new Date(c.pubDate),config:t,html:e.tmpl(a.posted,c)})}return s};return e.ajax({url:e.fn.lifestream.createYqlUrl('select * from xml where url="http://www.quora.com/'+t.user+'/rss"'),dataType:"jsonp",success:function(e){r(s(e))}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.reddit=function(t,r){var a=e.extend({},{commented:'commented (${score}) in ${item.data.subreddit}',created:'created new thread (${score}) in ${item.data.subreddit}'},t.template),n=function(t){var r=t.data.ups-t.data.downs,n={item:t,score:r>0?"+"+r:r};return"t1"===t.kind?e.tmpl(a.commented,n):"t3"===t.kind?e.tmpl(a.created,n):void 0},s=function(e){return new Date(1e3*e)};return e.ajax({url:"https://pay.reddit.com/user/"+t.user+".json",dataType:"jsonp",jsonp:"jsonp",success:function(e){var a,u=[],o=0;if(e&&e.data&&e.data.children&&e.data.children.length>0)for(a=e.data.children.length;a>o;o++){var l=e.data.children[o];u.push({date:s(l.data.created_utc),config:t,html:n(l),url:"http://reddit.com/user/"+t.user})}r(u)}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.rss=function(t,r){var a=e.extend({},{posted:'posted ${title}'},t.template),n=function(e){for(var t=0,r=e.link.length;r>t;t++){var a=e.link[t];if("string"==typeof a)return a}return""},s=function(r){var s=[],u=[],o=0,l=0,i="";if(r.query&&r.query.count&&r.query.count>0)for(u=r.query.results.rss.channel.item,l=u.length,i=n(r.query.results.rss.channel);l>o;o++){var c=u[o];s.push({url:i,date:new Date(c.pubDate),config:t,html:e.tmpl(a.posted,c)})}return s};return e.ajax({url:e.fn.lifestream.createYqlUrl('select * from xml where url="'+t.user+'"'),dataType:"jsonp",success:function(e){r(s(e))}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.slideshare=function(t,r){var a=e.extend({},{uploaded:'uploaded a presentation ${title}'},t.template),n=function(r){var n,s,u,o=[],l=0;if(r.query&&r.query.count&&r.query.count>0)for(n=r.query.results.rss.channel.item,s=n.length;s>l;l++)u=n[l],o.push({date:new Date(u.pubDate),config:t,html:e.tmpl(a.uploaded,u)});return o};return e.ajax({url:e.fn.lifestream.createYqlUrl('select * from xml where url="http://www.slideshare.net/rss/user/'+t.user+'"'),dataType:"jsonp",success:function(e){r(n(e))}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.snipplr=function(t,r){var a=e.extend({},{posted:'posted a snippet ${title}'},t.template),n=function(r){var n,s,u,o=[],l=0;if(r.query&&r.query.count&&r.query.count>0&&r.query.results.rss.channel.item)for(n=r.query.results.rss.channel.item,s=n.length;s>l;l++)u=n[l],o.push({date:new Date(u.pubDate),config:t,html:e.tmpl(a.posted,u)});return o};e.ajax({url:e.fn.lifestream.createYqlUrl('select * from xml where url="http://snipplr.com/rss/users/'+t.user+'"'),dataType:"jsonp",success:function(e){r(n(e))}})}}(jQuery),function(e){e.fn.lifestream.feeds.stackoverflow=function(t,r){var a=e.extend({},{global:'${text} - ${title}'},t.template),n=function(e){var r="",a="",n="",s="http://stackoverflow.com/users/"+t.user,u="http://stackoverflow.com/questions/";return"badge"===e.timeline_type&&(n=s+"?tab=reputation"),r=e.timeline_type,a=e.title||e.detail||"",n=n||u+e.post_id,{link:n,title:a,text:r}},s=function(e){return new Date(1e3*e)};return e.ajax({url:"https://api.stackexchange.com/2.1/users/"+t.user+"/timeline?site=stackoverflow",dataType:"jsonp",jsonp:"jsonp",success:function(u){var o=[];if(u&&u.items)for(var l=0;l${title}'},t.template),n=t.limit||20,s=function(t){switch(t.type){case"photo":var r=t["photo-url"];return e('').attr({src:r[r.length-1].content,title:l(t),alt:l(t)}).wrap("
    ").parent().html();case"video":var a=t["video-player"],n=a[a.length-1].content;return n.match(/<\s*script/)?null:n;case"audio":return t["audio-player"]+" "+e("
    ").text(l(t)).html();default:return null}},u=function(t,r){return e(t[r]).filter(":not(:empty):first").text()},o=function(e){var t;switch(e.type){case"regular":return e["regular-title"]||u(e,"regular-body");case"link":return t=e["link-text"]||u(e,"link-description"),""===t&&(t=e["link-url"]),t;case"video":return u(e,"video-caption");case"audio":return u(e,"audio-caption");case"photo":return u(e,"photo-caption");case"quote":return'"'+e["quote-text"].replace(/<.+?>/g," ").trim()+'"';case"conversation":return t=e["conversation-title"],t||(t=e.conversation.line,"string"!=typeof t&&(t=t[0].label+" "+t[0].content+" ...")),t;case"answer":return e.question;default:return e.type}},l=function(e){var t=o(e)||"";return t.replace(/<.+?>/gi," ")},i=function(t,r){return{date:new Date(r.date),config:t,html:e.tmpl(a.posted,{type:r.type.replace("regular","blog entry"),url:r.url,image:s(r),title:l(r)})}},c=function(r){var a,n,s=[],u=0;if(r.query&&r.query.count&&r.query.count>0)if(e.isArray(r.query.results.posts.post))for(a=r.query.results.posts.post.length;a>u;u++)n=r.query.results.posts.post[u],s.push(i(t,n));else e.isPlainObject(r.query.results.posts.post)&&s.push(i(t,r.query.results.posts.post));return s};return e.ajax({url:e.fn.lifestream.createYqlUrl('select * from tumblr.posts where username="'+t.user+'" and num="'+n+'"'),dataType:"jsonp",success:function(e){r(c(e))}}),{template:a}}}(jQuery),function(e){"use strict";e.fn.lifestream.feeds.twitter=function(t,r){var a=e.extend({},{posted:"{{html tweet}}"},t.template),n=function(t){var r=function(t){return t.replace(/([a-z]+:\/\/)([-A-Z0-9+&@#\/%?=~_|(\)!:,.;]*[-A-Z0-9+&@#\/%=~_|(\)])/gi,function(t,r,a){ return e("").attr("href",t).text(a.length>35?a.substr(0,34)+"...":a)[0].outerHTML})},a=function(t){return t.replace(/(^|[^\w]+)\@([a-zA-Z0-9_]{1,15})/g,function(t,r,a){var n=e("").attr("href","https://twitter.com/"+a).text("@"+a)[0].outerHTML;return r+n})},n=function(t){return t.replace(/|(^|\r?\n|\r|\n|)(#|\$)([a-zA-Z0-9ÅåÄäÖöØøÆæÉéÈèÜüÊêÛûÎî_]+)(\r?\n|\r|\n||$)/g,function(t,r,a,n,s){if("undefined"==typeof n)return t;var u="";return"#"==a?u=e("").attr("href","https://twitter.com/hashtag/"+n+"?src=hash").text("#"+n)[0].outerHTML:"$"==a&&(u=e("").attr("href","https://twitter.com/search?q=%24"+n+"&src=hash").text("$"+n)[0].outerHTML),r+u+s})};return n(a(r(t)))},s=function(s){var u=[];if(!s.tweets)return u;for(var o=0;o").html(l.text).text()),complete_url:"https://twitter.com/"+t.user+"/status/"+l.id}),url:"https://twitter.com/"+t.user})}r(u)};return e.ajax({url:"https://twittery.herokuapp.com/"+t.user,cache:!1}).success(s),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.vimeo=function(t,r){var a=e.extend({},{liked:'liked ${title}',posted:'posted ${title}'},t.template),n=function(r,n){var s,u,o,l,i=[],c=0,p=n||"liked";if(r)for(s=r.length;s>c;c++)u=r[c],o="posted"===p?new Date(u.upload_date.replace(" ","T")):new Date(u.liked_on.replace(" ","T")),l=u.description?u.description.replace(/"/g,"'").replace(/<.+?>/gi,""):"",i.push({date:o,config:t,html:e.tmpl(a[p],{url:u.url,description:u.description?u.description.replace(/"/g,"'").replace(/<.+?>/gi,""):"",title:u.title})});return i};return e.ajax({url:e.fn.lifestream.createYqlUrl('SELECT * FROM xml WHERE url="http://vimeo.com/api/v2/'+t.user+'/likes.xml" OR url="http://vimeo.com/api/v2/'+t.user+'/videos.xml"'),dataType:"jsonp",success:function(e){var t=[];null!=e.query.results.videos[0]&&e.query.results.videos[0].video.length>0&&(t=t.concat(n(e.query.results.videos[0].video))),null!=e.query.results.videos[1]&&e.query.results.videos[1].video.length>0&&(t=t.concat(n(e.query.results.videos[1].video,"posted"))),r(t)}}),{template:a}}}(jQuery),function(e){e.fn.lifestream.feeds.wikipedia=function(t,r){var a=t.language||"en",n=e.extend({},{contribution:'contributed to ${title}'},t.template);return e.ajax({url:"https://"+a+".wikipedia.org/w/api.php?action=query&ucuser="+t.user+"&list=usercontribs&ucdir=older&format=json",dataType:"jsonp",success:function(s){var u,o=[],l=0;if(s&&s.query.usercontribs)for(u=s.query.usercontribs.length;u>l;l++){var i=s.query.usercontribs[l];i.url="http://"+a+".wikipedia.org/wiki/"+i.title.replace(" ","_"),o.push({date:new Date(i.timestamp),config:t,html:e.tmpl(n.contribution,i)})}r(o)}}),{template:n}}}(jQuery),function(e){e.fn.lifestream.feeds.wordpress=function(t,r){var a=e.extend({},{posted:'posted ${title}'},t.template),n=function(r){var n,s,u,o=[],l=0;if(r.query&&r.query.count&&r.query.count>0&&r.query.results.rss.channel.item)for(n=r.query.results.rss.channel.item,s=n.length;s>l;l++)u=n[l],o.push({date:new Date(u.pubDate),config:t,html:e.tmpl(a.posted,u)});return o},s="";return t.user&&(s=0===t.user.indexOf("http://")?t.user+"/feed":"http://"+t.user+".wordpress.com/feed",e.ajax({url:e.fn.lifestream.createYqlUrl('select * from xml where url="'+s+'"'),dataType:"jsonp",success:function(e){r(n(e))}})),{template:a}}}(jQuery),function(e){"use strict";e.fn.lifestream.feeds.youtube=function(t,r){var a=e.extend({},{uploaded:'uploaded ${title}'},t.template),n=function(n){var s=[];if(!n.videos)return s;for(var u=0;u${title} by ${creatorSummary}'},t.template),n=function(r){var n,s,u=[],o=0;if(r.query&&r.query.count&&r.query.count>0)for(n=r.query.results.feed.entry,s=n.length;s>o;o++){var l=n[o];u.push({date:new Date(l.updated),config:t,url:"http://zotero.com/users/"+t.user,html:e.tmpl(a.flagged,l)})}return u};return e.ajax({url:e.fn.lifestream.createYqlUrl('select * from xml where url="https://api.zotero.org/users/'+t.user+'/items"'),dataType:"jsonp",success:function(e){r(n(e))}}),{template:a}}}(jQuery);