ܻؤ1顪30奵꡼ޥܥ

ITȤƯ30奵꡼ޥΥ饤ߥ󥰵Ͽ

ƥꡧ javascript

ʤ󤫤ΤȤʤΤǥԥѥ⡣
jQueryȤäjsonpǥǡ
Ȥꤢ饤֥ˤƻȤȤɤ߹फ󤸤ˡ

bitlyApi.js

BitlyClient = function() {
  this._initialize();
}
$.extend(BitlyClient.prototype, {
  _initialize: function(login, apikey, version) {
    this.login = login || "LOGIN";
    this.apikey = apikey || "APIKEY";
    this.version = version || "2.0.1";
  },
  shorten: function(longUrl, target) {
    var result;
    $.ajax({
      type: "GET",
      url: "http://api.bit.ly/shorten",
      data: {
        "login": this.login,
        "apiKey": this.apikey,
        "version": this.version,
        "longUrl": longUrl
      },
      dataType: "jsonp",
      success: function(data) {
        for (var r in data.results) {
          result = data.results[r];
          break;
        };
        target.text(result.shortUrl);
      }
    });
  },
  expand: function(shortUrl, target) {
    var result;
    $.ajax({
      type: "GET",
      url: "http://api.bit.ly/expand",
      data: {
        "login": this.login,
        "apiKey": this.apikey,
        "version": this.version,
        "shortUrl": shortUrl
      },
      dataType: "jsonp",
      success: function(data) {
        for (var r in data.results) {
          result = data.results[r];
          break;
        };
        target.text(result.longUrl);
      }
    });
  }
});
var Bitly = new BitlyClient();


URLȥåϤƽϤ饤֥ʤΤǻȤӤ˹碌ơ
ȤꤢURLϤƽϤ㡣

html

<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js" type="text/javascript"></script>
<script src="bitlyApi.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
  $('input[id^=bitly]').click(function() {
    eval("Bitly."+$(this).val()+"($('input#url').val(), $('div#bitly-result'))");
  });
});
</script>
</head>
<body>
<input type="text" id="url" /><input type="button" value="shorten" id="bitly-shorten" /><input type="button" value="expand" id="bitly-expand" />
<div id="bitly-result"></div>

    Υȥ꡼ϤƤʥ֥åޡɲ

TwitterAPI˸ɤꤲɽΥץ롣

ꥯȥѥ᡼ΰ㡣
ܺ٤Ϥ򻲾
q
callbackХåؿꤷȤ
langоݤθ
rpp븡̿
pageڡ


쥹ݥ󥹥ǡϤʤ󤸡
created_atȯ
from_user桼ID
profile_image_url桼Υץե
textȯ

³ƥȥץ롣
³ɤ
    Υȥ꡼ϤƤʥ֥åޡɲ

ɽȤˤդȻפäΤǥ⡣

ȤȤϤʴǻȤ
function number_format(num) {
  return num.toString().replace(/([0-9]+?)(?=(?:[0-9]{3})+$)/g , '$1,')
}

    Υȥ꡼ϤƤʥ֥åޡɲ

ΥڡΥȥåץ