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

実行結果

loading...

設置サンプルのソース

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <title>Twitter @Anywhere:Tweet Box | 設置サンプル</title>
      <link rel="stylesheet" type="text/css" href="/content/lib/global.css" />
       <script type="text/javascript" charset="utf-8" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></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="loading" style="height:100px;line-height:100px;font-weight:bold;">loading...</div>
      <div id="tbox"></div>
      <script src="http://platform.twitter.com/anywhere.js?id=Vr1OpiUZD7KOxQlpSvYdEA&amp;v=1"></script>
      <script type="text/javascript">
         /*
            bit.lyのURL短縮(PHP)
            参照:http://blog.themeforest.net/tutorials/creating-an-ajax-web-app-using-the-bitly-api/
         */
         $(function(){
            $.ajax({
               url:"/module/include/topic/twitter_anywhere/bitly.php",
               success:function(data) {
                  /* 現在のURLの短縮URLをbitlyで取得 */
                  /* Tweet Box埋め込み */
                  twttr.anywhere(function(T){
                     $("#loading").hide();
                     T("#tbox").tweetBox({
                        label:"コメントしてね!",
                        defaultContent:"@cocoism: ("+data+") "
                     });
                  });
               },
               error:function(x,y){
               },
               data:{
                  long_url:location.href
               },
               type:"POST"
            });
         });
      </script>
   </body>
</html>