OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 /** | 5 /** |
6 * @fileoverview Nav dot | 6 * @fileoverview Nav dot |
7 * This is the class for the navigation controls that appear along the bottom | 7 * This is the class for the navigation controls that appear along the bottom |
8 * of the NTP. | 8 * of the NTP. |
9 */ | 9 */ |
10 | 10 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 * @type {String} title The display name for this nav dot. | 85 * @type {String} title The display name for this nav dot. |
86 */ | 86 */ |
87 get displayTitle() { | 87 get displayTitle() { |
88 return this.title; | 88 return this.title; |
89 }, | 89 }, |
90 set displayTitle(title) { | 90 set displayTitle(title) { |
91 this.title = this.input_.value = title; | 91 this.title = this.input_.value = title; |
92 }, | 92 }, |
93 | 93 |
94 /** | 94 /** |
95 * Removes the dot from the page after transitioning to 0 width. | 95 * Removes the dot from the page. If |opt_animate| is truthy, we first |
| 96 * transition the element to 0 width. |
| 97 * @param {boolean=} opt_animate Whether to animate the removal or not. |
96 */ | 98 */ |
97 animateRemove: function() { | 99 remove: function(opt_animate) { |
98 this.classList.add('small'); | 100 if (opt_animate) |
| 101 this.classList.add('small'); |
| 102 else |
| 103 this.parentNode.removeChild(this); |
99 }, | 104 }, |
100 | 105 |
101 /** | 106 /** |
102 * Navigates the card slider to the page for this dot. | 107 * Navigates the card slider to the page for this dot. |
103 */ | 108 */ |
104 switchToPage: function() { | 109 switchToPage: function() { |
105 ntp4.getCardSlider().selectCardByValue(this.page_, true); | 110 ntp4.getCardSlider().selectCardByValue(this.page_, true); |
106 }, | 111 }, |
107 | 112 |
108 /** | 113 /** |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 }, | 176 }, |
172 | 177 |
173 /** | 178 /** |
174 * When the input blurs, commit the edited changes. | 179 * When the input blurs, commit the edited changes. |
175 * @param {Event} e The blur event. | 180 * @param {Event} e The blur event. |
176 * @private | 181 * @private |
177 */ | 182 */ |
178 onInputBlur_: function(e) { | 183 onInputBlur_: function(e) { |
179 window.getSelection().removeAllRanges(); | 184 window.getSelection().removeAllRanges(); |
180 this.displayTitle = this.input_.value; | 185 this.displayTitle = this.input_.value; |
181 ntp4.saveAppPageName(this.page_, this.displayTitle); | 186 ntp4.saveAppsPageName(this.page_, this.displayTitle, false); |
182 this.input_.disabled = true; | 187 this.input_.disabled = true; |
183 }, | 188 }, |
184 | 189 |
185 shouldAcceptDrag: function(e) { | 190 shouldAcceptDrag: function(e) { |
186 return this.page_.shouldAcceptDrag(e); | 191 return this.page_.shouldAcceptDrag(e); |
187 }, | 192 }, |
188 | 193 |
189 /** | 194 /** |
190 * A drag has entered the navigation dot. If the user hovers long enough, | 195 * A drag has entered the navigation dot. If the user hovers long enough, |
191 * we will navigate to the relevant page. | 196 * we will navigate to the relevant page. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 onTransitionEnd_: function(e) { | 268 onTransitionEnd_: function(e) { |
264 if (e.propertyName === 'max-width' && this.classList.contains('small')) | 269 if (e.propertyName === 'max-width' && this.classList.contains('small')) |
265 this.parentNode.removeChild(this); | 270 this.parentNode.removeChild(this); |
266 }, | 271 }, |
267 }; | 272 }; |
268 | 273 |
269 return { | 274 return { |
270 NavDot: NavDot, | 275 NavDot: NavDot, |
271 }; | 276 }; |
272 }); | 277 }); |
OLD | NEW |