Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add YouTube uploads. #126

Closed
wants to merge 6 commits into from

3 participants

Erik Ostrom Christian Vuerings Armin Roșu
Erik Ostrom

We had a feed of a user's favorites, but not of their own uploads.

This change gets the right date for both kinds of activity, supplies the actual video to the template, and also preserves the 'favorite' data for anyone whose custom template was using it.

Christian Vuerings
Owner

@eostrom looks like we have a merge conflict here, would it be possible for you to have a look at this?

Erik Ostrom

Sure. I can rebase my commit to master, but... it looks like some of your changes that I was building on aren't in master anymore. Is that intentional? (Specifically "don't add private video items," which is a little bit relevant to what I was doing, and also sounds like a good idea....)

Christian Vuerings
Owner

@eostrom That's really strange and not intentional. Veel free to add those things back in.

Armin Roșu
Collaborator

don't add private videos is actually a misleading comment / condition. The status (equivalent of the yt:state xml tag) property can appear if a video is public. I assume Cristian added it when he received an error in parsing the feed (I did too, but for a deleted video). I think the best course of action is to check for !video.player (easier than adding 3 statuses)

Armin Roșu
Collaborator

so I've fixed the conflicts and rebuilt jls-min. thing is, I'm not certain it went allright; uglify didn't mangle variable names. Thus I commited to a new branch eostrom-master.

@christianv can you please verify it is alright.

Armin Roșu arminrosu referenced this pull request from a commit
Armin Roșu arminrosu code for pull request #126 7327306
Christian Vuerings
Owner

@arminrosu Code looks good, would it be possible to just change the double quotes to single ones in the Ajax call?
It's probably better to create a new PR for this and close this one.

Armin Roșu arminrosu closed this
Erik Ostrom

