OLD | NEW |
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 } |
OLD | NEW |