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.getBoolean('showAbout')) { | 200 if (loadTimeData.getBoolean('showAbout')) { |
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 722 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 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2463 | 2463 |
2464 settings.hidden = !isVisible; | 2464 settings.hidden = !isVisible; |
2465 }; | 2465 }; |
2466 } | 2466 } |
2467 | 2467 |
2468 // Export | 2468 // Export |
2469 return { | 2469 return { |
2470 BrowserOptions: BrowserOptions | 2470 BrowserOptions: BrowserOptions |
2471 }; | 2471 }; |
2472 }); | 2472 }); |
OLD | NEW |