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

Side by Side Diff: utils/dartdoc/interact.dart

Issue 9256002: Add a mode to dartdoc to generate the navigation on the client. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Respond to review. Created 8 years, 11 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
« no previous file with comments | « utils/dartdoc/dartdoc.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
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.
4
5 /** Provides client-side behavior for generated docs. */
6 #library('interact');
7
8 #import('dart:html');
9 #import('../../frog/lang.dart');
10 #import('markdown.dart', prefix: 'md');
11
12 #source('classify.dart');
13
14 main() {
15 window.on.contentLoaded.add((e) {
16 for (var elem in document.queryAll('.method, .field')) {
17 var showCode = elem.query('.show-code');
18
19 // Skip it if we don't have a code link. Will happen if source code is
20 // disabled.
21 if (showCode == null) continue;
22
23 var pre = elem.query('pre.source');
24 showCode.on.click.add((e) {
25 if (pre.classes.contains('expanded')) {
26 pre.classes.remove('expanded');
27 } else {
28 // Syntax highlight.
29 if (!pre.classes.contains('formatted')) {
30 pre.innerHTML = classifySource(new SourceFile('', pre.text));
31 pre.classes.add('formatted');
32 };
33 pre.classes.add('expanded');
34 }
35 });
36 }
37 });
38 }
OLDNEW
« no previous file with comments | « utils/dartdoc/dartdoc.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698