Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4799)

Unified Diff: chrome/common/extensions/docs/examples/howto/contentscript_xhr/contentscript.js

Issue 8309001: Adding `content_security_policy` to a few sample extensions. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: License and whitespace. Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/examples/howto/contentscript_xhr/contentscript.js
diff --git a/chrome/common/extensions/docs/examples/howto/contentscript_xhr/contentscript.js b/chrome/common/extensions/docs/examples/howto/contentscript_xhr/contentscript.js
index 33235e08cfe2a50020a16876a1a8fc812a8d97e0..2b332466cc4c89784b2ec714f0bd9f93edbf0f1f 100644
--- a/chrome/common/extensions/docs/examples/howto/contentscript_xhr/contentscript.js
+++ b/chrome/common/extensions/docs/examples/howto/contentscript_xhr/contentscript.js
@@ -25,7 +25,7 @@ function fetchTwitterFeed(callback) {
}
// Note that any URL fetched here must be matched by a permission in
// the manifest.json file!
- var url = 'https://api.twitter.com/1/trends.json?exclude=hashtags';
+ var url = 'https://api.twitter.com/1/trends/daily.json?exclude=hashtags';
xhr.open('GET', url, true);
xhr.send();
};
@@ -44,13 +44,16 @@ function onText(data) {
var title_dom = document.createElement('strong');
title_dom.innerText = 'Topics currently trending on Twitter:';
trends_dom.appendChild(title_dom);
- for (var i=0,trend; trend = data.trends[i]; i++) {
- var link_dom = document.createElement('a');
- link_dom.setAttribute('href', trend.url)
- link_dom.innerText = trend.name;
- link_dom.style.color = '#000';
- trends_dom.appendChild(document.createTextNode(' '));
- trends_dom.appendChild(link_dom);
+ for (var key in data.trends) {
+ for (var i=0,trend; trend = data.trends[key][i]; i++) {
+ var link_dom = document.createElement('a');
+ link_dom.setAttribute('href', trend.url)
+ link_dom.innerText = trend.name;
+ link_dom.style.color = '#000';
+ trends_dom.appendChild(document.createTextNode(' '));
+ trends_dom.appendChild(link_dom);
+ }
+ break;
}
trends_dom.style.cssText = [
'background-color: #ffd700;',
« no previous file with comments | « chrome/common/extensions/docs/examples/howto/contentscript_xhr.zip ('k') | chrome/common/extensions/docs/samples.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698