| 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'); |
| 10 #import('../../lib/compiler/implementation/source_file.dart'); | 10 #import('../../lib/compiler/implementation/source_file.dart'); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 main() { | 23 main() { |
| 24 // Figure out where we are. | 24 // Figure out where we are. |
| 25 final body = document.query('body'); | 25 final body = document.query('body'); |
| 26 currentLibrary = body.dataAttributes['library']; | 26 currentLibrary = body.dataAttributes['library']; |
| 27 currentType = body.dataAttributes['type']; | 27 currentType = body.dataAttributes['type']; |
| 28 prefix = (currentType != null) ? '../' : ''; | 28 prefix = (currentType != null) ? '../' : ''; |
| 29 | 29 |
| 30 enableCodeBlocks(); | 30 enableCodeBlocks(); |
| 31 | 31 |
| 32 // Request the navigation data so we can build the HTML for it. | 32 // Request the navigation data so we can build the HTML for it. |
| 33 new XMLHttpRequest.get('${prefix}nav.json', (request) { | 33 new HttpRequest.get('${prefix}nav.json', (request) { |
| 34 buildNavigation(JSON.parse(request.responseText)); | 34 buildNavigation(JSON.parse(request.responseText)); |
| 35 }); | 35 }); |
| 36 } | 36 } |
| 37 | 37 |
| 38 /** Turns [name] into something that's safe to use as a file name. */ | 38 /** Turns [name] into something that's safe to use as a file name. */ |
| 39 String sanitize(String name) => name.replaceAll(':', '_').replaceAll('/', '_'); | 39 String sanitize(String name) => name.replaceAll(':', '_').replaceAll('/', '_'); |
| 40 | 40 |
| 41 /** | 41 /** |
| 42 * Takes [libraries], a JSON object representing a set of libraries and builds | 42 * Takes [libraries], a JSON object representing a set of libraries and builds |
| 43 * the appropriate navigation DOM for it relative to the current library and | 43 * the appropriate navigation DOM for it relative to the current library and |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 '''); | 99 '''); |
| 100 } | 100 } |
| 101 html.add('</li>'); | 101 html.add('</li>'); |
| 102 } | 102 } |
| 103 | 103 |
| 104 html.add('<ul class="icon">'); | 104 html.add('<ul class="icon">'); |
| 105 types.forEach((type) => writeType(type['kind'], type)); | 105 types.forEach((type) => writeType(type['kind'], type)); |
| 106 exceptions.forEach((type) => writeType('exception', type)); | 106 exceptions.forEach((type) => writeType('exception', type)); |
| 107 html.add('</ul>'); | 107 html.add('</ul>'); |
| 108 } | 108 } |
| OLD | NEW |