Chromium Code Reviews| Index: chrome/browser/resources/help/help_page.js |
| diff --git a/chrome/browser/resources/help/help_page.js b/chrome/browser/resources/help/help_page.js |
| index 10a1807a93a813abd2386e450a635a8c2ad52c0b..614e8054d4d4a8ed4949d5fa86c378e935e25b9f 100644 |
| --- a/chrome/browser/resources/help/help_page.js |
| +++ b/chrome/browser/resources/help/help_page.js |
| @@ -11,8 +11,9 @@ cr.define('help', function() { |
| * confusion with generic AboutUI (about:memory, about:sandbox, etc.). |
| */ |
| function HelpPage() { |
| - Page.call(this, 'help', loadTimeData.getString('aboutTitle'), |
| - 'help-page'); |
| + var id = loadTimeData.valueExists('aboutOverlayTabTitle') ? |
| + 'aboutOverlayTabTitle' : 'aboutTitle'; |
| + Page.call(this, 'help', loadTimeData.getString(id), 'help-page'); |
| } |
| cr.addSingletonGetter(HelpPage); |
| @@ -143,23 +144,46 @@ cr.define('help', function() { |
| chrome.send('onPageLoaded'); |
| }, |
| + /** @override */ |
| + didClosePage: function() { |
| + this.setMoreInfoVisible_(false); |
| + }, |
| + |
| /** |
| - * Toggles the visible state of the 'More Info' section. |
| + * Sets the visible state of the 'More Info' section. |
| + * @param {boolean} visible Whether the section should be visible. |
| * @private |
| */ |
| - toggleMoreInfo_: function() { |
| + setMoreInfoVisible_: function(visible) { |
| var moreInfo = $('more-info-container'); |
| - var visible = moreInfo.className == 'visible'; |
| - moreInfo.className = visible ? '' : 'visible'; |
| - moreInfo.style.height = visible ? '' : moreInfo.scrollHeight + 'px'; |
| + if ((visible && moreInfo.classList.contains('visible')) || |
| + !visible && !moreInfo.classList.contains('visible')) { |
| + return; |
| + } |
|
Dan Beam
2014/08/13 22:26:18
if (visible == moreInfo.classList.contains('visibl
michaelpg
2014/08/14 11:43:55
Done.
|
| + |
| + if (visible) |
| + moreInfo.classList.add('visible'); |
| + else |
| + moreInfo.classList.remove('visible'); |
|
Dan Beam
2014/08/13 22:26:18
moreInfo.classList.toggle('visible', visible);
michaelpg
2014/08/14 11:43:55
Done.
|
| + moreInfo.style.height = visible ? moreInfo.scrollHeight + 'px' : ''; |
| moreInfo.addEventListener('webkitTransitionEnd', function(event) { |
| $('more-info-expander').textContent = visible ? |
| - loadTimeData.getString('showMoreInfo') : |
| - loadTimeData.getString('hideMoreInfo'); |
| + loadTimeData.getString('hideMoreInfo') : |
| + loadTimeData.getString('showMoreInfo'); |
| }); |
| }, |
| /** |
| + * Toggles the visible state of the 'More Info' section. |
| + * @private |
| + */ |
| + toggleMoreInfo_: function() { |
| + var moreInfo = $('more-info-container'); |
| + var visible = moreInfo.classList.contains('visible'); |
| + this.setMoreInfoVisible_(!visible); |
|
Dan Beam
2014/08/13 22:26:18
nit:
this.setMoreInfoVisible_(!moreInfo.clas
michaelpg
2014/08/14 11:43:55
Done.
|
| + }, |
| + |
| + /** |
| * Assigns |method| to the onclick property of |el| if |el| exists. |
| * @param {HTMLElement} el The element on which to set the click handler. |
| * @param {function} method The click handler. |