PHP & JavaScript Room :: 設置サンプル

実行結果

Twitter API - jTwitter | 設置サンプル

"cocoism"のTwitter情報

プロフィール出力

設置サンプルのソース

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <meta http-equiv="Content-Language" content="ja" />
      <meta http-equiv="Content-Script-Type" content="text/javascript" />
      <meta http-equiv="Content-Style-Type" content="text/css" />
      <meta http-equiv="imagetoolbar" content="no" />
      <title>Twitter API - jTwitter | 設置サンプル</title>
      <link rel="stylesheet" type="text/css" href="/content/lib/global.css" />
      <!-- JS -->
      <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
      <script type="text/javascript" src="/content/lib/jquery/jquery.jtwitter.js"></script>
      <script type="text/javascript">
         $(function() {
            $.jTwitter('cocoism', function(info){
               var s="";
//               console.log(info);
               s+="<tr><th>screen_name:</th><td>"+info.created_at+"</td>";
               s+="<tr><th>name:</th><td>"+info.name+"</td>";
               s+="<tr><th>description:</th><td>"+info.description+"</td>";
               s+="<tr><th>url:</th><td>"+info.url+"</td>";
               s+="<tr><th>followers_count:</th><td>"+info.followers_count+"</td>";
               s+="<tr><th>friends_count:</th><td>"+info.friends_count+"</td>";
               s+="<tr><th>favourites_count:</th><td>"+info.favourites_count+"</td>";
               s+="<tr><th>statuses_count:</th><td>"+info.statuses_count+"</td>";
               s+="<tr><th>location:</th><td>"+info.location+"</td>";
               s+="<tr><th>id:</th><td>"+info.id+"</td>";
               s+="<tr><th>time_zone:</th><td>"+info.time_zone+"</td>";
               s+="<tr><th>profile_image_url:</th><td>"+info.profile_image_url+"</td>";
               s+="<tr><th>notifications:</th><td>"+info.notifications+"</td>";
               s+="<tr><th>utc_offset:</th><td>"+info.utc_offset+"</td>";
               s+="<tr><th>following:</th><td>"+info.following+"</td>";
               s+="<tr><th>created_at:</th><td>"+info.created_at+"</td>";
               s+="<tr><th>profile_link_color:</th><td>"+info.profile_link_color+"</td>";
               s+="<tr><th>profile_sidebar_fill_color:</th><td>"+info.profile_sidebar_fill_color+"</td>";
               s+="<tr><th>profile_background_tile:</th><td>"+info.profile_background_tile+"</td>";
               s+="<tr><th>profile_sidebar_border_color:</th><td>"+info.profile_sidebar_border_color+"</td>";
               s+="<tr><th>profile_background_color:</th><td>"+info.profile_background_color+"</td>";
               s+="<tr><th>profile_text_color:</th><td>"+info.profile_text_color+"</td>";
               s+="<tr><th>profile_background_image_url:</th><td>"+info.profile_background_image_url+"</td>";
               $("#result").html(s);
               $("#result th").css("text-align","right");

               //Callback functn with the user data as shown above
               $('#profile input.url').val(info.url).css("width","300px");
               $('#profile #avatar').html('<img src="'+ info.profile_image_url + '" />');
            });
         });
      </script>
   <link rel="stylesheet" type="text/css" href="/common/css/example.css"></head>
   <body id='example3' class='example'><div class="ads" style="margin:32px auto;text-align:center;"></div><h1 class='h'><a href='/'>PHP &amp; JavaScript Room</a> :: 設置サンプル</h1>
<h3 class='h'>実行結果</h3>
      <div id="wrap">
         <h1><a href='http://plugins.jquery.com/project/jtwitter'>Twitter API - jTwitter</a> | 設置サンプル</h1>
<!-- CODE -->
         <h2>"cocoism"のTwitter情報</h2>
         <table id="result"></table>
         <h2>プロフィール出力</h2>
         <div id="profile">
            <div id="avatar"></div>
            <input class="url" type="text" />
            <div id="created_at"></div>
         </div>
<!-- / CODE -->
      </div>
   </body>
</html>