OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of app; | 5 part of app; |
6 | 6 |
7 abstract class LocationManager extends Observable { | 7 abstract class LocationManager extends Observable { |
8 final _initialPath = '/vm'; | 8 final _initialPath = '/vm'; |
9 ObservatoryApplication _app; | 9 ObservatoryApplication _app; |
10 | 10 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 void back() { | 69 void back() { |
70 window.history.go(-1); | 70 window.history.go(-1); |
71 } | 71 } |
72 | 72 |
73 /// Go forward. | 73 /// Go forward. |
74 void forward() { | 74 void forward() { |
75 window.history.go(1); | 75 window.history.go(1); |
76 } | 76 } |
77 | 77 |
78 /// Handle clicking on an application url link. | 78 /// Handle clicking on an application url link. |
79 void onGoto(MouseEvent event, var detail, Element target) { | 79 void onGoto(MouseEvent event) { |
| 80 var target = event.target; |
80 var href = target.attributes['href']; | 81 var href = target.attributes['href']; |
81 if (event.button > 0 || event.metaKey || event.ctrlKey || | 82 if (event.button > 0 || event.metaKey || event.ctrlKey || |
82 event.shiftKey || event.altKey) { | 83 event.shiftKey || event.altKey) { |
83 // Not a left-click or a left-click with a modifier key: | 84 // Not a left-click or a left-click with a modifier key: |
84 // Let browser handle. | 85 // Let browser handle. |
85 return; | 86 return; |
86 } | 87 } |
87 go(href); | 88 go(href); |
88 event.preventDefault(); | 89 event.preventDefault(); |
89 } | 90 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 _go(window.location.pathname); | 129 _go(window.location.pathname); |
129 } | 130 } |
130 | 131 |
131 void _onLocationChange(PopStateEvent _) { | 132 void _onLocationChange(PopStateEvent _) { |
132 _go(window.location.pathname); | 133 _go(window.location.pathname); |
133 } | 134 } |
134 | 135 |
135 /// Given an application url, generate a link for an anchor tag. | 136 /// Given an application url, generate a link for an anchor tag. |
136 String makeLink(String url) => url; | 137 String makeLink(String url) => url; |
137 } | 138 } |
OLD | NEW |