[JS]Twitterのツイートをブログやサイトに簡単に設置できるスクリプト -jTweetsAnywhere
Post on:2010年10月19日
Twitterでつぶやいたツイートをあなたのブログやサイトに簡単に設置できるjQueryのプラグインを紹介します。

[ad#ad-2]
jTweetsAnywhereの設置は簡単で、数行のスクリプトで自分のブログやサイトにツイートを設置することができます。
jTweetsAnywhereの主な特長
- 指定したユーザー(複数可)のツイートを表示。
- ユーザーのリストからツイートを表示。
- Twitterの検索の結果を表示(パラメータは全対応)。
- @Anywhereに対応。
- エンドレススクロールを使ったページングをサポート。
- 自動更新でリアルタイムにツイートを表示。
- ツイートボックスのカスタマイズが可能。
- Follow me ボタンの設置が可能。
- ネイティブのリツイートをサポート。
- ユーザーのプロフィールを表示。
- ツイート内のリンクを検出し、自動でリンク化。
- 独自のスタイルシートでレイアウトのカスタマイズが可能。
- 書式やHTMLを変更可能。
- スクリプトは軽量。
jTweetsAnywhereのデモと実装

Auto-refreshing Realtime Ticker and More Tweets
自動更新してリアルタイムにツイートを表示。
上記デモの実装は、下記のようになります。
HTML
1 2 |
<div id="jTweetsAnywhereSample"> </div> |
JavaScript
jquery.jsを外部ファイルとして使用します。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
$('#jTweetsAnywhereSample').jTweetsAnywhere({ searchParams: ['q=html5'], count: 10, showTweetFeed: { showTimestamp: { refreshInterval: 15 }, autorefresh: { mode: 'trigger-insert', interval: 30 }, paging: { mode: 'more' } }, onDataRequestHandler: function(stats, options) { if (stats.dataRequestCount < 11) { return true; } else { stopAutorefresh(options); alert("To avoid struggling with Twitter's rate limit, we stop loading data after 10 API calls."); } } }); |
以下サンプルコードは、各デモページに掲載されているので参考にしてください。

Loading More Tweets with Endless Scrolling
エンドレスのスクロールバーで表示。

Paging Back and Forth
表示件数を少なくして、PrevとNextで表示。

Some tweets from around Paris, France ...
ユーザーがどこらへんでツイートしているか表示。
[ad#ad-2]

Some recent tweets and a Follow Button
最近のツイートとフォロミーボタンを表示。

A customized Tweet Box
ツイートボックスをカスタマイズして表示。

Tweets from selected users
指定したユーザー(複数可)のツイートを表示。

Tweets from a user's list
指定したリストのツイートを表示。

Supplying your own Decorator
書式やレイアウトを変更して表示。

Extended Tweet Attributes (Hovercards, Tweet source)
ユーザーのプロフィールを表示。

Different sizes of the Connect Button
Twitterへの接続ボタンを表示。
sponsors