| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 } else if (newRoute.page == 'basic') { | 56 } else if (newRoute.page == 'basic') { |
| 57 this.$.advancedMenu.selected = null; | 57 this.$.advancedMenu.selected = null; |
| 58 this.$.basicMenu.selected = this.currentRoute.section; | 58 this.$.basicMenu.selected = this.currentRoute.section; |
| 59 } else { | 59 } else { |
| 60 this.$.advancedMenu.selected = null; | 60 this.$.advancedMenu.selected = null; |
| 61 this.$.basicMenu.selected = null; | 61 this.$.basicMenu.selected = null; |
| 62 } | 62 } |
| 63 }, | 63 }, |
| 64 | 64 |
| 65 /** | 65 /** |
| 66 * @param {!Node} target |
| 67 * @private |
| 68 */ |
| 69 ripple_: function(target) { |
| 70 var ripple = document.createElement('paper-ripple'); |
| 71 ripple.addEventListener('transitionend', function() { |
| 72 ripple.remove(); |
| 73 }); |
| 74 target.appendChild(ripple); |
| 75 ripple.downAction(); |
| 76 ripple.upAction(); |
| 77 }, |
| 78 |
| 79 /** |
| 66 * @param {!Event} event | 80 * @param {!Event} event |
| 67 * @private | 81 * @private |
| 68 */ | 82 */ |
| 69 openPage_: function(event) { | 83 openPage_: function(event) { |
| 84 this.ripple_(/** @type {!Node} */(event.currentTarget)); |
| 70 var submenuRoute = event.currentTarget.parentNode.dataset.page; | 85 var submenuRoute = event.currentTarget.parentNode.dataset.page; |
| 71 if (submenuRoute) { | 86 if (submenuRoute) { |
| 72 this.currentRoute = { | 87 this.currentRoute = { |
| 73 page: submenuRoute, | 88 page: submenuRoute, |
| 74 section: event.currentTarget.dataset.section, | 89 section: event.currentTarget.dataset.section, |
| 75 subpage: [], | 90 subpage: [], |
| 76 }; | 91 }; |
| 77 } | 92 } |
| 78 }, | 93 }, |
| 79 | 94 |
| 80 /** | 95 /** |
| 81 * @param {boolean} opened Whether the menu is expanded. | 96 * @param {boolean} opened Whether the menu is expanded. |
| 82 * @return {string} Which icon to use. | 97 * @return {string} Which icon to use. |
| 83 * @private | 98 * @private |
| 84 * */ | 99 * */ |
| 85 arrowState_: function(opened) { | 100 arrowState_: function(opened) { |
| 86 return opened ? 'settings:arrow-drop-up' : 'cr:arrow-drop-down'; | 101 return opened ? 'settings:arrow-drop-up' : 'cr:arrow-drop-down'; |
| 87 }, | 102 }, |
| 88 }); | 103 }); |
| OLD | NEW |