| OLD | NEW |
| 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 // The names of the library and type that this page documents. | 7 // The names of the library and type that this page documents. |
| 8 String currentLibrary = null; | 8 String currentLibrary = null; |
| 9 String currentType = null; | 9 String currentType = null; |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 * code block the first time it's shown. | 31 * code block the first time it's shown. |
| 32 */ | 32 */ |
| 33 enableCodeBlocks() { | 33 enableCodeBlocks() { |
| 34 for (var elem in document.queryAll('.method, .field')) { | 34 for (var elem in document.queryAll('.method, .field')) { |
| 35 var showCode = elem.query('.show-code'); | 35 var showCode = elem.query('.show-code'); |
| 36 | 36 |
| 37 // Skip it if we don't have a code link. Will happen if source code is | 37 // Skip it if we don't have a code link. Will happen if source code is |
| 38 // disabled. | 38 // disabled. |
| 39 if (showCode == null) continue; | 39 if (showCode == null) continue; |
| 40 | 40 |
| 41 var pre = elem.query('pre.source'); | 41 var preList = elem.queryAll('pre.source'); |
| 42 | 42 |
| 43 showCode.on.click.add((e) { | 43 showCode.on.click.add((e) { |
| 44 if (pre.classes.contains('expanded')) { | 44 for (final pre in preList) { |
| 45 pre.classes.remove('expanded'); | 45 if (pre.classes.contains('expanded')) { |
| 46 } else { | 46 pre.classes.remove('expanded'); |
| 47 // Syntax highlight. | 47 } else { |
| 48 if (!pre.classes.contains('formatted')) { | 48 // Syntax highlight. |
| 49 pre.innerHTML = classifySource(pre.text); | 49 if (!pre.classes.contains('formatted')) { |
| 50 pre.classes.add('formatted'); | 50 pre.innerHTML = classifySource(pre.text); |
| 51 }; | 51 pre.classes.add('formatted'); |
| 52 pre.classes.add('expanded'); | 52 }; |
| 53 pre.classes.add('expanded'); |
| 54 } |
| 53 } | 55 } |
| 54 }); | 56 }); |
| 55 } | 57 } |
| 56 } | 58 } |
| 57 | 59 |
| 58 /** | 60 /** |
| 59 * Enables show/hide functionality for inherited members and comments. | 61 * Enables show/hide functionality for inherited members and comments. |
| 60 */ | 62 */ |
| 61 void enableShowHideInherited() { | 63 void enableShowHideInherited() { |
| 62 var showInherited = document.query('#show-inherited'); | 64 var showInherited = document.query('#show-inherited'); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 97 |
| 96 String getLibraryMemberUrl(String libraryName, Map memberInfo) => | 98 String getLibraryMemberUrl(String libraryName, Map memberInfo) => |
| 97 '$prefix${sanitize(libraryName)}.html#${getMemberAnchor(memberInfo)}'; | 99 '$prefix${sanitize(libraryName)}.html#${getMemberAnchor(memberInfo)}'; |
| 98 | 100 |
| 99 String getTypeMemberUrl(String libraryName, String typeName, Map memberInfo) => | 101 String getTypeMemberUrl(String libraryName, String typeName, Map memberInfo) => |
| 100 '$prefix${sanitize(libraryName)}/${sanitize(typeName)}.html#' | 102 '$prefix${sanitize(libraryName)}/${sanitize(typeName)}.html#' |
| 101 '${getMemberAnchor(memberInfo)}'; | 103 '${getMemberAnchor(memberInfo)}'; |
| 102 | 104 |
| 103 String getMemberAnchor(Map memberInfo) => memberInfo.containsKey(LINK_NAME) | 105 String getMemberAnchor(Map memberInfo) => memberInfo.containsKey(LINK_NAME) |
| 104 ? memberInfo[LINK_NAME] : memberInfo[NAME]; | 106 ? memberInfo[LINK_NAME] : memberInfo[NAME]; |
| OLD | NEW |