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

Side by Side Diff: chrome/common/extensions/docs/examples/tutorials/debugging/hello_world.html

Issue 411008: Remove use of innerHTML and Toolstrips from example extensions (Closed)
Patch Set: cr changes Created 11 years, 1 month 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 unified diff | Download patch
OLDNEW
(Empty)
1 <style>
2 img {
3 margin:5px;
4 border:2px solid black;
5 vertical-align:middle;
6 width:75px;
7 height:75px;
8 }
9 </style>
10
11 <script>
12 var req = new XMLHttpRequest();
13 req.open(
14 "GET",
15 "http://api.flickr.com/services/rest/?" +
16 "method=flickr.photos.search&" +
17 "api_key=90485e931f687a9b9c2a66bf58a3861a&" +
18 "text=hello%20world&" +
19 "safe_search=1&" + // 1 is "safe"
20 "content_type=1&" + // 1 is "photos only"
21 "sort=relevance&" + // another good one is "interestingness-desc"
22 "per_page=95",
23 true);
24 req.onload = showPhotos;
25 req.send(null);
26
27 function showPhotos() {
28 var photos = req.responseXML.getElementsByTagName("photo");
29
30 for (var i = 0, photo; photo = photos[i]; i++) {
31 var img = document.createElement("image");
32 img.src = constructImageURL(photo);
33 document.body.appendChild(img);
34 }
35 }
36
37 // See: http://www.flickr.com/services/api/misc.urls.html
38 function constructImageURL(photo) {
39 return "http://farm" + photo.getAttribute("farm") +
40 ".static.flickr.com/" + photo.getAttribute("server") +
41 "/" + photo.getAttribute("id") +
42 "_" + photo.getAttribute("secret") +
43 "_s.jpg";
44 }
45 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698