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

Side by Side Diff: chrome/common/extensions/docs/examples/api/topsites/magic8ball/newTab.js

Issue 9721013: Move topSites API out of experimental (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Merge Created 8 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 function $(id) { 5 function $(id) {
6 return document.getElementById(id); 6 return document.getElementById(id);
7 } 7 }
8 8
9 function thumbnailsGotten(data) { 9 function thumbnailsGotten(data) {
10 var eightBallWindow = $('mostVisitedThumb'); 10 var eightBallWindow = $('mostVisitedThumb');
11 var rand = Math.floor(Math.random() * data.length); 11 var rand = Math.floor(Math.random() * data.length);
12 eightBallWindow.style.backgroundImage =
13 'url(chrome://thumb/' + data[rand].url + ')';
14 eightBallWindow.href = data[rand].url; 12 eightBallWindow.href = data[rand].url;
15 13 eightBallWindow.textContent = data[rand].title;
16 var span = eightBallWindow.querySelector('span'); 14 eightBallWindow.style.backgroundImage = 'url(chrome://favicon/' +
17 span.textContent = data[rand].title; 15 data[rand].url + ')';
18 span.style.backgroundImage = 'url(chrome://favicon/' + data[rand].url + ')';
19 } 16 }
20 17
21 window.onload = function() { 18 window.onload = function() {
22 chrome.experimental.topSites.get(thumbnailsGotten); 19 chrome.topSites.get(thumbnailsGotten);
23 } 20 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698