| 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.exportPath('options'); | 5 cr.exportPath('options'); |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * @typedef {{actionLinkText: (string|undefined), | 8 * @typedef {{actionLinkText: (string|undefined), |
| 9 * accountInfo: (string|undefined), | 9 * accountInfo: (string|undefined), |
| 10 * childUser: (boolean|undefined), | 10 * childUser: (boolean|undefined), |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 'button, input, list, select, a[href]'); | 187 'button, input, list, select, a[href]'); |
| 188 if (focusElement) | 188 if (focusElement) |
| 189 focusElement.focus(); | 189 focusElement.focus(); |
| 190 } | 190 } |
| 191 }; | 191 }; |
| 192 } else { | 192 } else { |
| 193 $('advanced-settings-footer').hidden = true; | 193 $('advanced-settings-footer').hidden = true; |
| 194 $('advanced-settings').hidden = true; | 194 $('advanced-settings').hidden = true; |
| 195 } | 195 } |
| 196 | 196 |
| 197 $('advanced-settings').addEventListener('webkitTransitionEnd', | 197 $('advanced-settings').addEventListener('transitionend', |
| 198 this.updateAdvancedSettingsExpander_.bind(this)); | 198 this.updateAdvancedSettingsExpander_.bind(this)); |
| 199 | 199 |
| 200 if (loadTimeData.valueExists('aboutOverlayTabTitle')) { | 200 if (loadTimeData.valueExists('aboutOverlayTabTitle')) { |
| 201 $('about-button').hidden = false; | 201 $('about-button').hidden = false; |
| 202 $('about-button').addEventListener('click', function() { | 202 $('about-button').addEventListener('click', function() { |
| 203 PageManager.showPageByName('help'); | 203 PageManager.showPageByName('help'); |
| 204 chrome.send('coreOptionsUserMetricsAction', | 204 chrome.send('coreOptionsUserMetricsAction', |
| 205 ['Options_About']); | 205 ['Options_About']); |
| 206 }); | 206 }); |
| 207 } | 207 } |
| (...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 * @param {HTMLElement} section The section to animate. | 929 * @param {HTMLElement} section The section to animate. |
| 930 * @param {HTMLElement} container The container of |section|. | 930 * @param {HTMLElement} container The container of |section|. |
| 931 * @param {boolean} showing Whether to go from 0 -> container height or | 931 * @param {boolean} showing Whether to go from 0 -> container height or |
| 932 * container height -> 0. | 932 * container height -> 0. |
| 933 * @private | 933 * @private |
| 934 */ | 934 */ |
| 935 animatedSectionHeightChange_: function(section, container, showing) { | 935 animatedSectionHeightChange_: function(section, container, showing) { |
| 936 // If the section is already animating, dispatch a synthetic transition | 936 // If the section is already animating, dispatch a synthetic transition |
| 937 // end event as the upcoming code will cancel the current one. | 937 // end event as the upcoming code will cancel the current one. |
| 938 if (section.classList.contains('sliding')) | 938 if (section.classList.contains('sliding')) |
| 939 cr.dispatchSimpleEvent(section, 'webkitTransitionEnd'); | 939 cr.dispatchSimpleEvent(section, 'transitionend'); |
| 940 | 940 |
| 941 this.addTransitionEndListener_(section); | 941 this.addTransitionEndListener_(section); |
| 942 | 942 |
| 943 section.hidden = false; | 943 section.hidden = false; |
| 944 section.style.height = (showing ? 0 : container.offsetHeight) + 'px'; | 944 section.style.height = (showing ? 0 : container.offsetHeight) + 'px'; |
| 945 section.classList.add('sliding'); | 945 section.classList.add('sliding'); |
| 946 | 946 |
| 947 // Force a style recalc before starting the animation. | 947 // Force a style recalc before starting the animation. |
| 948 /** @suppress {suspiciousCode} */ | 948 /** @suppress {suspiciousCode} */ |
| 949 section.offsetHeight; | 949 section.offsetHeight; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1053 // initializationComplete event (for example 'set-as-default-browser' | 1053 // initializationComplete event (for example 'set-as-default-browser' |
| 1054 // button) leaving some uncertainty in the optimal scroll position. | 1054 // button) leaving some uncertainty in the optimal scroll position. |
| 1055 // The section is placed approximately in the middle of the screen. | 1055 // The section is placed approximately in the middle of the screen. |
| 1056 var top = Math.min(0, document.body.scrollHeight / 2 - sectionBottom); | 1056 var top = Math.min(0, document.body.scrollHeight / 2 - sectionBottom); |
| 1057 pageContainer.style.top = top + 'px'; | 1057 pageContainer.style.top = top + 'px'; |
| 1058 pageContainer.oldScrollTop = -top; | 1058 pageContainer.oldScrollTop = -top; |
| 1059 } | 1059 } |
| 1060 }, | 1060 }, |
| 1061 | 1061 |
| 1062 /** | 1062 /** |
| 1063 * Adds a |webkitTransitionEnd| listener to the given section so that | 1063 * Adds a |transitionend| listener to the given section so that |
| 1064 * it can be animated. The listener will only be added to a given section | 1064 * it can be animated. The listener will only be added to a given section |
| 1065 * once, so this can be called as multiple times. | 1065 * once, so this can be called as multiple times. |
| 1066 * @param {HTMLElement} section The section to be animated. | 1066 * @param {HTMLElement} section The section to be animated. |
| 1067 * @private | 1067 * @private |
| 1068 */ | 1068 */ |
| 1069 addTransitionEndListener_: function(section) { | 1069 addTransitionEndListener_: function(section) { |
| 1070 if (section.hasTransitionEndListener_) | 1070 if (section.hasTransitionEndListener_) |
| 1071 return; | 1071 return; |
| 1072 | 1072 |
| 1073 section.addEventListener('webkitTransitionEnd', | 1073 section.addEventListener('transitionend', |
| 1074 this.onTransitionEnd_.bind(this)); | 1074 this.onTransitionEnd_.bind(this)); |
| 1075 section.hasTransitionEndListener_ = true; | 1075 section.hasTransitionEndListener_ = true; |
| 1076 }, | 1076 }, |
| 1077 | 1077 |
| 1078 /** | 1078 /** |
| 1079 * Called after an animation transition has ended. | 1079 * Called after an animation transition has ended. |
| 1080 * @param {Event} event The webkitTransitionEnd event. NOTE: May be | 1080 * @param {Event} event The transitionend event. NOTE: May be |
| 1081 * synthetic. | 1081 * synthetic. |
| 1082 * @private | 1082 * @private |
| 1083 */ | 1083 */ |
| 1084 onTransitionEnd_: function(event) { | 1084 onTransitionEnd_: function(event) { |
| 1085 if (event.propertyName && event.propertyName != 'height') { | 1085 if (event.propertyName && event.propertyName != 'height') { |
| 1086 // If not a synthetic event or a real transition we care about, bail. | 1086 // If not a synthetic event or a real transition we care about, bail. |
| 1087 return; | 1087 return; |
| 1088 } | 1088 } |
| 1089 | 1089 |
| 1090 var section = event.target; | 1090 var section = event.target; |
| (...skipping 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2481 | 2481 |
| 2482 settings.hidden = !isVisible; | 2482 settings.hidden = !isVisible; |
| 2483 }; | 2483 }; |
| 2484 } | 2484 } |
| 2485 | 2485 |
| 2486 // Export | 2486 // Export |
| 2487 return { | 2487 return { |
| 2488 BrowserOptions: BrowserOptions | 2488 BrowserOptions: BrowserOptions |
| 2489 }; | 2489 }; |
| 2490 }); | 2490 }); |
| OLD | NEW |