OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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('help', function() { | 5 cr.define('help', function() { |
6 var Page = cr.ui.pageManager.Page; | 6 var Page = cr.ui.pageManager.Page; |
7 var PageManager = cr.ui.pageManager.PageManager; | 7 var PageManager = cr.ui.pageManager.PageManager; |
8 | 8 |
9 /** | 9 /** |
10 * Encapsulated handling of the About page. Called 'help' internally to avoid | 10 * Encapsulated handling of the About page. Called 'help' internally to avoid |
11 * confusion with generic AboutUI (about:memory, about:sandbox, etc.). | 11 * confusion with generic AboutUI (about:memory, about:sandbox, etc.). |
12 */ | 12 */ |
13 function HelpPage() { | 13 function HelpPage() { |
14 Page.call(this, 'help', loadTimeData.getString('aboutTitle'), | 14 var title; |
15 'help-page'); | 15 if (loadTimeData.valueExists('aboutOverlayTabTitle')) |
16 title = loadTimeData.getString('aboutOverlayTabTitle'); | |
17 else | |
18 title = loadTimeData.getString('aboutTitle'); | |
Dan Beam
2014/08/13 02:50:46
nit:
var id = loadTimeData.valueExists('aboutOv
michaelpg
2014/08/13 08:12:11
Done.
| |
19 Page.call(this, 'help', title, 'help-page'); | |
16 } | 20 } |
17 | 21 |
18 cr.addSingletonGetter(HelpPage); | 22 cr.addSingletonGetter(HelpPage); |
19 | 23 |
20 HelpPage.prototype = { | 24 HelpPage.prototype = { |
21 __proto__: Page.prototype, | 25 __proto__: Page.prototype, |
22 | 26 |
23 /** | 27 /** |
24 * True if after update powerwash button should be displayed. | 28 * True if after update powerwash button should be displayed. |
25 * @private | 29 * @private |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
107 | 111 |
108 if (cr.isChromeOS) { | 112 if (cr.isChromeOS) { |
109 // Add event listener for the close button when shown as an overlay. | 113 // Add event listener for the close button when shown as an overlay. |
110 if ($('about-done')) { | 114 if ($('about-done')) { |
111 $('about-done').addEventListener('click', function() { | 115 $('about-done').addEventListener('click', function() { |
112 PageManager.closeOverlay(); | 116 PageManager.closeOverlay(); |
113 }); | 117 }); |
114 } | 118 } |
115 | 119 |
116 $('change-channel').onclick = function() { | 120 $('change-channel').onclick = function() { |
117 PageManager.showPageByName('channel-change-page', false); | 121 PageManager.showPageByName('channel-change-page'); |
Dan Beam
2014/08/13 02:50:46
i'd do this separately
Dan Beam
2014/08/13 17:03:18
ping
michaelpg
2014/08/13 20:17:50
Done.
| |
118 }; | 122 }; |
119 | 123 |
120 var channelChangeDisallowedError = document.createElement('div'); | 124 var channelChangeDisallowedError = document.createElement('div'); |
121 channelChangeDisallowedError.className = 'channel-change-error-bubble'; | 125 channelChangeDisallowedError.className = 'channel-change-error-bubble'; |
122 | 126 |
123 var channelChangeDisallowedIcon = document.createElement('div'); | 127 var channelChangeDisallowedIcon = document.createElement('div'); |
124 channelChangeDisallowedIcon.classList.add('help-page-icon-large'); | 128 channelChangeDisallowedIcon.classList.add('help-page-icon-large'); |
125 channelChangeDisallowedIcon.classList.add('channel-change-error-icon'); | 129 channelChangeDisallowedIcon.classList.add('channel-change-error-icon'); |
126 channelChangeDisallowedError.appendChild(channelChangeDisallowedIcon); | 130 channelChangeDisallowedError.appendChild(channelChangeDisallowedIcon); |
127 | 131 |
128 var channelChangeDisallowedText = document.createElement('div'); | 132 var channelChangeDisallowedText = document.createElement('div'); |
129 channelChangeDisallowedText.className = 'channel-change-error-text'; | 133 channelChangeDisallowedText.className = 'channel-change-error-text'; |
130 channelChangeDisallowedText.textContent = | 134 channelChangeDisallowedText.textContent = |
131 loadTimeData.getString('channelChangeDisallowedMessage'); | 135 loadTimeData.getString('channelChangeDisallowedMessage'); |
132 channelChangeDisallowedError.appendChild(channelChangeDisallowedText); | 136 channelChangeDisallowedError.appendChild(channelChangeDisallowedText); |
133 | 137 |
134 $('channel-change-disallowed-icon').onclick = function() { | 138 $('channel-change-disallowed-icon').onclick = function() { |
135 PageManager.showBubble(channelChangeDisallowedError, | 139 PageManager.showBubble(channelChangeDisallowedError, |
136 $('channel-change-disallowed-icon'), | 140 $('channel-change-disallowed-icon'), |
137 $('help-container'), | 141 $('help-container'), |
138 cr.ui.ArrowLocation.TOP_END); | 142 cr.ui.ArrowLocation.TOP_END); |
139 }; | 143 }; |
140 } | 144 } |
141 | 145 |
142 // Attempt to update. | 146 // Attempt to update. |
143 chrome.send('onPageLoaded'); | 147 chrome.send('onPageLoaded'); |
144 }, | 148 }, |
145 | 149 |
150 /** @override */ | |
151 didClosePage: function() { | |
152 if ($('more-info-container').classList.contains('visible')) | |
153 this.toggleMoreInfo_(); | |
154 }, | |
155 | |
146 /** | 156 /** |
147 * Toggles the visible state of the 'More Info' section. | 157 * Toggles the visible state of the 'More Info' section. |
148 * @private | 158 * @private |
149 */ | 159 */ |
150 toggleMoreInfo_: function() { | 160 toggleMoreInfo_: function() { |
151 var moreInfo = $('more-info-container'); | 161 var moreInfo = $('more-info-container'); |
152 var visible = moreInfo.className == 'visible'; | 162 var visible = moreInfo.className == 'visible'; |
153 moreInfo.className = visible ? '' : 'visible'; | 163 moreInfo.className = visible ? '' : 'visible'; |
154 moreInfo.style.height = visible ? '' : moreInfo.scrollHeight + 'px'; | 164 moreInfo.style.height = visible ? '' : moreInfo.scrollHeight + 'px'; |
155 moreInfo.addEventListener('webkitTransitionEnd', function(event) { | 165 moreInfo.addEventListener('webkitTransitionEnd', function(event) { |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
509 | 519 |
510 HelpPage.updateChannelChangePageContainerVisibility = function() { | 520 HelpPage.updateChannelChangePageContainerVisibility = function() { |
511 HelpPage.getInstance().updateChannelChangePageContainerVisibility_(); | 521 HelpPage.getInstance().updateChannelChangePageContainerVisibility_(); |
512 }; | 522 }; |
513 | 523 |
514 // Export | 524 // Export |
515 return { | 525 return { |
516 HelpPage: HelpPage | 526 HelpPage: HelpPage |
517 }; | 527 }; |
518 }); | 528 }); |
OLD | NEW |