Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: dart/lib/dartdoc/client-live-nav.dart

Issue 10174006: Use 'frog' in apidoc. Also fix broken dependencies. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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('../../frog/lang.dart', prefix: 'frog'); 10 #import('../../frog/lang.dart', prefix: 'frog');
11 #import('classify.dart'); 11 #import('classify.dart');
12 #import('markdown.dart', prefix: 'md'); 12 #import('markdown.dart', prefix: 'md');
13 13
14 #source('client-shared.dart'); 14 #source('client-shared.dart');
15 15
16 // The names of the library and type that this page documents. 16 // The names of the library and type that this page documents.
17 String currentLibrary = null; 17 String currentLibrary = null;
18 String currentType = null; 18 String currentType = null;
19 19
20 // What we need to prefix relative URLs with to get them to work. 20 // What we need to prefix relative URLs with to get them to work.
21 String prefix = ''; 21 String prefix = '';
22 22
23 main() { 23 main() {
24 window.on.contentLoaded.add((e) { 24 // Figure out where we are.
Bob Nystrom 2012/04/23 16:03:20 Good catch. When I first wrote this, we weren't re
ahe 2012/04/24 10:31:02 Is it just me, or is window.on.contentLoaded point
Bob Nystrom 2012/04/24 16:38:08 Hmm, good point. I'll send an email asking about t
25 // Figure out where we are. 25 final body = document.query('body');
26 final body = document.query('body'); 26 currentLibrary = body.dataAttributes['library'];
27 currentLibrary = body.dataAttributes['library']; 27 currentType = body.dataAttributes['type'];
28 currentType = body.dataAttributes['type']; 28 prefix = (currentType != null) ? '../' : '';
29 prefix = (currentType != null) ? '../' : '';
30 29
31 enableCodeBlocks(); 30 enableCodeBlocks();
32 31
33 // 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.
34 new XMLHttpRequest.getTEMPNAME('${prefix}nav.json', (request) { 33 new XMLHttpRequest.getTEMPNAME('${prefix}nav.json', (request) {
35 buildNavigation(JSON.parse(request.responseText)); 34 buildNavigation(JSON.parse(request.responseText));
36 });
37 }); 35 });
38 } 36 }
39 37
40 /** 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. */
41 String sanitize(String name) => name.replaceAll(':', '_').replaceAll('/', '_'); 39 String sanitize(String name) => name.replaceAll(':', '_').replaceAll('/', '_');
42 40
43 /** 41 /**
44 * 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
45 * 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
46 * type. 44 * type.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 '''); 99 ''');
102 } 100 }
103 html.add('</li>'); 101 html.add('</li>');
104 } 102 }
105 103
106 html.add('<ul class="icon">'); 104 html.add('<ul class="icon">');
107 types.forEach((type) => writeType(type['kind'], type)); 105 types.forEach((type) => writeType(type['kind'], type));
108 exceptions.forEach((type) => writeType('exception', type)); 106 exceptions.forEach((type) => writeType('exception', type));
109 html.add('</ul>'); 107 html.add('</ul>');
110 } 108 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698