Hi, just wanted to say sorry for dropping the ball on this, and thanks to @arminrosu for picking it up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
52 jquery.lifestream.js
View
@@ -5,7 +5,7 @@
*
* Copyright 2011, Christian Vuerings - http://denbuzze.com
*/
-/*globals jQuery, $ */
+/*global jQuery */
;(function( $ ){
"use strict";
@@ -144,7 +144,7 @@
// At then end we call the load method.
if( !jQuery.tmpl ) {
jQuery.getScript(
- "http://ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js",
+ "http://ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.js",
load);
} else {
load();
@@ -2167,8 +2167,9 @@ $.fn.lifestream.feeds.vimeo = function( config, callback ) {
config: config,
html: $.tmpl( template[type], {
url: item.url,
- description: item.description.replace(/"/g, "'")
- .replace( /<.+?>/gi, ""),
+ description: item.description ? item.description
+ .replace(/"/g, "'")
+ .replace( /<.+?>/gi, "") : '',
title: item.title
})
});
@@ -2320,22 +2321,43 @@ $.fn.lifestream.feeds.youtube = function( config, callback ) {
var template = $.extend({},
{
+ uploaded: 'uploaded <a href="${video.player.default}" '
+ + 'title="${video.description}">${video.title}</a>',
favorited: 'favorited <a href="${video.player.default}" '
+ 'title="${video.description}">${video.title}</a>'
},
config.template),
- parseYoutube = function( input ) {
- var output = [], i = 0, j, item;
+ parseYoutube = function( input, activity ) {
+ var output = [], i = 0, j, item, video, date, templateData;
if(input.data && input.data.items) {
j = input.data.items.length;
for( ; i<j; i++) {
item = input.data.items[i];
+
+ switch (activity) {
+ case 'favorited':
+ video = item.video;
+ date = item.created;
+ templateData = item;
+ break;
+ case 'uploaded':
+ video = item;
+ date = video.uploaded;
+ templateData = {video: video};
+ break;
+ }
+
+ // Don't add private items
+ if (video.status && video.status.reason) {
+ continue;
+ }
+
output.push({
- date: new Date(item.created),
+ date: new Date(date),
config: config,
- html: $.tmpl( template.favorited, item )
+ html: $.tmpl( template[activity], templateData )
});
}
}
@@ -2348,7 +2370,16 @@ $.fn.lifestream.feeds.youtube = function( config, callback ) {
+ "/favorites?v=2&alt=jsonc",
dataType: 'jsonp',
success: function( data ) {
- callback(parseYoutube(data));
+ callback(parseYoutube(data, 'favorited'));
+ }
+ });
+
+ $.ajax({
+ url: "http://gdata.youtube.com/feeds/api/users/" + config.user
+ + "/uploads?v=2&alt=jsonc",
+ dataType: 'jsonp',
+ success: function( data ) {
+ callback(parseYoutube(data, 'uploaded'));
}
});
@@ -2359,7 +2390,8 @@ $.fn.lifestream.feeds.youtube = function( config, callback ) {
};
};
-})(jQuery);(function($) {
+})(jQuery);
+(function($) {
$.fn.lifestream.feeds.zotero = function( config, callback ) {
var template = $.extend({},
4 jquery.lifestream.min.js
View
@@ -4,5 +4,5 @@
* Show a stream of your online activity
*
* Copyright 2011, Christian Vuerings - http://denbuzze.com
- *//*globals jQuery, $ */(function(a){"use strict",a.fn.lifestream=function(b){return this.each(function(){var c=a(this),d=jQuery.extend({classname:"lifestream",feedloaded:null,limit:10,list:[]},b),e={count:d.list.length,items:[]},f=jQuery.extend(!0,{},d),g=function(b){a.merge(e.items,b),e.items.sort(function(a,b){return b.date-a.date});var f=e.items,g=f.length<d.limit?f.length:d.limit,h=0,i,j=a('<ul class="'+d.classname+'"/>');for(;h<g;h++)i=f[h],i.html&&a('<li class="'+d.classname+"-"+i.config.service+'">').data("name",i.config.service).data("url",i.url||"#").data("time",i.date).append(i.html).appendTo(j);c.html(j),a.isFunction(d.feedloaded)&&d.feedloaded()},h=function(){var b=0,c=d.list.length;delete f.list;for(;b<c;b++){var e=d.list[b];a.fn.lifestream.feeds[e.service]&&a.isFunction(a.fn.lifestream.feeds[e.service])&&e.user&&(e._settings=f,a.fn.lifestream.feeds[e.service](e,g))}};jQuery.tmpl?h():jQuery.getScript("http://ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js",h)})},a.fn.lifestream.createYqlUrl=function(a){return"http://query.yahooapis.com/v1/public/yql?q=__QUERY__&env=store://datatables.org/alltableswithkeys&format=json".replace("__QUERY__",encodeURIComponent(a))},a.fn.lifestream.feeds=a.fn.lifestream.feeds||{},Object.keys||(Object.keys=function(a){if(a!==Object(a))throw new TypeError("Object.keys called on non-object");var b=[],c;for(c in a)Object.prototype.hasOwnProperty.call(a,c)&&b.push(c);return b})})(jQuery),function(a){a.fn.lifestream.feeds.bitbucket=function(b,c){var d=a.extend({},{commit:'<a href="http://bitbucket.org/${owner}/${name}/changeset/${node}/">committed</a> at <a href="http://bitbucket.org/${owner}/${name}/">${owner}/${name}</a>',pullrequest_fulfilled:'fulfilled a pull request at <a href="http://bitbucket.org/${owner}/${name}/">${owner}/${name}</a>',pullrequest_rejected:'rejected a pull request at <a href="http://bitbucket.org/${owner}/${name}/">${owner}/${name}</a>',pullrequest_created:'created a pull request at <a href="http://bitbucket.org/${owner}/${name}/">${owner}/${name}</a>',create:'created a new project at <a href="http://bitbucket.org/${owner}/${name}/">${owner}/${name}</a>',fork:'forked <a href="http://bitbucket.org/${owner}/${name}/">${owner}/${name}</a>'},b.template),e=["commit","pullrequest_fulfilled","pullrequest_rejected","pullrequest_created","create","fork"],f=function(b){if(a.inArray(b.event,e)!==-1&&b.repository)return b.event==="commit"?a.tmpl(d.commit,{owner:b.repository.owner,name:b.repository.name,node:b.node}):a.tmpl(d[b.event],{owner:b.repository.owner,name:b.repository.name})},g=function(c){var d=[],e=0;return c.query&&c.query.count&&c.query.count>0&&a.each(c.query.results.json,function(){d.push({date:new Date(this.events.created_on.replace(/-/g,"/")),config:b,html:f(this.events)})}),d};return a.ajax({url:a.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/'+b.user+'/events/"'),dataType:"jsonp",success:function(a){c(g(a))}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.bitly=function(b,c){var d=a.extend({},{created:'created URL <a href="${short_url}" title="${title}">${short_url}</a>'},b.template);return a.ajax({url:a.fn.lifestream.createYqlUrl('select data.short_url, data.created, data.title from json where url="http://bitly.com/u/'+b.user+'.json"'),dataType:"jsonp",success:function(e){var f=[],g=0,h;if(e.query&&e.query.count&&e.query.results.json){list=e.query.results.json,h=list.length;for(;g<h;g++){var i=list[g].data;f.push({date:new Date(i.created*1e3),config:b,html:a.tmpl(d.created,i)})}}c(f)}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.blogger=function(b,c){var d=a.extend({},{posted:'posted <a href="${origLink}">${title}</a>'},b.template),e=function(c){var e=[],f,g=0,h,i,j,k;if(c.query&&c.query.count&&c.query.count>0&&c.query.results.feed.entry){f=c.query.results.feed.entry,h=f.length;for(;g<h;g++){i=f[g];if(!i.origLink){j=0,k=i.link.length;for(;j<k;j++)i.link[j].rel==="alternate"&&(i.origLink=i.link[j].href)}i.origLink&&(i.title.content&&(i.title=i.title.content),e.push({date:new Date(i.published),config:b,html:a.tmpl(d.posted,i)}))}}return e};return a.ajax({url:a.fn.lifestream.createYqlUrl('select * from xml where url="http://'+b.user+'.blogspot.com/feeds/posts/default"'),dataType:"jsonp",success:function(a){c(e(a))}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.citeulike=function(b,c){var d=a.extend({},{saved:'saved <a href="${href}">${title}</a> by ${authors}'},b.template),e=function(c){var e=[],f=0,g;if(c&&c.length&&c.length>0){g=c.length;for(;f<g;f++){var h=c[f];e.push({date:new Date(h.date),config:b,url:"http://www.citeulike.org/user/"+b.user,html:a.tmpl(d.saved,h)})}}return e};return a.ajax({url:"http://www.citeulike.org/json/user/"+b.user,dataType:"jsonp",success:function(a){c(e(a))}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.dailymotion=function(b,c){var d=a.extend({},{uploaded:'uploaded a video <a href="${link}">${title[0]}</a>'},b.template),e=function(c){var e=[],f,g=0,h,i;if(c.query&&c.query.count&&c.query.count>0&&c.query.results.rss.channel.item){f=c.query.results.rss.channel.item,h=f.length;for(;g<h;g++)i=f[g],e.push({date:new Date(i.pubDate),config:b,html:a.tmpl(d.uploaded,i)})}return e};return a.ajax({url:a.fn.lifestream.createYqlUrl('select * from xml where url="http://www.dailymotion.com/rss/user/'+b.user+'"'),dataType:"jsonp",success:function(a){c(e(a))}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.delicious=function(b,c){var d=a.extend({},{bookmarked:'bookmarked <a href="${u}">${d}</a>'},b.template);return a.ajax({url:"http://feeds.delicious.com/v2/json/"+b.user,dataType:"jsonp",success:function(e){var f=[],g=0,h;if(e&&e.length&&e.length>0){h=e.length;for(;g<h;g++){var i=e[g];f.push({date:new Date(i.dt),config:b,html:a.tmpl(d.bookmarked,i)})}}c(f)}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.deviantart=function(b,c){var d=a.extend({},{posted:'posted <a href="${link}">${title}</a>'},b.template);return a.ajax({url:a.fn.lifestream.createYqlUrl('select title,link,pubDate from rss where url="http://backend.deviantart.com/rss.xml?q=gallery%3A'+encodeURIComponent(b.user)+"&type=deviation"+'" | unique(field="title")'),dataType:"jsonp",success:function(e){var f=[],g,h,i=0,j;if(e.query&&e.query.count>0){g=e.query.results.item,j=g.length;for(;i<j;i++)h=g[i],f.push({date:new Date(h.pubDate),config:b,html:a.tmpl(d.posted,h)})}c(f)}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.dribbble=function(b,c){var d=a.extend({},{posted:'posted a shot <a href="${url}">${title}</a>'},b.template);return a.ajax({url:"http://api.dribbble.com/players/"+b.user+"/shots",dataType:"jsonp",success:function(e){var f=[],g=0,h;if(e&&e.total){h=e.shots.length;for(;g<h;g++){var i=e.shots[g];f.push({date:new Date(i.created_at),config:b,html:a.tmpl(d.posted,i)})}}c(f)}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.facebook_page=function(b,c){var d=a.extend({},{wall_post:'post on wall <a href="${link}">${title}</a>'},b.template),e=function(c){var e=[],f,g=0,h;if(c.query&&c.query.count&&c.query.count>0){f=c.query.results.rss.channel.item,h=f.length;for(;g<h;g++){var i=f[g];a.trim(i.title)&&e.push({date:new Date(i.pubDate),config:b,html:a.tmpl(d.wall_post,i)})}}return e};return a.ajax({url:a.fn.lifestream.createYqlUrl('select * from xml where url="www.facebook.com/feeds/page.php?id='+b.user+'&format=rss20"'),dataType:"jsonp",success:function(a){c(e(a))}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.flickr=function(b,c){var d=a.extend({},{posted:'posted a photo <a href="${link}">${title}</a>'},b.template);return a.ajax({url:"http://api.flickr.com/services/feeds/photos_public.gne?id="+b.user+"&lang=en-us&format=json",dataType:"jsonp",jsonp:"jsoncallback",success:function(e){var f=[],g=0,h;if(e&&e.items&&e.items.length>0){h=e.items.length;for(;g<h;g++){var i=e.items[g];f.push({date:new Date(i.published),config:b,html:a.tmpl(d.posted,i)})}}c(f)}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.foomark=function(b,c){var d=a.extend({},{bookmarked:'bookmarked <a href="${url}">${url}</a>'},b.template);return a.ajax({url:"http://api.foomark.com/urls/list/",data:{format:"jsonp",username:b.user},dataType:"jsonp",success:function(e){var f=[],g=0,h;if(e&&e.length&&e.length>0){h=e.length;for(;g<h;g++){var i=e[g];f.push({date:new Date(i.created_at.replace(/-/g,"/")),config:b,html:a.tmpl(d.bookmarked,i)})}}c(f)}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.formspring=function(b,c){var d=a.extend({},{answered:'answered a question <a href="${link}">${title}</a>'},b.template),e=function(c){var e=[],f,g=0,h,i;if(c.query&&c.query.count&&c.query.count>0&&c.query.results.rss.channel.item){f=c.query.results.rss.channel.item,h=f.length;for(;g<h;g++)i=f[g],e.push({date:new Date(i.pubDate),config:b,html:a.tmpl(d.answered,i)})}return e};return a.ajax({url:a.fn.lifestream.createYqlUrl('select * from xml where url="http://www.formspring.me/profile/'+b.user+'.rss"'),dataType:"jsonp",success:function(a){c(e(a))}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.forrst=function(b,c){var d=a.extend({},{posted:'posted a ${post_type} <a href="${post_url}">${title}</a>'},b.template);return a.ajax({url:"http://forrst.com/api/v2/users/posts?username="+b.user,dataType:"jsonp",success:function(e){var f=[],g=0,h;if(e&&e.resp.length&&e.resp.length>0){h=e.resp.length;for(;g<h;g++){var i=e.resp[g];f.push({date:new Date(i.created_at.replace(" ","T")),config:b,html:a.tmpl(d.posted,i)})}}c(f)}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.foursquare=function(b,c){var d=a.extend({},{checkedin:'checked in @ <a href="${link}">${title}</a>'},b.template),e=function(c){var e=[],f=0,g;if(c.query&&c.query.count&&c.query.count>0){g=c.query.count;for(;f<g;f++){var h=c.query.results.item[f];e.push({date:new Date(h.pubDate),config:b,html:a.tmpl(d.checkedin,h)})}}return e};return a.ajax({url:a.fn.lifestream.createYqlUrl('select * from rss where url="https://feeds.foursquare.com/history/'+b.user+'.rss"'),dataType:"jsonp",success:function(a){c(e(a))}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.gimmebar=function(b,c){var d=a.extend({},{bookmarked:'bookmarked <a href="${short_url}">${title}</a>'},b.template);return a.ajax({url:"https://gimmebar.com/api/v0/public/assets/"+b.user+".json?jsonp_callback=?",dataType:"json",success:function(e){e=e.records;var f=[],g=0,h;if(e&&e.length&&e.length>0){h=e.length;for(;g<h;g++){var i=e[g];f.push({date:new Date(i.date*1e3),config:b,html:a.tmpl(d.bookmarked,i)})}}c(f)}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.github=function(b,c){var d=a.extend({},{commitCommentEvent:'commented on <a href="http://github.com/${status.repo.name}">${status.repo.name}</a>',createBranchEvent:'created branch <a href="http://github.com/${status.repo.name}/tree/${status.payload.ref}">${status.payload.ref}</a> at <a href="http://github.com/${status.repo.name}">${status.repo.name}</a>',createRepositoryEvent:'created repository <a href="http://github.com/${status.repo.name}">${status.repo.name}</a>',createTagEvent:'created tag <a href="http://github.com/${status.repo.name}/tree/${status.payload.ref}">${status.payload.ref}</a> at <a href="http://github.com/${status.repo.name}">${status.repo.name}</a>',deleteBranchEvent:'deleted branch ${status.payload.ref} at <a href="http://github.com/${status.repo.name}">${status.repo.name}</a>',deleteTagEvent:'deleted tag ${status.payload.ref} at <a href="http://github.com/${status.repo.name}">${status.repo.name}</a>',followEvent:'started following <a href="http://github.com/${status.payload.target.login}">${status.payload.target.login}</a>',forkEvent:'forked <a href="http://github.com/${status.repo.name}">${status.repo.name}</a>',gistEvent:'${status.payload.action} gist <a href="http://gist.github.com/${status.payload.gist.id}">${status.payload.gist.id}</a>',issueCommentEvent:'commented on issue <a href="http://github.com/${status.repo.name}/issues/${status.payload.issue.number}">${status.payload.issue.number}</a> on <a href="http://github.com/${status.repo.name}">${status.repo.name}</a>',issuesEvent:'${status.payload.action} issue <a href="http://github.com/${status.repo.name}/issues/${status.payload.issue.number}">${status.payload.issue.number}</a> on <a href="http://github.com/${status.repo.name}">${status.repo.name}</a>',pullRequestEvent:'${status.payload.action} pull request <a href="http://github.com/${status.repo.name}/pull/${status.payload.number}">${status.payload.number}</a> on <a href="http://github.com/${status.repo.name}">${status.repo.name}</a>',pushEvent:'pushed to <a href="http://github.com/${status.repo.name}/tree/${status.payload.ref}">${status.payload.ref}</a> at <a href="http://github.com/${status.repo.name}">${status.repo.name}</a>',watchEvent:'started watching <a href="http://github.com/${status.repo.name}">${status.repo.name}</a>'},b.template),e=function(b){if(b.type==="CommitCommentEvent")return a.tmpl(d.commitCommentEvent,{status:b});if(b.type==="CreateEvent"&&b.payload.ref_type==="branch")return a.tmpl(d.createBranchEvent,{status:b});if(b.type==="CreateEvent"&&b.payload.ref_type==="repository")return a.tmpl(d.createRepositoryEvent,{status:b});if(b.type==="CreateEvent"&&b.payload.ref_type==="tag")return a.tmpl(d.createTagEvent,{status:b});if(b.type==="DeleteEvent"&&b.payload.ref_type==="branch")return a.tmpl(d.deleteBranchEvent,{status:b});if(b.type==="DeleteEvent"&&b.payload.ref_type==="tag")return a.tmpl(d.deleteTagEvent,{status:b});if(b.type==="FollowEvent")return a.tmpl(d.followEvent,{status:b});if(b.type==="ForkEvent")return a.tmpl(d.forkEvent,{status:b});if(b.type==="GistEvent")return b.payload.action==="create"?b.payload.action="created":b.payload.action==="update"&&(b.payload.action="updated"),a.tmpl(d.gistEvent,{status:b});if(b.type==="IssueCommentEvent")return a.tmpl(d.issueCommentEvent,{status:b});if(b.type==="IssuesEvent")return a.tmpl(d.issuesEvent,{status:b});if(b.type==="PullRequestEvent")return a.tmpl(d.pullRequestEvent,{status:b});if(b.type==="PushEvent")return b.payload.ref=b.payload.ref.split("/")[2],a.tmpl(d.pushEvent,{status:b});if(b.type==="WatchEvent")return a.tmpl(d.watchEvent,{status:b})},f=function(a){var c=[],d=0,f;if(a.query&&a.query.count&&a.query.count>0){f=a.query.count;for(;d<f;d++){var g=a.query.results.json[d].json;c.push({date:new Date(g.created_at),config:b,html:e(g),url:"https://github.com/"+b.user})}}return c};return a.ajax({url:a.fn.lifestream.createYqlUrl('select json.type, json.actor, json.repo, json.payload, json.created_at from json where url="https://api.github.com/users/'+b.user+'/events/public?per_page=100"'),dataType:"jsonp",success:function(a){c(f(a))}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.googleplus=function(b,c){var d=a.extend({},{posted:'<a href="${actor.url}">${actor.displayName}</a> has posted a new entry <a href="${url}" title="${id}">${title}</a> <!--With--> ${object.replies.totalItems} replies, ${object.plusoners.totalItems} +1s, ${object.resharers.totalItems} Reshares'},b.template),e=function(c){var e=[],f=0,g,h;if(c&&c.items){g=c.items.length;for(;f<g;f++)h=c.items[f],e.push({date:new Date(h.published),config:b,html:a.tmpl(d.posted,h)})}return e};return a.ajax({url:"https://www.googleapis.com/plus/v1/people/"+b.user+"/activities/public",data:{key:b.key},dataType:"jsonp",success:function(a){if(a.error){c([]),console&&console.error&&console.error("Error loading Google+ stream.",a.error);return}c(e(a))}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.googlereader=function(b,c){var d=a.extend({},{starred:'shared <a href="{{if link.href}}${link.href}{{else}}${source.link.href}{{/if}}">${title.content}</a>'},b.template),e=function(c){var e=[],f,g=0,h;if(c.query&&c.query.count&&c.query.count>0){f=c.query.results.feed.entry,h=f.length;for(;g<h;g++){var i=f[g];e.push({url:"http://www.google.com/reader/shared"+b.user,date:new Date(parseInt(i["crawl-timestamp-msec"],10)),config:b,html:a.tmpl(d.starred,i)})}}return e};return a.ajax({url:a.fn.lifestream.createYqlUrl('select * from xml where url="www.google.com/reader/public/atom/user%2F'+b.user+'%2Fstate%2Fcom.google%2Fbroadcast"'),dataType:"jsonp",success:function(a){c(e(a))}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.hypem=function(b,c){if(!b.type||b.type!=="history"||b.type!=="loved")b.type="loved";var d=a.extend({},{loved:'loved <a href="http://hypem.com/item/${mediaid}">${title}</a> by <a href="http://hypem.com/artist/${artist}">${artist}</a>',history:'listened to <a href="http://hypem.com/item/${mediaid}">${title}</a> by <a href="http://hypem.com/artist/${artist}">${artist}</a>'},b.template);return a.ajax({url:"http://hypem.com/playlist/"+b.type+"/"+b.user+"/json/1/data.js",dataType:"json",success:function(e){var f=[],g=0,h=-1;for(var i in e)e.hasOwnProperty(i)&&h++;if(e&&h>0)for(;g<h;g++){var j=e[g];f.push({date:new Date((b.type==="history"?j.dateplayed:j.dateloved)*1e3),config:b,html:a.tmpl(b.type==="history"?d.history:d.loved,j)})}c(f)}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.instapaper=function(b,c){var d=a.extend({},{loved:'loved <a href="${link}">${title}</a>'},b.template),e=function(c){var e=[],f,g=0,h,i;if(c.query&&c.query.count&&c.query.count>0&&c.query.results.rss.channel.item){f=c.query.results.rss.channel.item,h=f.length;for(;g<h;g++)i=f[g],e.push({date:new Date(i.pubDate),config:b,html:a.tmpl(d.loved,i)})}return e};return a.ajax({url:a.fn.lifestream.createYqlUrl('select * from xml where url="http://www.instapaper.com/starred/rss/'+b.user+'"'),dataType:"jsonp",success:function(a){c(e(a))}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.iusethis=function(b,c){var d=a.extend({},{global:'${action} <a href="${link}">${what}</a> on (${os})'},b.template),e=function(c){var e=[],f,g,h,i,j,k=0,l,m,n,o,p,q,r,s=["iPhone","OS X","Windows"];if(c.query&&c.query.count&&c.query.count>0&&c.query.results.rss){l=c.query.results.rss.length,o=["started using","stopped using","stopped loving","Downloaded","commented on","updated entry for","started loving","registered"],j=o.length;for(;k<l;k++){r=s[k],f=c.query.results.rss[k].channel.item,g=0,h=f.length;for(;g<h;g++){m=f[g],n=m.title.replace(b.user+" ",""),i=0;for(;i<j;i++)if(n.indexOf(o[i])>-1){p=o[i];break}q=n.split(p),e.push({date:new Date(m.pubDate),config:b,html:a.tmpl(d.global,{action:p.toLowerCase(),link:m.link,what:q[1],os:r})})}}}return e};return a.ajax({url:a.fn.lifestream.createYqlUrl('select * from xml where url="http://iphone.iusethis.com/user/feed.rss/'+b.user+'" or '+'url="http://osx.iusethis.com/user/feed.rss/'+b.user+'" or '+'url="http://win.iusethis.com/user/feed.rss/'+b.user+'"'),dataType:"jsonp",success:function(a){c(e(a))}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.lastfm=function(b,c){var d=a.extend({},{loved:'loved <a href="${url}">${name}</a> by <a href="${artist.url}">${artist.name}</a>'},b.template),e=function(c){var e=[],f,g=0,h;if(c.query&&c.query.count&&c.query.count>0&&c.query.results.lovedtracks&&c.query.results.lovedtracks.track){f=c.query.results.lovedtracks.track,h=f.length;for(;g<h;g++){var i=f[g],j=i.nowplaying?new Date:i.date.uts;e.push({date:new Date(parseInt(j*1e3,10)),config:b,html:a.tmpl(d.loved,i)})}}return e};return a.ajax({url:a.fn.lifestream.createYqlUrl('select * from xml where url="http://ws.audioscrobbler.com/2.0/user/'+b.user+'/lovedtracks.xml"'),dataType:"jsonp",success:function(a){c(e(a))}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.librarything=function(b,c){var d=a.extend({},{book:'added <a href="http://www.librarything.com/work/book/${book.book_id}" title="${book.title} by ${book.author_fl}">${book.title} by ${book.author_fl}</a> to my library'},b.template),e=function(c){var e=[],f="";if(c.books)for(f in c.books)if(c.books.hasOwnProperty(f)){var g=c.books[f];e.push({date:new Date(g.entry_stamp*1e3),config:b,html:a.tmpl(d.book,{book:g}),url:"http://www.librarything.com/profile/"+b.user})}return e};return a.ajax({url:"http://www.librarything.com/api_getdata.php?booksort=entry_REV&userid="+b.user,dataType:"jsonp",success:function(a){c(e(a))}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.miso=function(b,c){var d=a.extend({},{watched:'checked in to <a href="${link}">${title}</a>'},b.template),e=function(c){var e=[],f,g=0,h;if(c.query&&c.query.count&&c.query.count>0){f=c.query.results.rss.channel.item,h=f.length;for(;g<h;g++){var i=f[g];e.push({url:"http://www.gomiso.com/feeds/user/"+b.user+"/checkins.rss",date:new Date(i.pubDate),config:b,html:a.tmpl(d.watched,i)})}}return e};return a.ajax({url:a.fn.lifestream.createYqlUrl('select * from xml where url="http://www.gomiso.com/feeds/user/'+b.user+'/checkins.rss"'),dataType:"jsonp",success:function(a){c(e(a))}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.mlkshk=function(b,c){var d=a.extend({},{posted:'posted <a href="${link}">${title}</a>'},b.template),e=function(c){var e=[],f,g=0,h,i;if(c.query&&c.query.count&&c.query.count>0&&c.query.results.rss.channel.item){f=c.query.results.rss.channel.item,h=f.length;for(;g<h;g++)i=f[g],e.push({date:new Date(i.pubDate),config:b,html:a.tmpl(d.posted,i)})}return e};return a.ajax({url:a.fn.lifestream.createYqlUrl('select * from xml where url="http://mlkshk.com/user/'+b.user+'/rss"'),dataType:"jsonp",success:function(a){c(e(a))}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.pinboard=function(b,c){var d=a.extend({},{bookmarked:'bookmarked <a href="${link}">${title}</a>'},b.template),e=function(c){var e=[],f,g=0,h,i;if(c.query&&c.query.count&&c.query.count>0){f=c.query.results.RDF.item,h=f.length;for(;g<h;g++)i=f[g],e.push({date:new Date(i.date),config:b,html:a.tmpl(d.bookmarked,i)})}return e};return a.ajax({url:a.fn.lifestream.createYqlUrl('select * from xml where url="http://feeds.pinboard.in/rss/u:'+b.user+'"'),dataType:"jsonp",success:function(a){c(e(a))}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.posterous=function(b,c){var d=a.extend({},{posted:'posted <a href="${link}">${title}</a>'},b.template),e=function(c){var e=[],f,g=0,h,i;if(c.query&&c.query.count&&c.query.count>0&&c.query.results.rss.channel.item){f=c.query.results.rss.channel.item,h=f.length;for(;g<h;g++)i=f[g],e.push({date:new Date(i.pubDate),config:b,html:a.tmpl(d.posted,i)})}return e};return a.ajax({url:a.fn.lifestream.createYqlUrl('select * from xml where url="http://'+b.user+'.posterous.com/rss.xml"'),dataType:"jsonp",success:function(a){c(e(a))}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.quora=function(b,c){var d=a.extend({},{posted:'<a href="${link}">${title}</a>'},b.template),e=function(c){var e=[],f,g=0,h;if(c.query&&c.query.count&&c.query.count>0){f=c.query.results.rss.channel.item,h=f.length;for(;g<h;g++){var i=f[g];e.push({url:"http://www.google.com/reader/shared"+b.user,date:new Date(i.pubDate),config:b,html:a.tmpl(d.posted,i)})}}return e};return a.ajax({url:a.fn.lifestream.createYqlUrl('select * from xml where url="http://www.quora.com/'+b.user+'/rss"'),dataType:"jsonp",success:function(a){c(e(a))}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.reddit=function(b,c){var d=a.extend({},{commented:'<a href="http://www.reddit.com/r/${item.data.subreddit}/comments/${item.data.link_id.substring(3)}/u/${item.data.name.substring(3)}?context=3">commented (${score})</a> in <a href="http://www.reddit.com/r/${item.data.subreddit}">${item.data.subreddit}</a>',created:'<a href="http://www.reddit.com${item.data.permalink}">created new thread (${score})</a> in <a href="http://www.reddit.com/r/${item.data.subreddit}">${item.data.subreddit}</a>'},b.template),e=function(b){var c=b.data.ups-b.data.downs,e={item:b,score:c>0?"+"+c:c};if(b.kind==="t1")return a.tmpl(d.commented,e);if(b.kind==="t3")return a.tmpl(d.created,e)},f=function(a){return new Date(a*1e3)};return a.ajax({url:"http://www.reddit.com/user/"+b.user+".json",dataType:"jsonp",jsonp:"jsonp",success:function(a){var d=[],g=0,h;if(a&&a.data&&a.data.children&&a.data.children.length>0){h=a.data.children.length;for(;g<h;g++){var i=a.data.children[g];d.push({date:f(i.data.created_utc),config:b,html:e(i),url:"http://reddit.com/user/"+b.user})}}c(d)}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.rss=function(b,c){var d=a.extend({},{posted:'posted <a href="${link}">${title}</a>'},b.template),e=function(c){var e=[],f,g=0,h;if(c.query&&c.query.count&&c.query.count>0){f=c.query.results.rss.channel.item,h=f.length;for(;g<h;g++){var i=f[g];e.push({url:"http://www.google.com/reader/shared"+b.user,date:new Date(i.pubDate),config:b,html:a.tmpl(d.posted,i)})}}return e};return a.ajax({url:a.fn.lifestream.createYqlUrl('select * from xml where url="'+b.user+'"'),dataType:"jsonp",success:function(a){c(e(a))}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.slideshare=function(b,c){var d=a.extend({},{uploaded:'uploaded a presentation <a href="${link}">${title}</a>'},b.template),e=function(c){var e=[],f,g=0,h,i;if(c.query&&c.query.count&&c.query.count>0){f=c.query.results.rss.channel.item,h=f.length;for(;g<h;g++)i=f[g],e.push({date:new Date(i.pubDate),config:b,html:a.tmpl(d.uploaded,i)})}return e};return a.ajax({url:a.fn.lifestream.createYqlUrl('select * from xml where url="http://www.slideshare.net/rss/user/'+b.user+'"'),dataType:"jsonp",success:function(a){c(e(a))}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.snipplr=function(b,c){var d=a.extend({},{posted:'posted a snippet <a href="${link}">${title}</a>'},b.template),e=function(c){var e=[],f,g=0,h,i;if(c.query&&c.query.count&&c.query.count>0&&c.query.results.rss.channel.item){f=c.query.results.rss.channel.item,h=f.length;for(;g<h;g++)i=f[g],e.push({date:new Date(i.pubDate),config:b,html:a.tmpl(d.posted,i)})}return e};a.ajax({url:a.fn.lifestream.createYqlUrl('select * from xml where url="http://snipplr.com/rss/users/'+b.user+'"'),dataType:"jsonp",success:function(a){c(e(a))}})}}(jQuery),function(a){a.fn.lifestream.feeds.stackoverflow=function(b,c){var d=a.extend({},{global:'<a href="${link}">${text}</a> - ${title}'},b.template),e=function(a){var c="",d="",e="",f="http://stackoverflow.com/users/"+b.user,g="http://stackoverflow.com/questions/";if(a.timeline_type==="badge")c="was "+a.action+" the '"+a.description+"' badge",d=a.detail,e=f+"?tab=reputation";else if(a.timeline_type==="comment")c="commented on",d=a.description,e=g+a.post_id;else if(a.timeline_type==="revision"||a.timeline_type==="accepted"||a.timeline_type==="askoranswered")c=a.timeline_type==="askoranswered"?a.action:a.action+" "+a.post_type,d=a.detail||a.description||"",e=g+a.post_id;return{link:e,title:d,text:c}},f=function(a){return new Date(a*1e3)};return a.ajax({url:"http://api.stackoverflow.com/1.1/users/"+b.user+"/timeline?"+"jsonp",dataType:"jsonp",jsonp:"jsonp",success:function(g){var h=[],i=0,j;if(g&&g.total&&g.total>0&&g.user_timelines){j=g.user_timelines.length;for(;i<j;i++){var k=g.user_timelines[i];h.push({date:f(k.creation_date),config:b,html:a.tmpl(d.global,e(k))})}}c(h)}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.tumblr=function(b,c){var d=a.extend({},{posted:'posted a ${type} <a href="${url}">${title}</a>'},b.template),e=b.limit||20,f=function(b){switch(b.type){case"photo":var c=b["photo-url"];return a('<img width="75" height="75"/>').attr({src:c[c.length-1].content,title:i(b),alt:i(b)}).wrap("<div/>").parent().html();case"video":var d=b["video-player"],e=d[d.length-1].content;if(e.match(/<\s*script/))return null;return e;case"audio":return b["audio-player"]+" "+a("<div/>").text(i(b)).html();default:return null}},g=function(b,c){return a(b[c]).filter(":not(:empty):first").text()},h=function(a){var b;switch(a.type){case"regular":return a["regular-title"]||g(a,"regular-body");case"link":return b=a["link-text"]||g(a,"link-description"),b===""&&(b=a["link-url"]),b;case"video":return g(a,"video-caption");case"audio":return g(a,"audio-caption");case"photo":return g(a,"photo-caption");case"quote":return'"'+a["quote-text"].replace(/<.+?>/g," ").trim()+'"';case"conversation":return b=a["conversation-title"],b||(b=a.conversation.line,typeof b!="string"&&(b=line[0].label+" "+line[0].content+" ....")),b;case"answer":return a.question;default:return a.type}},i=function(a){var b=h(a)||"";return b.replace(/<.+?>/gi," ")},j=function(b,c){return{date:new Date(c.date),config:b,html:a.tmpl(d.posted,{type:c.type.replace("regular","blog entry"),url:c.url,image:f(c),title:i(c)})}},k=function(c){var d=[],e=0,f,g;if(c.query&&c.query.count&&c.query.count>0)if(a.isArray(c.query.results.posts.post)){f=c.query.results.posts.post.length;for(;e<f;e++)g=c.query.results.posts.post[e],d.push(j(b,g))}else a.isPlainObject(c.query.results.posts.post)&&d.push(j(b,c.query.results.posts.post));return d};return a.ajax({url:a.fn.lifestream.createYqlUrl('select * from tumblr.posts where username="'+b.user+'" and num="'+e+'"'),dataType:"jsonp",success:function(a){c(k(a))}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.twitter=function(b,c){var d=a.extend({},{posted:"{{html tweet}}"},b.template),e=function(a){var b=function(a){return a.replace(/[a-z]+:\/\/[a-z0-9\-_]+\.[a-z0-9\-_:~%&\?\/.=]+[^:\.,\)\s*$]/ig,function(a){return'<a href="'+a+'">'+(a.length>25?a.substr(0,24)+"...":a)+"</a>"})},c=function(a){return a.replace(/(^|[^\w]+)\@([a-zA-Z0-9_]{1,15})/g,function(a,b,c){return b+'<a href="http://twitter.com/'+c+'">@'+c+"</a>"})},d=function(a){return a.replace(/(^|[^\w'"]+)\#([a-zA-Z0-9ÅåÄäÖöØøÆæÉéÈèÜüÊêÛûÎî_]+)/g,function(a,b,c){return b+'<a href="http://search.twitter.com/search?q=%23'+c+'">#'+c+"</a>"})};return d(c(b(a)))},f=function(c){var f=[],g=0,h,i;if(c&&c.length>0){h=c.length;for(;g<h;g++)i=c[g],f.push({date:new Date(i.created_at),config:b,html:a.tmpl(d.posted,{tweet:e(i.text),complete_url:"http://twitter.com/#!/"+b.user+"/status/"+i.id_str}),url:"http://twitter.com/#!/"+b.user})}return f};return a.ajax({url:"https://api.twitter.com/1/statuses/user_timeline.json",data:{screen_name:b.user,include_rts:1},dataType:"jsonp",success:function(a){c(f(a))}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.vimeo=function(b,c){var d=a.extend({},{liked:'liked <a href="${url}" title="${description}">${title}</a>',posted:'posted <a href="${url}" title="${description}">${title}</a>'},b.template),e=function(c,e){var f=[],g=0,h,i,j=e||"liked",k;if(c){h=c.length;for(;g<h;g++)i=c[g],j==="posted"?k=new Date(i.upload_date.replace(" ","T")):k=new Date(i.liked_on.replace(" ","T")),f.push({date:k,config:b,html:a.tmpl(d[j],{url:i.url,description:i.description.replace(/"/g,"'").replace(/<.+?>/gi,""),title:i.title})})}return f};return a.ajax({url:a.fn.lifestream.createYqlUrl('SELECT * FROM xml WHERE url="http://vimeo.com/api/v2/'+b.user+'/likes.xml" OR '+'url="http://vimeo.com/api/v2/'+b.user+'/videos.xml"'),dataType:"jsonp",success:function(a){var b=[];a.query.results.videos[0].video.length>0&&(b=b.concat(e(a.query.results.videos[0].video))),a.query.results.videos[1].video.length>0&&(b=b.concat(e(a.query.results.videos[1].video,"posted"))),c(b)}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.wikipedia=function(b,c){var d=b.language||"en",e=a.extend({},{contribution:'contributed to <a href="${url}">${title}</a>'},b.template);return a.ajax({url:"http://"+d+".wikipedia.org/w/api.php?action=query&ucuser="+b.user+"&list=usercontribs&ucdir=older&format=json",dataType:"jsonp",success:function(f){var g=[],h=0,i;if(f&&f.query.usercontribs){i=f.query.usercontribs.length;for(;h<i;h++){var j=f.query.usercontribs[h];j.url="http://"+d+".wikipedia.org/wiki/"+j.title.replace(" ","_"),g.push({date:new Date(j.timestamp),config:b,html:a.tmpl(e.contribution,j)})}}c(g)}}),{template:e}}}(jQuery),function(a){a.fn.lifestream.feeds.wordpress=function(b,c){var d=a.extend({},{posted:'posted <a href="${link}">${title}</a>'},b.template),e=function(c){var e=[],f,g=0,h,i;if(c.query&&c.query.count&&c.query.count>0&&c.query.results.rss.channel.item){f=c.query.results.rss.channel.item,h=f.length;for(;g<h;g++)i=f[g],e.push({date:new Date(i.pubDate),config:b,html:a.tmpl(d.posted,i)})}return e},f="";return b.user&&(f=b.user.indexOf("http://")===0?b.user+"/feed":"http://"+b.user+".wordpress.com/feed",a.ajax({url:a.fn.lifestream.createYqlUrl('select * from xml where url="'+f+'"'),dataType:"jsonp",success:function(a){c(e(a))}})),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.youtube=function(b,c){var d=a.
-extend({},{favorited:'favorited <a href="${video.player.default}" title="${video.description}">${video.title}</a>'},b.template),e=function(c){var e=[],f=0,g,h;if(c.data&&c.data.items){g=c.data.items.length;for(;f<g;f++)h=c.data.items[f],e.push({date:new Date(h.created),config:b,html:a.tmpl(d.favorited,h)})}return e};return a.ajax({url:"http://gdata.youtube.com/feeds/api/users/"+b.user+"/favorites?v=2&alt=jsonc",dataType:"jsonp",success:function(a){c(e(a))}}),{template:d}}}(jQuery),function(a){a.fn.lifestream.feeds.zotero=function(b,c){var d=a.extend({},{flagged:'flagged <a href="${id}">${title}</a> by ${creatorSummary}'},b.template),e=function(c){var e=[],f,g=0,h;if(c.query&&c.query.count&&c.query.count>0){f=c.query.results.feed.entry,h=f.length;for(;g<h;g++){var i=f[g];e.push({date:new Date(i.updated),config:b,url:"http://zotero.com/users/"+b.user,html:a.tmpl(d.flagged,i)})}}return e};return a.ajax({url:a.fn.lifestream.createYqlUrl('select * from xml where url="https://api.zotero.org/users/'+b.user+'/items"'),dataType:"jsonp",success:function(a){c(e(a))}}),{template:d}}}(jQuery);
+ *//*global jQuery */(function(e){"use strict";e.fn.lifestream=function(t){return this.each(function(){var n=e(this),r=jQuery.extend({classname:"lifestream",feedloaded:null,limit:10,list:[]},t),i={count:r.list.length,items:[]},s=jQuery.extend(!0,{},r),o=function(t){e.merge(i.items,t),i.items.sort(function(e,t){return t.date-e.date});var s=i.items,o=s.length<r.limit?s.length:r.limit,u=0,a,f=e('<ul class="'+r.classname+'"/>');for(;u<o;u++)a=s[u],a.html&&e('<li class="'+r.classname+"-"+a.config.service+'">').data("name",a.config.service).data("url",a.url||"#").data("time",a.date).append(a.html).appendTo(f);n.html(f),e.isFunction(r.feedloaded)&&r.feedloaded()},u=function(){var t=0,n=r.list.length;delete s.list;for(;t<n;t++){var i=r.list[t];e.fn.lifestream.feeds[i.service]&&e.isFunction(e.fn.lifestream.feeds[i.service])&&i.user&&(i._settings=s,e.fn.lifestream.feeds[i.service](i,o))}};jQuery.tmpl?u():jQuery.getScript("http://ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.js",u)})},e.fn.lifestream.createYqlUrl=function(e){return"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=[],n;for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t})})(jQuery),function(e){e.fn.lifestream.feeds.bitbucket=function(t,n){var r=e.extend({},{commit:'<a href="http://bitbucket.org/${owner}/${name}/changeset/${node}/">committed</a> at <a href="http://bitbucket.org/${owner}/${name}/">${owner}/${name}</a>',pullrequest_fulfilled:'fulfilled a pull request at <a href="http://bitbucket.org/${owner}/${name}/">${owner}/${name}</a>',pullrequest_rejected:'rejected a pull request at <a href="http://bitbucket.org/${owner}/${name}/">${owner}/${name}</a>',pullrequest_created:'created a pull request at <a href="http://bitbucket.org/${owner}/${name}/">${owner}/${name}</a>',create:'created a new project at <a href="http://bitbucket.org/${owner}/${name}/">${owner}/${name}</a>',fork:'forked <a href="http://bitbucket.org/${owner}/${name}/">${owner}/${name}</a>'},t.template),i=["commit","pullrequest_fulfilled","pullrequest_rejected","pullrequest_created","create","fork"],s=function(t){if(e.inArray(t.event,i)!==-1&&t.repository)return t.event==="commit"?e.tmpl(r.commit,{owner:t.repository.owner,name:t.repository.name,node:t.node}):e.tmpl(r[t.event],{owner:t.repository.owner,name:t.repository.name})},o=function(n){var r=[],i=0;return n.query&&n.query.count&&n.query.count>0&&e.each(n.query.results.json,function(){r.push({date:new Date(this.events.created_on.replace(/-/g,"/")),config:t,html:s(this.events)})}),r};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){n(o(e))}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.bitly=function(t,n){var r=e.extend({},{created:'created URL <a href="${short_url}" title="${title}">${short_url}</a>'},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(i){var s=[],o=0,u;if(i.query&&i.query.count&&i.query.results.json){list=i.query.results.json,u=list.length;for(;o<u;o++){var a=list[o].data;s.push({date:new Date(a.created*1e3),config:t,html:e.tmpl(r.created,a)})}}n(s)}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.blogger=function(t,n){var r=e.extend({},{posted:'posted <a href="${origLink}">${title}</a>'},t.template),i=function(n){var i=[],s,o=0,u,a,f,l;if(n.query&&n.query.count&&n.query.count>0&&n.query.results.feed.entry){s=n.query.results.feed.entry,u=s.length;for(;o<u;o++){a=s[o];if(!a.origLink){f=0,l=a.link.length;for(;f<l;f++)a.link[f].rel==="alternate"&&(a.origLink=a.link[f].href)}a.origLink&&(a.title.content&&(a.title=a.title.content),i.push({date:new Date(a.published),config:t,html:e.tmpl(r.posted,a)}))}}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){n(i(e))}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.citeulike=function(t,n){var r=e.extend({},{saved:'saved <a href="${href}">${title}</a> by ${authors}'},t.template),i=function(n){var i=[],s=0,o;if(n&&n.length&&n.length>0){o=n.length;for(;s<o;s++){var u=n[s];i.push({date:new Date(u.date),config:t,url:"http://www.citeulike.org/user/"+t.user,html:e.tmpl(r.saved,u)})}}return i};return e.ajax({url:"http://www.citeulike.org/json/user/"+t.user,dataType:"jsonp",success:function(e){n(i(e))}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.dailymotion=function(t,n){var r=e.extend({},{uploaded:'uploaded a video <a href="${link}">${title[0]}</a>'},t.template),i=function(n){var i=[],s,o=0,u,a;if(n.query&&n.query.count&&n.query.count>0&&n.query.results.rss.channel.item){s=n.query.results.rss.channel.item,u=s.length;for(;o<u;o++)a=s[o],i.push({date:new Date(a.pubDate),config:t,html:e.tmpl(r.uploaded,a)})}return i};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){n(i(e))}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.delicious=function(t,n){var r=e.extend({},{bookmarked:'bookmarked <a href="${u}">${d}</a>'},t.template);return e.ajax({url:"http://feeds.delicious.com/v2/json/"+t.user,dataType:"jsonp",success:function(i){var s=[],o=0,u;if(i&&i.length&&i.length>0){u=i.length;for(;o<u;o++){var a=i[o];s.push({date:new Date(a.dt),config:t,html:e.tmpl(r.bookmarked,a)})}}n(s)}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.deviantart=function(t,n){var r=e.extend({},{posted:'posted <a href="${link}">${title}</a>'},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(i){var s=[],o,u,a=0,f;if(i.query&&i.query.count>0){o=i.query.results.item,f=o.length;for(;a<f;a++)u=o[a],s.push({date:new Date(u.pubDate),config:t,html:e.tmpl(r.posted,u)})}n(s)}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.dribbble=function(t,n){var r=e.extend({},{posted:'posted a shot <a href="${url}">${title}</a>'},t.template);return e.ajax({url:"http://api.dribbble.com/players/"+t.user+"/shots",dataType:"jsonp",success:function(i){var s=[],o=0,u;if(i&&i.total){u=i.shots.length;for(;o<u;o++){var a=i.shots[o];s.push({date:new Date(a.created_at),config:t,html:e.tmpl(r.posted,a)})}}n(s)}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.facebook_page=function(t,n){var r=e.extend({},{wall_post:'post on wall <a href="${link}">${title}</a>'},t.template),i=function(n){var i=[],s,o=0,u;if(n.query&&n.query.count&&n.query.count>0){s=n.query.results.rss.channel.item,u=s.length;for(;o<u;o++){var a=s[o];e.trim(a.title)&&i.push({date:new Date(a.pubDate),config:t,html:e.tmpl(r.wall_post,a)})}}return i};return e.ajax({url:e.fn.lifestream.createYqlUrl('select * from xml where url="www.facebook.com/feeds/page.php?id='+t.user+'&format=rss20"'),dataType:"jsonp",success:function(e){n(i(e))}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.flickr=function(t,n){var r=e.extend({},{posted:'posted a photo <a href="${link}">${title}</a>'},t.template);return e.ajax({url:"http://api.flickr.com/services/feeds/photos_public.gne?id="+t.user+"&lang=en-us&format=json",dataType:"jsonp",jsonp:"jsoncallback",success:function(i){var s=[],o=0,u;if(i&&i.items&&i.items.length>0){u=i.items.length;for(;o<u;o++){var a=i.items[o];s.push({date:new Date(a.published),config:t,html:e.tmpl(r.posted,a)})}}n(s)}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.foomark=function(t,n){var r=e.extend({},{bookmarked:'bookmarked <a href="${url}">${url}</a>'},t.template);return e.ajax({url:"http://api.foomark.com/urls/list/",data:{format:"jsonp",username:t.user},dataType:"jsonp",success:function(i){var s=[],o=0,u;if(i&&i.length&&i.length>0){u=i.length;for(;o<u;o++){var a=i[o];s.push({date:new Date(a.created_at.replace(/-/g,"/")),config:t,html:e.tmpl(r.bookmarked,a)})}}n(s)}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.formspring=function(t,n){var r=e.extend({},{answered:'answered a question <a href="${link}">${title}</a>'},t.template),i=function(n){var i=[],s,o=0,u,a;if(n.query&&n.query.count&&n.query.count>0&&n.query.results.rss.channel.item){s=n.query.results.rss.channel.item,u=s.length;for(;o<u;o++)a=s[o],i.push({date:new Date(a.pubDate),config:t,html:e.tmpl(r.answered,a)})}return i};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){n(i(e))}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.forrst=function(t,n){var r=e.extend({},{posted:'posted a ${post_type} <a href="${post_url}">${title}</a>'},t.template);return e.ajax({url:"http://forrst.com/api/v2/users/posts?username="+t.user,dataType:"jsonp",success:function(i){var s=[],o=0,u;if(i&&i.resp.length&&i.resp.length>0){u=i.resp.length;for(;o<u;o++){var a=i.resp[o];s.push({date:new Date(a.created_at.replace(" ","T")),config:t,html:e.tmpl(r.posted,a)})}}n(s)}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.foursquare=function(t,n){var r=e.extend({},{checkedin:'checked in @ <a href="${link}">${title}</a>'},t.template),i=function(n){var i=[],s=0,o;if(n.query&&n.query.count&&n.query.count>0){o=n.query.count;for(;s<o;s++){var u=n.query.results.item[s];i.push({date:new Date(u.pubDate),config:t,html:e.tmpl(r.checkedin,u)})}}return i};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){n(i(e))}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.gimmebar=function(t,n){var r=e.extend({},{bookmarked:'bookmarked <a href="${short_url}">${title}</a>'},t.template);return e.ajax({url:"https://gimmebar.com/api/v0/public/assets/"+t.user+".json?jsonp_callback=?",dataType:"json",success:function(i){i=i.records;var s=[],o=0,u;if(i&&i.length&&i.length>0){u=i.length;for(;o<u;o++){var a=i[o];s.push({date:new Date(a.date*1e3),config:t,html:e.tmpl(r.bookmarked,a)})}}n(s)}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.github=function(t,n){var r=e.extend({},{commitCommentEvent:'commented on <a href="http://github.com/${status.repo.name}">${status.repo.name}</a>',createBranchEvent:'created branch <a href="http://github.com/${status.repo.name}/tree/${status.payload.ref}">${status.payload.ref}</a> at <a href="http://github.com/${status.repo.name}">${status.repo.name}</a>',createRepositoryEvent:'created repository <a href="http://github.com/${status.repo.name}">${status.repo.name}</a>',createTagEvent:'created tag <a href="http://github.com/${status.repo.name}/tree/${status.payload.ref}">${status.payload.ref}</a> at <a href="http://github.com/${status.repo.name}">${status.repo.name}</a>',deleteBranchEvent:'deleted branch ${status.payload.ref} at <a href="http://github.com/${status.repo.name}">${status.repo.name}</a>',deleteTagEvent:'deleted tag ${status.payload.ref} at <a href="http://github.com/${status.repo.name}">${status.repo.name}</a>',followEvent:'started following <a href="http://github.com/${status.payload.target.login}">${status.payload.target.login}</a>',forkEvent:'forked <a href="http://github.com/${status.repo.name}">${status.repo.name}</a>',gistEvent:'${status.payload.action} gist <a href="http://gist.github.com/${status.payload.gist.id}">${status.payload.gist.id}</a>',issueCommentEvent:'commented on issue <a href="http://github.com/${status.repo.name}/issues/${status.payload.issue.number}">${status.payload.issue.number}</a> on <a href="http://github.com/${status.repo.name}">${status.repo.name}</a>',issuesEvent:'${status.payload.action} issue <a href="http://github.com/${status.repo.name}/issues/${status.payload.issue.number}">${status.payload.issue.number}</a> on <a href="http://github.com/${status.repo.name}">${status.repo.name}</a>',pullRequestEvent:'${status.payload.action} pull request <a href="http://github.com/${status.repo.name}/pull/${status.payload.number}">${status.payload.number}</a> on <a href="http://github.com/${status.repo.name}">${status.repo.name}</a>',pushEvent:'pushed to <a href="http://github.com/${status.repo.name}/tree/${status.payload.ref}">${status.payload.ref}</a> at <a href="http://github.com/${status.repo.name}">${status.repo.name}</a>',watchEvent:'started watching <a href="http://github.com/${status.repo.name}">${status.repo.name}</a>'},t.template),i=function(t){if(t.type==="CommitCommentEvent")return e.tmpl(r.commitCommentEvent,{status:t});if(t.type==="CreateEvent"&&t.payload.ref_type==="branch")return e.tmpl(r.createBranchEvent,{status:t});if(t.type==="CreateEvent"&&t.payload.ref_type==="repository")return e.tmpl(r.createRepositoryEvent,{status:t});if(t.type==="CreateEvent"&&t.payload.ref_type==="tag")return e.tmpl(r.createTagEvent,{status:t});if(t.type==="DeleteEvent"&&t.payload.ref_type==="branch")return e.tmpl(r.deleteBranchEvent,{status:t});if(t.type==="DeleteEvent"&&t.payload.ref_type==="tag")return e.tmpl(r.deleteTagEvent,{status:t});if(t.type==="FollowEvent")return e.tmpl(r.followEvent,{status:t});if(t.type==="ForkEvent")return e.tmpl(r.forkEvent,{status:t});if(t.type==="GistEvent")return t.payload.action==="create"?t.payload.action="created":t.payload.action==="update"&&(t.payload.action="updated"),e.tmpl(r.gistEvent,{status:t});if(t.type==="IssueCommentEvent")return e.tmpl(r.issueCommentEvent,{status:t});if(t.type==="IssuesEvent")return e.tmpl(r.issuesEvent,{status:t});if(t.type==="PullRequestEvent")return e.tmpl(r.pullRequestEvent,{status:t});if(t.type==="PushEvent")return t.payload.ref=t.payload.ref.split("/")[2],e.tmpl(r.pushEvent,{status:t});if(t.type==="WatchEvent")return e.tmpl(r.watchEvent,{status:t})},s=function(e){var n=[],r=0,s;if(e.query&&e.query.count&&e.query.count>0){s=e.query.count;for(;r<s;r++){var o=e.query.results.json[r].json;n.push({date:new Date(o.created_at),config:t,html:i(o),url:"https://github.com/"+t.user})}}return n};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){n(s(e))}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.googleplus=function(t,n){var r=e.extend({},{posted:'<a href="${actor.url}">${actor.displayName}</a> has posted a new entry <a href="${url}" title="${id}">${title}</a> <!--With--> ${object.replies.totalItems} replies, ${object.plusoners.totalItems} +1s, ${object.resharers.totalItems} Reshares'},t.template),i=function(n){var i=[],s=0,o,u;if(n&&n.items){o=n.items.length;for(;s<o;s++)u=n.items[s],i.push({date:new Date(u.published),config:t,html:e.tmpl(r.posted,u)})}return i};return e.ajax({url:"https://www.googleapis.com/plus/v1/people/"+t.user+"/activities/public",data:{key:t.key},dataType:"jsonp",success:function(e){if(e.error){n([]),console&&console.error&&console.error("Error loading Google+ stream.",e.error);return}n(i(e))}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.googlereader=function(t,n){var r=e.extend({},{starred:'shared <a href="{{if link.href}}${link.href}{{else}}${source.link.href}{{/if}}">${title.content}</a>'},t.template),i=function(n){var i=[],s,o=0,u;if(n.query&&n.query.count&&n.query.count>0){s=n.query.results.feed.entry,u=s.length;for(;o<u;o++){var a=s[o];i.push({url:"http://www.google.com/reader/shared"+t.user,date:new Date(parseInt(a["crawl-timestamp-msec"],10)),config:t,html:e.tmpl(r.starred,a)})}}return i};return e.ajax({url:e.fn.lifestream.createYqlUrl('select * from xml where url="www.google.com/reader/public/atom/user%2F'+t.user+'%2Fstate%2Fcom.google%2Fbroadcast"'),dataType:"jsonp",success:function(e){n(i(e))}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.hypem=function(t,n){if(!t.type||t.type!=="history"||t.type!=="loved")t.type="loved";var r=e.extend({},{loved:'loved <a href="http://hypem.com/item/${mediaid}">${title}</a> by <a href="http://hypem.com/artist/${artist}">${artist}</a>',history:'listened to <a href="http://hypem.com/item/${mediaid}">${title}</a> by <a href="http://hypem.com/artist/${artist}">${artist}</a>'},t.template);return e.ajax({url:"http://hypem.com/playlist/"+t.type+"/"+t.user+"/json/1/data.js",dataType:"json",success:function(i){var s=[],o=0,u=-1;for(var a in i)i.hasOwnProperty(a)&&u++;if(i&&u>0)for(;o<u;o++){var f=i[o];s.push({date:new Date((t.type==="history"?f.dateplayed:f.dateloved)*1e3),config:t,html:e.tmpl(t.type==="history"?r.history:r.loved,f)})}n(s)}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.instapaper=function(t,n){var r=e.extend({},{loved:'loved <a href="${link}">${title}</a>'},t.template),i=function(n){var i=[],s,o=0,u,a;if(n.query&&n.query.count&&n.query.count>0&&n.query.results.rss.channel.item){s=n.query.results.rss.channel.item,u=s.length;for(;o<u;o++)a=s[o],i.push({date:new Date(a.pubDate),config:t,html:e.tmpl(r.loved,a)})}return i};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){n(i(e))}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.iusethis=function(t,n){var r=e.extend({},{global:'${action} <a href="${link}">${what}</a> on (${os})'},t.template),i=function(n){var i=[],s,o,u,a,f,l=0,c,h,p,d,v,m,g,y=["iPhone","OS X","Windows"];if(n.query&&n.query.count&&n.query.count>0&&n.query.results.rss){c=n.query.results.rss.length,d=["started using","stopped using","stopped loving","Downloaded","commented on","updated entry for","started loving","registered"],f=d.length;for(;l<c;l++){g=y[l],s=n.query.results.rss[l].channel.item,o=0,u=s.length;for(;o<u;o++){h=s[o],p=h.title.replace(t.user+" ",""),a=0;for(;a<f;a++)if(p.indexOf(d[a])>-1){v=d[a];break}m=p.split(v),i.push({date:new Date(h.pubDate),config:t,html:e.tmpl(r.global,{action:v.toLowerCase(),link:h.link,what:m[1],os:g})})}}}return i};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){n(i(e))}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.lastfm=function(t,n){var r=e.extend({},{loved:'loved <a href="${url}">${name}</a> by <a href="${artist.url}">${artist.name}</a>'},t.template),i=function(n){var i=[],s,o=0,u;if(n.query&&n.query.count&&n.query.count>0&&n.query.results.lovedtracks&&n.query.results.lovedtracks.track){s=n.query.results.lovedtracks.track,u=s.length;for(;o<u;o++){var a=s[o],f=a.nowplaying?new Date:a.date.uts;i.push({date:new Date(parseInt(f*1e3,10)),config:t,html:e.tmpl(r.loved,a)})}}return i};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){n(i(e))}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.librarything=function(t,n){var r=e.extend({},{book:'added <a href="http://www.librarything.com/work/book/${book.book_id}" title="${book.title} by ${book.author_fl}">${book.title} by ${book.author_fl}</a> to my library'},t.template),i=function(n){var i=[],s="";if(n.books)for(s in n.books)if(n.books.hasOwnProperty(s)){var o=n.books[s];i.push({date:new Date(o.entry_stamp*1e3),config:t,html:e.tmpl(r.book,{book:o}),url:"http://www.librarything.com/profile/"+t.user})}return i};return e.ajax({url:"http://www.librarything.com/api_getdata.php?booksort=entry_REV&userid="+t.user,dataType:"jsonp",success:function(e){n(i(e))}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.miso=function(t,n){var r=e.extend({},{watched:'checked in to <a href="${link}">${title}</a>'},t.template),i=function(n){var i=[],s,o=0,u;if(n.query&&n.query.count&&n.query.count>0){s=n.query.results.rss.channel.item,u=s.length;for(;o<u;o++){var a=s[o];i.push({url:"http://www.gomiso.com/feeds/user/"+t.user+"/checkins.rss",date:new Date(a.pubDate),config:t,html:e.tmpl(r.watched,a)})}}return i};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){n(i(e))}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.mlkshk=function(t,n){var r=e.extend({},{posted:'posted <a href="${link}">${title}</a>'},t.template),i=function(n){var i=[],s,o=0,u,a;if(n.query&&n.query.count&&n.query.count>0&&n.query.results.rss.channel.item){s=n.query.results.rss.channel.item,u=s.length;for(;o<u;o++)a=s[o],i.push({date:new Date(a.pubDate),config:t,html:e.tmpl(r.posted,a)})}return i};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){n(i(e))}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.pinboard=function(t,n){var r=e.extend({},{bookmarked:'bookmarked <a href="${link}">${title}</a>'},t.template),i=function(n){var i=[],s,o=0,u,a;if(n.query&&n.query.count&&n.query.count>0){s=n.query.results.RDF.item,u=s.length;for(;o<u;o++)a=s[o],i.push({date:new Date(a.date),config:t,html:e.tmpl(r.bookmarked,a)})}return i};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){n(i(e))}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.posterous=function(t,n){var r=e.extend({},{posted:'posted <a href="${link}">${title}</a>'},t.template),i=function(n){var i=[],s,o=0,u,a;if(n.query&&n.query.count&&n.query.count>0&&n.query.results.rss.channel.item){s=n.query.results.rss.channel.item,u=s.length;for(;o<u;o++)a=s[o],i.push({date:new Date(a.pubDate),config:t,html:e.tmpl(r.posted,a)})}return i};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){n(i(e))}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.quora=function(t,n){var r=e.extend({},{posted:'<a href="${link}">${title}</a>'},t.template),i=function(n){var i=[],s,o=0,u;if(n.query&&n.query.count&&n.query.count>0){s=n.query.results.rss.channel.item,u=s.length;for(;o<u;o++){var a=s[o];i.push({url:"http://www.google.com/reader/shared"+t.user,date:new Date(a.pubDate),config:t,html:e.tmpl(r.posted,a)})}}return i};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){n(i(e))}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.reddit=function(t,n){var r=e.extend({},{commented:'<a href="http://www.reddit.com/r/${item.data.subreddit}/comments/${item.data.link_id.substring(3)}/u/${item.data.name.substring(3)}?context=3">commented (${score})</a> in <a href="http://www.reddit.com/r/${item.data.subreddit}">${item.data.subreddit}</a>',created:'<a href="http://www.reddit.com${item.data.permalink}">created new thread (${score})</a> in <a href="http://www.reddit.com/r/${item.data.subreddit}">${item.data.subreddit}</a>'},t.template),i=function(t){var n=t.data.ups-t.data.downs,i={item:t,score:n>0?"+"+n:n};if(t.kind==="t1")return e.tmpl(r.commented,i);if(t.kind==="t3")return e.tmpl(r.created,i)},s=function(e){return new Date(e*1e3)};return e.ajax({url:"http://www.reddit.com/user/"+t.user+".json",dataType:"jsonp",jsonp:"jsonp",success:function(e){var r=[],o=0,u;if(e&&e.data&&e.data.children&&e.data.children.length>0){u=e.data.children.length;for(;o<u;o++){var a=e.data.children[o];r.push({date:s(a.data.created_utc),config:t,html:i(a),url:"http://reddit.com/user/"+t.user})}}n(r)}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.rss=function(t,n){var r=e.extend({},{posted:'posted <a href="${link}">${title}</a>'},t.template),i=function(n){var i=[],s,o=0,u;if(n.query&&n.query.count&&n.query.count>0){s=n.query.results.rss.channel.item,u=s.length;for(;o<u;o++){var a=s[o];i.push({url:"http://www.google.com/reader/shared"+t.user,date:new Date(a.pubDate),config:t,html:e.tmpl(r.posted,a)})}}return i};return e.ajax({url:e.fn.lifestream.createYqlUrl('select * from xml where url="'+t.user+'"'),dataType:"jsonp",success:function(e){n(i(e))}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.slideshare=function(t,n){var r=e.extend({},{uploaded:'uploaded a presentation <a href="${link}">${title}</a>'},t.template),i=function(n){var i=[],s,o=0,u,a;if(n.query&&n.query.count&&n.query.count>0){s=n.query.results.rss.channel.item,u=s.length;for(;o<u;o++)a=s[o],i.push({date:new Date(a.pubDate),config:t,html:e.tmpl(r.uploaded,a)})}return i};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){n(i(e))}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.snipplr=function(t,n){var r=e.extend({},{posted:'posted a snippet <a href="${link}">${title}</a>'},t.template),i=function(n){var i=[],s,o=0,u,a;if(n.query&&n.query.count&&n.query.count>0&&n.query.results.rss.channel.item){s=n.query.results.rss.channel.item,u=s.length;for(;o<u;o++)a=s[o],i.push({date:new Date(a.pubDate),config:t,html:e.tmpl(r.posted,a)})}return i};e.ajax({url:e.fn.lifestream.createYqlUrl('select * from xml where url="http://snipplr.com/rss/users/'+t.user+'"'),dataType:"jsonp",success:function(e){n(i(e))}})}}(jQuery),function(e){e.fn.lifestream.feeds.stackoverflow=function(t,n){var r=e.extend({},{global:'<a href="${link}">${text}</a> - ${title}'},t.template),i=function(e){var n="",r="",i="",s="http://stackoverflow.com/users/"+t.user,o="http://stackoverflow.com/questions/";if(e.timeline_type==="badge")n="was "+e.action+" the '"+e.description+"' badge",r=e.detail,i=s+"?tab=reputation";else if(e.timeline_type==="comment")n="commented on",r=e.description,i=o+e.post_id;else if(e.timeline_type==="revision"||e.timeline_type==="accepted"||e.timeline_type==="askoranswered")n=e.timeline_type==="askoranswered"?e.action:e.action+" "+e.post_type,r=e.detail||e.description||"",i=o+e.post_id;return{link:i,title:r,text:n}},s=function(e){return new Date(e*1e3)};return e.ajax({url:"http://api.stackoverflow.com/1.1/users/"+t.user+"/timeline?"+"jsonp",dataType:"jsonp",jsonp:"jsonp",success:function(o){var u=[],a=0,f;if(o&&o.total&&o.total>0&&o.user_timelines){f=o.user_timelines.length;for(;a<f;a++){var l=o.user_timelines[a];u.push({date:s(l.creation_date),config:t,html:e.tmpl(r.global,i(l))})}}n(u)}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.tumblr=function(t,n){var r=e.extend({},{posted:'posted a ${type} <a href="${url}">${title}</a>'},t.template),i=t.limit||20,s=function(t){switch(t.type){case"photo":var n=t["photo-url"];return e('<img width="75" height="75"/>').attr({src:n[n.length-1].content,title:a(t),alt:a(t)}).wrap("<div/>").parent().html();case"video":var r=t["video-player"],i=r[r.length-1].content;if(i.match(/<\s*script/))return null;return i;case"audio":return t["audio-player"]+" "+e("<div/>").text(a(t)).html();default:return null}},o=function(t,n){return e(t[n]).filter(":not(:empty):first").text()},u=function(e){var t;switch(e.type){case"regular":return e["regular-title"]||o(e,"regular-body");case"link":return t=e["link-text"]||o(e,"link-description"),t===""&&(t=e["link-url"]),t;case"video":return o(e,"video-caption");case"audio":return o(e,"audio-caption");case"photo":return o(e,"photo-caption");case"quote":return'"'+e["quote-text"].replace(/<.+?>/g," ").trim()+'"';case"conversation":return t=e["conversation-title"],t||(t=e.conversation.line,typeof t!="string"&&(t=line[0].label+" "+line[0].content+" ....")),t;case"answer":return e.question;default:return e.type}},a=function(e){var t=u(e)||"";return t.replace(/<.+?>/gi," ")},f=function(t,n){return{date:new Date(n.date),config:t,html:e.tmpl(r.posted,{type:n.type.replace("regular","blog entry"),url:n.url,image:s(n),title:a(n)})}},l=function(n){var r=[],i=0,s,o;if(n.query&&n.query.count&&n.query.count>0)if(e.isArray(n.query.results.posts.post)){s=n.query.results.posts.post.length;for(;i<s;i++)o=n.query.results.posts.post[i],r.push(f(t,o))}else e.isPlainObject(n.query.results.posts.post)&&r.push(f(t,n.query.results.posts.post));return r};return e.ajax({url:e.fn.lifestream.createYqlUrl('select * from tumblr.posts where username="'+t.user+'" and num="'+i+'"'),dataType:"jsonp",success:function(e){n(l(e))}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.twitter=function(t,n){var r=e.extend({},{posted:"{{html tweet}}"},t.template),i=function(e){var t=function(e){return e.replace(/[a-z]+:\/\/[a-z0-9\-_]+\.[a-z0-9\-_:~%&\?\/.=]+[^:\.,\)\s*$]/ig,function(e){return'<a href="'+e+'">'+(e.length>25?e.substr(0,24)+"...":e)+"</a>"})},n=function(e){return e.replace(/(^|[^\w]+)\@([a-zA-Z0-9_]{1,15})/g,function(e,t,n){return t+'<a href="http://twitter.com/'+n+'">@'+n+"</a>"})},r=function(e){return e.replace(/(^|[^\w'"]+)\#([a-zA-Z0-9ÅåÄäÖöØøÆæÉéÈèÜüÊêÛûÎî_]+)/g,function(e,t,n){return t+'<a href="http://search.twitter.com/search?q=%23'+n+'">#'+n+"</a>"})};return r(n(t(e)))},s=function(n){var s=[],o=0,u,a;if(n&&n.length>0){u=n.length;for(;o<u;o++)a=n[o],s.push({date:new Date(a.created_at),config:t,html:e.tmpl(r.posted,{tweet:i(a.text),complete_url:"http://twitter.com/#!/"+t.user+"/status/"+a.id_str}),url:"http://twitter.com/#!/"+t.user})}return s};return e.ajax({url:"https://api.twitter.com/1/statuses/user_timeline.json",data:{screen_name:t.user,include_rts:1},dataType:"jsonp",success:function(e){n(s(e))}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.vimeo=function(t,n){var r=e.extend({},{liked:'liked <a href="${url}" title="${description}">${title}</a>',posted:'posted <a href="${url}" title="${description}">${title}</a>'},t.template),i=function(n,i){var s=[],o=0,u,a,f=i||"liked",l;if(n){u=n.length;for(;o<u;o++)a=n[o],f==="posted"?l=new Date(a.upload_date.replace(" ","T")):l=new Date(a.liked_on.replace(" ","T")),s.push({date:l,config:t,html:e.tmpl(r[f],{url:a.url,description:a.description?a.description.replace(/"/g,"'").replace(/<.+?>/gi,""):"",title:a.title})})}return s};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=[];e.query.results.videos[0].video.length>0&&(t=t.concat(i(e.query.results.videos[0].video))),e.query.results.videos[1].video.length>0&&(t=t.concat(i(e.query.results.videos[1].video,"posted"))),n(t)}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.wikipedia=function(t,n){var r=t.language||"en",i=e.extend({},{contribution:'contributed to <a href="${url}">${title}</a>'},t.template);return e.ajax({url:"http://"+r+".wikipedia.org/w/api.php?action=query&ucuser="+t.user+"&list=usercontribs&ucdir=older&format=json",dataType:"jsonp",success:function(s){var o=[],u=0,a;if(s&&s.query.usercontribs){a=s.query.usercontribs.length;for(;u<a;u++){var f=s.query.usercontribs[u];f.url="http://"+r+".wikipedia.org/wiki/"+f.title.replace(" ","_"),o.push({date:new Date(f.timestamp),config:t,html:e.tmpl(i.contribution,f)})}}n(o)}}),{template:i}}}(jQuery),function(e){e.fn.lifestream.feeds.wordpress=function(t,n){var r=e.extend({},{posted:'posted <a href="${link}">${title}</a>'},t.template),i=function(n){var i=[],s,o=0,u,a;if(n.query&&n.query.count&&n.query.count>0&&n.query.results.rss.channel.item){s=n.query.results.rss.channel.item,u=s.length;for(;o<u;o++)a=s[o],i.push({date:new Date(a.pubDate),config:t,html:e.tmpl(r.posted,a)})}return i},s="";return t.user&&(s=t.user.indexOf("http://")===0?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){n(i(e))}})),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.youtube=function(t,n)
+{var r=e.extend({},{uploaded:'uploaded <a href="${video.player.default}" title="${video.description}">${video.title}</a>',favorited:'favorited <a href="${video.player.default}" title="${video.description}">${video.title}</a>'},t.template),i=function(n,i){var s=[],o=0,u,a,f,l,c;if(n.data&&n.data.items){u=n.data.items.length;for(;o<u;o++){a=n.data.items[o];switch(i){case"favorited":f=a.video,l=a.created,c=a;break;case"uploaded":f=a,l=f.uploaded,c={video:f}}if(f.status&&f.status.reason)continue;s.push({date:new Date(l),config:t,html:e.tmpl(r[i],c)})}}return s};return e.ajax({url:"http://gdata.youtube.com/feeds/api/users/"+t.user+"/favorites?v=2&alt=jsonc",dataType:"jsonp",success:function(e){n(i(e,"favorited"))}}),e.ajax({url:"http://gdata.youtube.com/feeds/api/users/"+t.user+"/uploads?v=2&alt=jsonc",dataType:"jsonp",success:function(e){n(i(e,"uploaded"))}}),{template:r}}}(jQuery),function(e){e.fn.lifestream.feeds.zotero=function(t,n){var r=e.extend({},{flagged:'flagged <a href="${id}">${title}</a> by ${creatorSummary}'},t.template),i=function(n){var i=[],s,o=0,u;if(n.query&&n.query.count&&n.query.count>0){s=n.query.results.feed.entry,u=s.length;for(;o<u;o++){var a=s[o];i.push({date:new Date(a.updated),config:t,url:"http://zotero.com/users/"+t.user,html:e.tmpl(r.flagged,a)})}}return i};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){n(i(e))}}),{template:r}}}(jQuery);
4 src/core.js
View
@@ -5,7 +5,7 @@
*
* Copyright 2011, Christian Vuerings - http://denbuzze.com
*/
-/*globals jQuery, $ */
+/*global jQuery */
;(function( $ ){
"use strict";
@@ -144,7 +144,7 @@
// At then end we call the load method.
if( !jQuery.tmpl ) {
jQuery.getScript(
- "http://ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js",
+ "http://ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.js",
load);
} else {
load();
5 src/services/vimeo.js
View
@@ -26,8 +26,9 @@ $.fn.lifestream.feeds.vimeo = function( config, callback ) {
config: config,
html: $.tmpl( template[type], {
url: item.url,
- description: item.description.replace(/"/g, "'")
- .replace( /<.+?>/gi, ""),
+ description: item.description ? item.description
+ .replace(/"/g, "'")
+ .replace( /<.+?>/gi, "") : '',
title: item.title
})
});
42 src/services/youtube.js
View
@@ -3,22 +3,43 @@ $.fn.lifestream.feeds.youtube = function( config, callback ) {
var template = $.extend({},
{
+ uploaded: 'uploaded <a href="${video.player.default}" '
+ + 'title="${video.description}">${video.title}</a>',
favorited: 'favorited <a href="${video.player.default}" '
+ 'title="${video.description}">${video.title}</a>'
},
config.template),
- parseYoutube = function( input ) {
- var output = [], i = 0, j, item;
+ parseYoutube = function( input, activity ) {
+ var output = [], i = 0, j, item, video, date, templateData;
if(input.data && input.data.items) {
j = input.data.items.length;
for( ; i<j; i++) {
item = input.data.items[i];
+
+ switch (activity) {
+ case 'favorited':
+ video = item.video;
+ date = item.created;
+ templateData = item;
+ break;
+ case 'uploaded':
+ video = item;
+ date = video.uploaded;
+ templateData = {video: video};
+ break;
+ }
+
+ // Don't add private items
+ if (video.status && video.status.reason) {
+ continue;
+ }
+
output.push({
- date: new Date(item.created),
+ date: new Date(date),
config: config,
- html: $.tmpl( template.favorited, item )
+ html: $.tmpl( template[activity], templateData )
});
}
}
@@ -31,7 +52,16 @@ $.fn.lifestream.feeds.youtube = function( config, callback ) {
+ "/favorites?v=2&alt=jsonc",
dataType: 'jsonp',
success: function( data ) {
- callback(parseYoutube(data));
+ callback(parseYoutube(data, 'favorited'));
+ }
+ });
+
+ $.ajax({
+ url: "http://gdata.youtube.com/feeds/api/users/" + config.user
+ + "/uploads?v=2&alt=jsonc",
+ dataType: 'jsonp',
+ success: function( data ) {
+ callback(parseYoutube(data, 'uploaded'));
}
});
@@ -42,4 +72,4 @@ $.fn.lifestream.feeds.youtube = function( config, callback ) {
};
};
-})(jQuery);
+})(jQuery);
Something went wrong with that request. Please try again.