| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 | 6 * @fileoverview |
| 7 * 'settings-menu' shows a menu with a hardcoded set of pages and subpages. | 7 * 'settings-menu' shows a menu with a hardcoded set of pages and subpages. |
| 8 */ | 8 */ |
| 9 Polymer({ | 9 Polymer({ |
| 10 is: 'settings-menu', | 10 is: 'settings-menu', |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 this.$.advancedPage.addEventListener('paper-submenu-close', function() { | 37 this.$.advancedPage.addEventListener('paper-submenu-close', function() { |
| 38 this.fire('toggle-advanced-page', false); | 38 this.fire('toggle-advanced-page', false); |
| 39 }.bind(this)); | 39 }.bind(this)); |
| 40 | 40 |
| 41 this.fire('toggle-advanced-page', | 41 this.fire('toggle-advanced-page', |
| 42 settings.Route.ADVANCED.contains(settings.getCurrentRoute())); | 42 settings.Route.ADVANCED.contains(settings.getCurrentRoute())); |
| 43 }, | 43 }, |
| 44 | 44 |
| 45 /** | 45 /** |
| 46 * @param {!Node} target | 46 * @param {!Event} event |
| 47 * @private | 47 * @private |
| 48 */ | 48 */ |
| 49 ripple_: function(target) { | 49 ripple_: function(event) { |
| 50 var ripple = document.createElement('paper-ripple'); | 50 var ripple = document.createElement('paper-ripple'); |
| 51 ripple.addEventListener('transitionend', function() { | 51 ripple.addEventListener('transitionend', function() { |
| 52 ripple.remove(); | 52 ripple.remove(); |
| 53 }); | 53 }); |
| 54 target.appendChild(ripple); | 54 event.currentTarget.appendChild(ripple); |
| 55 ripple.downAction(); | 55 ripple.downAction(); |
| 56 ripple.upAction(); | 56 ripple.upAction(); |
| 57 }, | 57 }, |
| 58 | 58 |
| 59 /** | 59 /** |
| 60 * @param {!Event} event | 60 * @param {!Event} event |
| 61 * @private | 61 * @private |
| 62 */ | 62 */ |
| 63 openPage_: function(event) { | 63 openPage_: function(event) { |
| 64 this.ripple_(/** @type {!Node} */(event.currentTarget)); | |
| 65 | |
| 66 var route = settings.getRouteForPath(event.currentTarget.dataset.path); | 64 var route = settings.getRouteForPath(event.currentTarget.dataset.path); |
| 67 assert(route, 'settings-menu has an an entry with an invalid path'); | 65 assert(route, 'settings-menu has an an entry with an invalid path'); |
| 68 settings.navigateTo(route); | 66 settings.navigateTo(route); |
| 69 }, | 67 }, |
| 70 | 68 |
| 71 /** | 69 /** |
| 72 * @param {boolean} opened Whether the menu is expanded. | 70 * @param {boolean} opened Whether the menu is expanded. |
| 73 * @return {string} Which icon to use. | 71 * @return {string} Which icon to use. |
| 74 * @private | 72 * @private |
| 75 * */ | 73 * */ |
| 76 arrowState_: function(opened) { | 74 arrowState_: function(opened) { |
| 77 return opened ? 'settings:arrow-drop-up' : 'cr:arrow-drop-down'; | 75 return opened ? 'settings:arrow-drop-up' : 'cr:arrow-drop-down'; |
| 78 }, | 76 }, |
| 79 }); | 77 }); |
| OLD | NEW |