OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 cr.define('ntp', function() { | 5 cr.define('ntp', function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 var TilePage = ntp.TilePage; | 8 var TilePage = ntp.TilePage; |
9 | 9 |
10 /** | 10 /** |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 var title = this.querySelector('.title'); | 102 var title = this.querySelector('.title'); |
103 title.textContent = data.title; | 103 title.textContent = data.title; |
104 title.dir = data.direction; | 104 title.dir = data.direction; |
105 | 105 |
106 var score = this.querySelector('.score'); | 106 var score = this.querySelector('.score'); |
107 score.textContent = data.score; | 107 score.textContent = data.score; |
108 | 108 |
109 // Sets the tooltip. | 109 // Sets the tooltip. |
110 this.title = data.title; | 110 this.title = data.title; |
111 | 111 |
112 var thumbnailUrl = 'chrome://thumb/' + data.url; | 112 var thumbnailUrl; |
113 if (data.urlImage) { | |
Evan Stade
2012/07/26 04:26:02
use ternary operator
beaudoin
2012/07/26 17:08:37
Done.
| |
114 thumbnailUrl = data.urlImage; | |
115 } else { | |
116 thumbnailUrl = 'chrome://thumb/' + data.url; | |
117 } | |
113 this.querySelector('.thumbnail').style.backgroundImage = | 118 this.querySelector('.thumbnail').style.backgroundImage = |
114 url(thumbnailUrl); | 119 url(thumbnailUrl); |
115 | 120 |
116 this.href = data.url; | 121 this.href = data.url; |
117 | 122 |
118 this.classList.remove('filler'); | 123 this.classList.remove('filler'); |
119 }, | 124 }, |
120 | 125 |
121 /** | 126 /** |
122 * Sets the color of the favicon dominant color bar. | 127 * Sets the color of the favicon dominant color bar. |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
462 return oldData; | 467 return oldData; |
463 } | 468 } |
464 | 469 |
465 return { | 470 return { |
466 SuggestionsPage: SuggestionsPage, | 471 SuggestionsPage: SuggestionsPage, |
467 refreshData: refreshData, | 472 refreshData: refreshData, |
468 }; | 473 }; |
469 }); | 474 }); |
470 | 475 |
471 document.addEventListener('ntpLoaded', ntp.SuggestionsPage.onLoaded); | 476 document.addEventListener('ntpLoaded', ntp.SuggestionsPage.onLoaded); |
OLD | NEW |