// Core of fnfnen.

function show_tweets(d, node_column)
{
  // d = [{newest-tweet}, ..., {oldest-tweet}]
  if (d.length == 0)
    return 0;

  var node_tweet_hub = $('<div></div>');
  var node_dummy_tweet = $('<div></div>');
  node_tweet_hub.append(node_dummy_tweet);

  for (var i in d) {
    var node_tweet = $('<div></div>');
    node_tweet.html(html_from_tweet(d[i]));
    node_tweet.data('json', d[i]);

    node_tweet_hub.prepend(node_tweet);
  }

  node_dummy_tweet.remove();

  node_column.append(node_tweet_hub);
  return d.length;
}

function html_from_tweet(tweet)
{
  // FIXME: More information
  return (''
          /* screen name */
          + '<span class="screen_name">'
          + tweet.user.screen_name
          + '</span>'
          /* text */
          + '<span class="text">'
          + tweet.text
          + '</span>'
         );
}




$(document).ready(function(){
  $('#column_home').empty();

  show_tweets(
    [{'text': 'you', 'user': {'screen_name': 'Mashiro'}},
     {'text': 'love', 'user': {'screen_name': 'Sasara'}},
     {'text': 'i', 'user': {'screen_name': 'Alter'}}],
    $('#column_home'));
});

// __END__
// vim: expandtab shiftwidth=2 softtabstop=2

@@ -13,16 +13,1519 @@
 nfnen.%0A%0A
+var TWITTER_UI_URI = 'http://twitter.com/';%0Avar TWITTER_API_URI = 'http://api.twitter.com/1/';%0Avar MAX_COUNT = 200;%0A%0Avar g_authentication_element = null;%0Avar g_seq = (new Date).getTime();%0Avar g_update_element = null;%0Avar g_user = null;%0Avar g_since_id = null;%0A%0A%0A%0A%0Afunction load_cross_domain_script(uri, node)%0A%7B%0A  if (node && node.parentNode)%0A    node.parentNode.removeChild(node);%0A%0A  node = document.createElement(%22script%22);%0A  node.src = uri;%0A  node.type = %22text/javascript%22;%0A  document.body.appendChild(node);%0A%0A  return node;%0A%7D%0A%0A%0A%0A%0Afunction authenticate()%0A%7B%0A  g_authentication_element = load_cross_domain_script(%0A    (TWITTER_API_URI%0A     + %22account/verify_credentials.json?callback=callback_authenticate&seq=%22%0A     + (g_seq++)),%0A    g_authentication_element);%0A  return;%0A%7D%0A%0Afunction callback_authenticate(d)%0A%7B%0A  if (d.error)%0A    return alert(d.error);%0A%0A  g_user = d;%0A%0A  update();%0A  return;%0A%7D%0A%0A%0A%0A%0Afunction update()%0A%7B%0A  if (!g_user)%0A    return authenticate();%0A%0A  g_update_element = load_cross_domain_script(%0A    (TWITTER_API_URI%0A     + 'statuses/home_timeline.json?seq='%0A     + (g_seq++)%0A     + '&count='%0A     + MAX_COUNT%0A     + '&callback=callback_update'%0A     + (g_since_id ? '&since_id=' + g_since_id : '')),%0A    g_update_element);%0A  return;%0A%7D%0A%0Afunction callback_update(d)%0A%7B%0A  if (d.error)%0A    return alert(d.error);%0A%0A  if (g_since_id) %7B%0A    for (var i = 0; i %3C d.length; i++) %7B%0A      if (d%5Bi%5D.id %3C= g_since_id)%0A        d.splice(i--, 1);%0A    %7D%0A  %7D%0A%0A  show_tweets(d, $(%22#column_home%22));%0A  return;%0A%7D%0A%0A%0A%0A%0A
 function
@@ -2427,213 +2427,15 @@
 %0A%0A  
-show_tweets(%0A    %5B%7B'text': 'you', 'user': %7B'screen_name': 'Mashiro'%7D%7D,%0A     %7B'text': 'love', 'user': %7B'screen_name': 'Sasara'%7D%7D,%0A     %7B'text': 'i', 'user': %7B'screen_name': 'Alter'%7D%7D%5D,%0A    $('#column_home')
+update(
 );%0A%7D

Add authenticate()/update()