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

Side by Side Diff: lib/dartdoc/client-shared.dart

Issue 9844031: add disqus comments (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: remove generated file 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
« no previous file with comments | « no previous file | lib/dartdoc/client-static.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Code shared between the different client-side libraries. 5 // Code shared between the different client-side libraries.
6 6
7 /** 7 /**
8 * Finds all code blocks and makes them toggleable. Syntax highlights each 8 * Finds all code blocks and makes them toggleable. Syntax highlights each
9 * code block the first time it's shown. 9 * code block the first time it's shown.
10 */ 10 */
11 enableCodeBlocks() { 11 enableCodeBlocks() {
12 for (var elem in document.queryAll('.method, .field')) { 12 for (var elem in document.queryAll('.method, .field')) {
13 var showCode = elem.query('.show-code'); 13 var showCode = elem.query('.show-code');
14 14
15 // Skip it if we don't have a code link. Will happen if source code is 15 // Skip it if we don't have a code link. Will happen if source code is
16 // disabled. 16 // disabled.
17 if (showCode == null) continue; 17 if (showCode == null) continue;
18 18
19 var pre = elem.query('pre.source'); 19 var pre = elem.query('pre.source');
20
20 showCode.on.click.add((e) { 21 showCode.on.click.add((e) {
21 if (pre.classes.contains('expanded')) { 22 if (pre.classes.contains('expanded')) {
22 pre.classes.remove('expanded'); 23 pre.classes.remove('expanded');
23 } else { 24 } else {
24 // Syntax highlight. 25 // Syntax highlight.
25 if (!pre.classes.contains('formatted')) { 26 if (!pre.classes.contains('formatted')) {
26 pre.innerHTML = classifySource(new frog.SourceFile('', pre.text)); 27 pre.innerHTML = classifySource(new frog.SourceFile('', pre.text));
27 pre.classes.add('formatted'); 28 pre.classes.add('formatted');
28 }; 29 };
29 pre.classes.add('expanded'); 30 pre.classes.add('expanded');
30 } 31 }
31 }); 32 });
33
32 } 34 }
33 } 35 }
OLDNEW
« no previous file with comments | « no previous file | lib/dartdoc/client-static.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698