OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** Provides client-side behavior for generated docs. */ | 5 /** Provides client-side behavior for generated docs. */ |
6 library client_live_nav; | 6 library client_live_nav; |
7 | 7 |
8 import 'dart:html'; | 8 import 'dart:html'; |
9 import 'dart:json'; | 9 import 'dart:json' as jsonlib; |
10 import '../../../../compiler/implementation/source_file.dart'; | 10 import '../../../../compiler/implementation/source_file.dart'; |
11 // TODO(rnystrom): Use "package:" URL (#4968). | 11 // TODO(rnystrom): Use "package:" URL (#4968). |
12 import '../../classify.dart'; | 12 import '../../classify.dart'; |
13 import '../../markdown.dart' as md; | 13 import '../../markdown.dart' as md; |
14 | 14 |
15 // TODO(rnystrom): Use "package:" URL (#4968). | 15 // TODO(rnystrom): Use "package:" URL (#4968). |
16 part 'dropdown.dart'; | 16 part 'dropdown.dart'; |
17 part 'search.dart'; | 17 part 'search.dart'; |
18 part '../dartdoc/nav.dart'; | 18 part '../dartdoc/nav.dart'; |
19 part 'client-shared.dart'; | 19 part 'client-shared.dart'; |
20 | 20 |
21 main() { | 21 main() { |
22 setup(); | 22 setup(); |
23 | 23 |
24 // Request the navigation data so we can build the HTML for it. | 24 // Request the navigation data so we can build the HTML for it. |
25 new HttpRequest.get('${prefix}nav.json', (request) { | 25 new HttpRequest.get('${prefix}nav.json', (request) { |
26 var json = JSON.parse(request.responseText); | 26 var json = jsonlib.parse(request.responseText); |
27 buildNavigation(json); | 27 buildNavigation(json); |
28 setupSearch(json); | 28 setupSearch(json); |
29 }); | 29 }); |
30 } | 30 } |
31 | 31 |
32 | 32 |
33 /** | 33 /** |
34 * Takes [libraries], a JSON array representing a set of libraries and builds | 34 * Takes [libraries], a JSON array representing a set of libraries and builds |
35 * the appropriate navigation DOM for it relative to the current library and | 35 * the appropriate navigation DOM for it relative to the current library and |
36 * type. | 36 * type. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 } | 91 } |
92 html.add('</li>'); | 92 html.add('</li>'); |
93 } | 93 } |
94 | 94 |
95 html.add('<ul class="icon">'); | 95 html.add('<ul class="icon">'); |
96 types.forEach((typeInfo) => | 96 types.forEach((typeInfo) => |
97 writeType(kindToString(typeInfo[KIND]), typeInfo)); | 97 writeType(kindToString(typeInfo[KIND]), typeInfo)); |
98 exceptions.forEach((typeInfo) => writeType('exception', typeInfo)); | 98 exceptions.forEach((typeInfo) => writeType('exception', typeInfo)); |
99 html.add('</ul>'); | 99 html.add('</ul>'); |
100 } | 100 } |
OLD | NEW |