Here's the diff for this branch:
=== modified file 'lifestream.html' --- lifestream.html 2008-12-12 00:16:45 +0000 +++ lifestream.html 2008-12-27 19:16:42 +0000 @@ -14,12 +14,16 @@ td.time, td.source { color: #aaa; background: white; } -tr.flickr td.data { color: white; background: #0c0; } -tr.twitter td.data { color: white; background: #933; } -tr.identica td.data { color: white; background: #339; } -tr.flickr:hover td { color: white; background: #0d0; } -tr.twitter:hover td { color: white; background: #a33; } +tr.flickr td.data { color: white; background: #0c0; } +tr.twitter td.data { color: white; background: #933; } +tr.identica td.data { color: white; background: #339; } +tr.picasa td.data { color: white; background: #8c8; } +tr.youtube td.data { color: white; background: #c00; } +tr.flickr:hover td { color: white; background: #0d0; } +tr.twitter:hover td { color: white; background: #a33; } tr.identica:hover td { color: white; background: #33a; } +tr.picasa:hover td { color: white; background: #8d8; } +tr.youtube:hover td { color: white; background: #d00; } </style> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> <script> @@ -136,13 +140,13 @@ Date.prototype.format = function (mask, return dateFormat(this, mask, utc); };
- - ls = { tag_api: [ ["http://search.twitter.com/search.json?callback=?&q=%23$TAG", "twittersearch"], ["http://api.flickr.com/services/feeds/photos_public.gne?tags=$TAG&lang=en-us&format=json&jsoncallback=?", "flickr"], - ["http://pipes.yahoo.com/pipes/pipe.run?_id=qGysIErH3RGVW2OJBRNMsA&_render=json&tag=$TAG&_callback=?", "identicasearch"] + ["http://pipes.yahoo.com/pipes/pipe.run?_id=qGysIErH3RGVW2OJBRNMsA&_render=json&tag=$TAG&_callback=?", "identicasearch"], + ["http://gdata.youtube.com/feeds/videos?alt=json-in-script&vq=$TAG&callback=?", "gdata"], + ["http://picasaweb.google.com/data/feed/api/all?alt=json-in-script&q=$TAG&callback=?", "gdata"], ], init: function(tag, element) { if (element && element.nodeName.toLowerCase() == "table") { @@ -158,7 +162,7 @@ ls = { } } }, - addItem: function(td, time, src, link) { + addItem: function(td, time, src, link, thumbnail) { // time should be in ISO 2008-12-11T02:30:43-08:00 format var tr = document.createElement("tr"); $(tr).click(function(){ location.href = link; }); @@ -168,6 +172,19 @@ ls = { timetd.className = "time"; tr.appendChild(timetd); td.className = "data"; + if(thumbnail) { + td.img = document.createElement('img'); + td.img.src = thumbnail ; + + $(td).hover(function(){ + this.img.style.position = "absolute"; + this.img.style.top = (this.offsetTop + this.offsetHeight) + "px"; + this.img.style.left = this.offsetLeft + "px"; + document.body.appendChild(this.img); + }, function(){ + document.body.removeChild(this.img); + }); + } tr.appendChild(td); var srctd = document.createElement("td"); srctd.appendChild(document.createTextNode(src)); @@ -184,6 +201,7 @@ ls = { }); if (!found) ls.element.appendChild(tr); }, + twittersearch: function(data) { $.each(data.results, function() { var td = document.createElement("td"); @@ -205,18 +223,44 @@ ls = { $.each(data.items, function() { var td = document.createElement("td"); td.appendChild(document.createTextNode(this.author + " - " + this.title)); - td.img = document.createElement("img"); - td.img.src = this.media.m; - $(td).hover(function(){ - this.img.style.position = "absolute"; - this.img.style.top = (this.offsetTop + this.offsetHeight) + "px"; - this.img.style.left = this.offsetLeft + "px"; - document.body.appendChild(this.img); - }, function(){ - document.body.removeChild(this.img); + + ls.addItem(td, this.date_taken, "flickr", this.link, this.media.m); + }); + }, + gdata: function(data) { + $.each(data.feed.entry, function() { + var td = document.createElement('td'); + + title = this['author'][0]['name']['$t'] + ': ' + + this['media$group']['media$title']['$t']; + td.appendChild(document.createTextNode(title)); + + var links = $.grep(this['link'], function(e) { + return (e['type'] == 'text/html' && e['rel'] == 'alternate'); }); - var time = this.date_taken; - ls.addItem(td, time, "flickr", this.link); + var link = links[0]['href']; + + var nr_thumbnails = this['media$group']['media$thumbnail'].length; + var thumbnail = this['media$group']['media$thumbnail'][nr_thumbnails-1]['url']; + + var time = this['published']['$t']; + + var kind = $.grep(this['category'], function(e) { + return e['scheme'] == 'http://schemas.google.com/g/2005#kind'; + }); + var data_source; + switch(kind[0]['term']) { + case 'http://gdata.youtube.com/schemas/2007#video': + data_source = 'youtube'; + break; + case 'http://schemas.google.com/photos/2007#photo': + data_source = 'picasa'; + break; + default: + data_source = 'unknown'; + } + + ls.addItem(td, time, data_source, link, thumbnail); }); }, }; @@ -224,7 +268,7 @@ ls = { /////////////////////////////////////////////////////// // Change this tag here to get a lifestream for the tag // vvvvvvvvv -$(document).ready(function(){ls.init("UDSJaunty", $("#t")[0])}); +$(document).ready(function(){ls.init("UDS Jaunty", $("#t")[0])}); </script> </head> <body>
« Back to merge proposal
Here's the diff for this branch:
=== modified file 'lifestream.html' ajax.googleapis .com/ajax/ libs/jquery/ 1.2.6/jquery. min.js"></script> format = function (mask,
--- lifestream.html 2008-12-12 00:16:45 +0000
+++ lifestream.html 2008-12-27 19:16:42 +0000
@@ -14,12 +14,16 @@ td.time, td.source {
color: #aaa;
background: white;
}
-tr.flickr td.data { color: white; background: #0c0; }
-tr.twitter td.data { color: white; background: #933; }
-tr.identica td.data { color: white; background: #339; }
-tr.flickr:hover td { color: white; background: #0d0; }
-tr.twitter:hover td { color: white; background: #a33; }
+tr.flickr td.data { color: white; background: #0c0; }
+tr.twitter td.data { color: white; background: #933; }
+tr.identica td.data { color: white; background: #339; }
+tr.picasa td.data { color: white; background: #8c8; }
+tr.youtube td.data { color: white; background: #c00; }
+tr.flickr:hover td { color: white; background: #0d0; }
+tr.twitter:hover td { color: white; background: #a33; }
tr.identica:hover td { color: white; background: #33a; }
+tr.picasa:hover td { color: white; background: #8d8; }
+tr.youtube:hover td { color: white; background: #d00; }
</style>
<script src="http://
<script>
@@ -136,13 +140,13 @@ Date.prototype.
return dateFormat(this, mask, utc);
};
- search. twitter. com/search. json?callback= ?&q=%23$ TAG", "twittersearch"], api.flickr. com/services/ feeds/photos_ public. gne?tags= $TAG&lang= en-us&format= json&jsoncallba ck=?", "flickr"], pipes.yahoo. com/pipes/ pipe.run? _id=qGysIErH3RG VW2OJBRNMsA& _render= json&tag= $TAG&_callback=?", "identicasearch"] pipes.yahoo. com/pipes/ pipe.run? _id=qGysIErH3RG VW2OJBRNMsA& _render= json&tag= $TAG&_callback=?", "identicasearch"], gdata.youtube. com/feeds/ videos? alt=json- in-script& vq=$TAG& callback=?", "gdata"], picasaweb. google. com/data/ feed/api/ all?alt= json-in- script& q=$TAG& callback=?", "gdata"], nodeName. toLowerCase( ) == "table") { 11T02:30: 43-08:00 format createElement( "tr"); tr).click( function( ){ location.href = link; }); className = "time"; appendChild( timetd) ; createElement( 'img'); function( ){ style.position = "absolute"; body.appendChil d(this. img); body.removeChil d(this. img); appendChild( td); createElement( "td"); appendChild( document. createTextNode( src)); appendChild( tr); each(data. results, function() { createElement( "td"); each(data. items, function() { createElement( "td");
td.appendChild( document. createTextNode( this.author + " - " + this.title)); createElement( "img"); function( ){ style.position = "absolute"; body.appendChil d(this. img); body.removeChil d(this. img); data.feed. entry, function() { createElement( 'td'); ][0]['name' ]['$t'] + ': ' + group'] ['media$ title'] ['$t']; document. createTextNode( title)) ; this['link' ], function(e) { group'] ['media$ thumbnail' ].length; group'] ['media$ thumbnail' ][nr_thumbnails -1]['url' ]; ']['$t' ]; this['category' ], function(e) { schemas. google. com/g/2005# kind'; kind[0] ['term' ]) { gdata.youtube. com/schemas/ 2007#video': schemas. google. com/photos/ 2007#photo': /////// /////// /////// /////// /////// /////// /////// .ready( function( ){ls.init( "UDSJaunty" , $("#t")[0])}); .ready( function( ){ls.init( "UDS Jaunty", $("#t")[0])});
-
ls = {
tag_api: [
["http://
["http://
- ["http://
+ ["http://
+ ["http://
+ ["http://
],
init: function(tag, element) {
if (element && element.
@@ -158,7 +162,7 @@ ls = {
}
}
},
- addItem: function(td, time, src, link) {
+ addItem: function(td, time, src, link, thumbnail) {
// time should be in ISO 2008-12-
var tr = document.
$(
@@ -168,6 +172,19 @@ ls = {
timetd.
tr.
td.className = "data";
+ if(thumbnail) {
+ td.img = document.
+ td.img.src = thumbnail ;
+
+ $(td).hover(
+ this.img.
+ this.img.style.top = (this.offsetTop + this.offsetHeight) + "px";
+ this.img.style.left = this.offsetLeft + "px";
+ document.
+ }, function(){
+ document.
+ });
+ }
tr.
var srctd = document.
srctd.
@@ -184,6 +201,7 @@ ls = {
});
if (!found) ls.element.
},
+
twittersearch: function(data) {
$.
var td = document.
@@ -205,18 +223,44 @@ ls = {
$.
var td = document.
- td.img = document.
- td.img.src = this.media.m;
- $(td).hover(
- this.img.
- this.img.style.top = (this.offsetTop + this.offsetHeight) + "px";
- this.img.style.left = this.offsetLeft + "px";
- document.
- }, function(){
- document.
+
+ ls.addItem(td, this.date_taken, "flickr", this.link, this.media.m);
+ });
+ },
+ gdata: function(data) {
+ $.each(
+ var td = document.
+
+ title = this['author'
+ this['media$
+ td.appendChild(
+
+ var links = $.grep(
+ return (e['type'] == 'text/html' && e['rel'] == 'alternate');
});
- var time = this.date_taken;
- ls.addItem(td, time, "flickr", this.link);
+ var link = links[0]['href'];
+
+ var nr_thumbnails = this['media$
+ var thumbnail = this['media$
+
+ var time = this['published
+
+ var kind = $.grep(
+ return e['scheme'] == 'http://
+ });
+ var data_source;
+ switch(
+ case 'http://
+ data_source = 'youtube';
+ break;
+ case 'http://
+ data_source = 'picasa';
+ break;
+ default:
+ data_source = 'unknown';
+ }
+
+ ls.addItem(td, time, data_source, link, thumbnail);
});
},
};
@@ -224,7 +268,7 @@ ls = {
//////
// Change this tag here to get a lifestream for the tag
// vvvvvvvvv
-$(document)
+$(document)
</script>
</head>
<body>