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