Chromium Code Reviews| Index: pkg/dartdoc/lib/src/client/client-shared.dart |
| diff --git a/pkg/dartdoc/lib/src/client/client-shared.dart b/pkg/dartdoc/lib/src/client/client-shared.dart |
| index 41ebe288d6c6635f0bb4116d18ae0ae398cf7abb..9f612e75127fc0a5e4cbffc152d60013ec06f2b8 100644 |
| --- a/pkg/dartdoc/lib/src/client/client-shared.dart |
| +++ b/pkg/dartdoc/lib/src/client/client-shared.dart |
| @@ -11,6 +11,12 @@ String currentType = null; |
| // What we need to prefix relative URLs with to get them to work. |
| String prefix = ''; |
| +void setup() { |
| + setupLocation(); |
| + enableCodeBlocks(); |
| + enableShowHideInherited(); |
| +} |
| + |
| void setupLocation() { |
| // Figure out where we are. |
| final body = document.query('body'); |
| @@ -48,6 +54,29 @@ enableCodeBlocks() { |
| } |
| } |
| +/** |
| + * Enables show/hide functionality for inherited members and comments. |
| + */ |
| +void enableShowHideInherited() { |
| + var showInherited = document.query('.show-inherited'); |
|
Lasse Reichstein Nielsen
2012/10/04 07:41:19
Why is show-inherited a class and not an id? Do yo
Johnni Winther
2012/10/04 12:46:21
Done.
|
| + if (showInherited == null) return; |
| + showInherited.dataAttributes.putIfAbsent('show-inherited', () => 'block'); |
| + showInherited.on.click.add((e) { |
| + String display = showInherited.dataAttributes['show-inherited']; |
| + if (display == 'block') { |
| + display = 'none'; |
| + showInherited.innerHTML = 'Show inherited'; |
| + } else { |
| + display = 'block'; |
| + showInherited.innerHTML = 'Hide inherited'; |
| + } |
| + showInherited.dataAttributes['show-inherited'] = display; |
| + for (var elem in document.queryAll('.inherited')) { |
| + elem.style.display = display; |
| + } |
| + }); |
| + |
| +} |
| /** Turns [name] into something that's safe to use as a file name. */ |
| String sanitize(String name) => name.replaceAll(':', '_').replaceAll('/', '_'); |