OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 /** | 5 /** |
6 * @fileoverview App launcher start page implementation. | 6 * @fileoverview App launcher start page implementation. |
7 */ | 7 */ |
8 | 8 |
| 9 /** |
| 10 * The maximum height of the Google Doodle. Note this value should be consistent |
| 11 * with kWebViewHeight in start_page_view.cc. |
| 12 */ |
| 13 var doodleMaxHeight = 224; |
| 14 |
9 cr.define('appList.startPage', function() { | 15 cr.define('appList.startPage', function() { |
10 'use strict'; | 16 'use strict'; |
11 | 17 |
12 // The element containing the current Google Doodle. | 18 // The element containing the current Google Doodle. |
13 var doodle = null; | 19 var doodle = null; |
14 | 20 |
15 /** | 21 /** |
16 * Initialize the page. | 22 * Initialize the page. |
17 */ | 23 */ |
18 function initialize() { | 24 function initialize() { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // Set the page's base URL so that links will resolve relative to the Google | 71 // Set the page's base URL so that links will resolve relative to the Google |
66 // homepage. | 72 // homepage. |
67 $('base').href = base_url; | 73 $('base').href = base_url; |
68 | 74 |
69 this.doodle = document.createElement('div'); | 75 this.doodle = document.createElement('div'); |
70 this.doodle.id = 'doodle'; | 76 this.doodle.id = 'doodle'; |
71 this.doodle.style.display = 'none'; | 77 this.doodle.style.display = 'none'; |
72 | 78 |
73 var doodleImage = document.createElement('img'); | 79 var doodleImage = document.createElement('img'); |
74 doodleImage.id = 'doodle_image'; | 80 doodleImage.id = 'doodle_image'; |
| 81 if (doodleData.transparent_large_image.height > doodleMaxHeight) |
| 82 doodleImage.setAttribute('height', doodleMaxHeight); |
75 if (doodleData.alt_text) { | 83 if (doodleData.alt_text) { |
76 doodleImage.alt = doodleData.alt_text; | 84 doodleImage.alt = doodleData.alt_text; |
77 doodleImage.title = doodleData.alt_text; | 85 doodleImage.title = doodleData.alt_text; |
78 } | 86 } |
79 | 87 |
80 doodleImage.onload = function() { | 88 doodleImage.onload = function() { |
81 setDoodleVisible(true); | 89 setDoodleVisible(true); |
82 }; | 90 }; |
83 doodleImage.src = doodleData.transparent_large_image.url; | 91 doodleImage.src = doodleData.transparent_large_image.url; |
84 | 92 |
(...skipping 16 matching lines...) Expand all Loading... |
101 | 109 |
102 return { | 110 return { |
103 initialize: initialize, | 111 initialize: initialize, |
104 onAppListDoodleUpdated: onAppListDoodleUpdated, | 112 onAppListDoodleUpdated: onAppListDoodleUpdated, |
105 onAppListShown: onAppListShown, | 113 onAppListShown: onAppListShown, |
106 }; | 114 }; |
107 }); | 115 }); |
108 | 116 |
109 document.addEventListener('contextmenu', function(e) { e.preventDefault(); }); | 117 document.addEventListener('contextmenu', function(e) { e.preventDefault(); }); |
110 document.addEventListener('DOMContentLoaded', appList.startPage.initialize); | 118 document.addEventListener('DOMContentLoaded', appList.startPage.initialize); |
OLD | NEW |