[Twitter.jsライブラリ] つぶやきだけを表示する

説明

Twitter.jsライブラリでつぶやきだけを表示するにはgetTwitters()の2番目のオプションパラメータのtemplateに%textだけを指定します。ただし、リンク文字などはenableLinksオプションがtrueの場合、自動リンク処理が行われます。falseにすると自動リンクされず、普通の文字として表示されます。

サンプルプログラム

【HTML】
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="ja">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Sample</title>
<link rel="stylesheet" href="css/main.css" type="text/css" media="all">
<script type="text/javascript" src="js/twitter-1.12.2.js"></script>
<script type="text/javascript" src="js/sample.js"></script>
</head>
<body>
<h1>Googleのつぶやきを表示</h1>
<div id="tweet">
<p>読み込み中です...しばらくお待ち下さい</p>
</div>
</body>
</html>


【sample.js】
getTwitters('tweet', {
id: 'google',
count: 10,
enableLinks: true,
ignoreReplies: false,
clearContents: true,
template: '%text%'
});
サンプルを実行
[戻る]