これは私のmanifest.jsonです:
{
"name": "Chritter",
"version": "1.0",
"description": "A Twitter button for your toolbar.",
"icons": {"128": "icon.png"},
"browser_action": {
"default_icon": "icon.png",
"default_title": "Chritter",
"popup": "popup.html"
},
"permissions": ["http://twitter.com/*", "tabs"]
}
This is my popup.html:
<html>
<head>
<script>
onload = setTimeout(init, 0); // workaround for http://crbug.com/24467
// initialize timeline template
function init() {
timeline = document.getElementById('timeline');
template = xpath('//ol[@id="template"]/li', document);
link = xpath('//div[@class="thumbnail"]/a', template);
image = xpath('img', link);
author = xpath('//div[@class="text"]/a', template);
content = xpath('//div[@class="text"]/span', template);
getTweets();
}
function getTweets() {
req = new XMLHttpRequest();
req.open('GET', 'http://twitter.com/statuses/public_timeline.json');
req.onload = processTweets;
req.send();
}
// process new batch of tweets
function processTweets() {
var res = JSON.parse(req.responseText);
tweets = res.concat(tweets);
update();
}
for (var i in tweets) {
user = tweets[i].user;
url = 'http://twitter.com/' + user.screen_name;
// thumbnail
link.title = user.name;
link.href = openInNewTab(url);
image.src = user.profile_image_url;
image.alt = user.name;
// text
author.href = openInNewTab(url);
author.innerHTML = user.name;
content.innerHTML = linkify(tweets[i].text);
// copy node and update
item = template.cloneNode(true);
timeline.appendChild(item);
}
</script>
</head>
<body>
<div id="body">
<div id="title">
<h2>Chritter</h2>
</div>
<ol id="timeline" />
</div>
<ol id="template">
<li>
<div class="thumbnail">
<a>
<img />
</a>
</div>
<div class="text">
<a></a>
<span></span>
</div>
<div class="clear"></div>
</li>
</ol>
</body>
</html>
拡張機能をクリックしてもデータが表示されません。私は何か間違ったことをしていますか?jsをpopup.htmlではなくpopup.jsに書き込む必要がありますか?