Note

Google Buzz has long gone, the code in this page will not be working.

I got this idea to make an unrelated (as in consanguinity) cousin of “I’m Feeling Lucky”. The I’m Feeling Buzzy let you feel lucky on Google Buzz1. However, I don’t use Google Buzz, even I was planning to use Buzz and its API to create a something like http://mydomain/random. But I am not sure if I want a link like that. It’s still worth sharing because it’s simple.

There are three way to feel buzzy, first one is to read one’s buzz activities, you will be redirected to one of recent updated items of his or hers or its. The second is to get one random site in one’s Google profile. The last one is to search on Google Buzz, you will be redirected to the first result, just as you search on Google.

Here is these three functions:

<script>
function imfeelingbuzzy_userid(userid) {
  var URL = 'https://www.googleapis.com/buzz/v1/activities/' + userid + '/@public?alt=json&callback=?';
  $.getJSON(URL, function(data) {
    var data = data.data;
    var link = data.items[Math.floor(data.items.length * Math.random())].links.alternate[0].href;
    window.open(link);
    });
  }
function imfeelingbuzzy_profile(userid) {
  var URL = 'https://www.googleapis.com/buzz/v1/people/' + userid + '/@self?alt=json&callback=?';
  $.getJSON(URL, function(data) {
    var data = data.data;
    var link = data.urls[Math.floor(data.urls.length * Math.random())].value;
    window.open(link);
    });
  }
function imfeelingbuzzy_search(q) {
  var URL = 'https://www.googleapis.com/buzz/v1/activities/search?q=' + encodeURIComponent(q) + '&alt=json&max-results=1&callback=?';
  $.getJSON(URL, function(data) {
    var data = data.data;
    var link = data.items[0].links.alternate[0].href;
    window.open(link);
    });
  }
</script>

You can just change the URL with your own User ID, so you can let people feel lucky to read you buzz. Like this code:

<input type="button" value="I'm Feeling Buzzy" onclick="imfeelingbuzzy_userid('googlebuzz')"/>

It will give you a button like the two above and this button will take everyone to one item of your recent 20 updated items. Or this code for sites of a profile:

<input type="button" value="I'm Feeling Buzzy" onclick="imfeelingbuzzy_profile('googlebuzz')"/>

Feeling Buzzy?


[1]http://www.google.com/buzz is gone.