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 // This file contains the navigation controls that are visible on the left side | 5 // This file contains the navigation controls that are visible on the left side |
6 // of the uber page. It exists separately from uber.js so that it may be loaded | 6 // of the uber page. It exists separately from uber.js so that it may be loaded |
7 // in an iframe. Iframes can be layered on top of each other, but not mixed in | 7 // in an iframe. Iframes can be layered on top of each other, but not mixed in |
8 // with page content, so all overlapping content on uber must be framed. | 8 // with page content, so all overlapping content on uber must be framed. |
9 | 9 |
10 <include src="../shared/js/util.js"></include> | 10 <include src="../shared/js/util.js"></include> |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 document.documentElement.addEventListener('mousewheel', onMouseWheel); | 28 document.documentElement.addEventListener('mousewheel', onMouseWheel); |
29 } | 29 } |
30 | 30 |
31 /** | 31 /** |
32 * Handles clicks on the navigation controls (switches the page and updates | 32 * Handles clicks on the navigation controls (switches the page and updates |
33 * the URL). | 33 * the URL). |
34 * @param {Event} e The click event. | 34 * @param {Event} e The click event. |
35 */ | 35 */ |
36 function onNavItemClicked(e) { | 36 function onNavItemClicked(e) { |
| 37 assert(!e.target.classList.contains('selected')); |
| 38 |
37 uber.invokeMethodOnParent('showPage', | 39 uber.invokeMethodOnParent('showPage', |
38 {pageId: e.currentTarget.getAttribute('controls')}); | 40 {pageId: e.currentTarget.getAttribute('controls')}); |
39 | 41 |
40 setSelection(e.currentTarget); | 42 setSelection(e.currentTarget); |
41 } | 43 } |
42 | 44 |
43 /** | 45 /** |
44 * Handles postMessage from chrome://chrome. | 46 * Handles postMessage from chrome://chrome. |
45 * @param {Event} e The post data. | 47 * @param {Event} e The post data. |
46 */ | 48 */ |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 return document.querySelector('.iframe-container.selected'); | 119 return document.querySelector('.iframe-container.selected'); |
118 } | 120 } |
119 | 121 |
120 return { | 122 return { |
121 onLoad: onLoad, | 123 onLoad: onLoad, |
122 }; | 124 }; |
123 | 125 |
124 }); | 126 }); |
125 | 127 |
126 document.addEventListener('DOMContentLoaded', uber_frame.onLoad); | 128 document.addEventListener('DOMContentLoaded', uber_frame.onLoad); |
OLD | NEW |