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

Unified Diff: pkg/dartdoc/lib/src/client/client-shared.dart

Issue 10985085: Members and comments inherited in dartdoc. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased. Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
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('/', '_');

Powered by Google App Engine
This is Rietveld 408576698