(id, config, containAll)
| 92 | |
| 93 | //创建菜单项 |
| 94 | function createSideBarMenuItem(id, config, containAll) { |
| 95 | containExample = containAll; |
| 96 | |
| 97 | if (!config) { |
| 98 | return; |
| 99 | } |
| 100 | if (window.isLocal && config.localIgnore) { |
| 101 | return; |
| 102 | } |
| 103 | if (config.content) { |
| 104 | var hasNewExamples = false; |
| 105 | a: for (var key in config.content) { |
| 106 | var examples = config.content[key].content; |
| 107 | if (examples) { |
| 108 | for (var index = 0; index < examples.length; index++) { |
| 109 | var element = examples[index]; |
| 110 | if (element.version === window.version) { |
| 111 | config.content[key].hasNewExamples = true; |
| 112 | hasNewExamples = true; |
| 113 | continue a; |
| 114 | } |
| 115 | } |
| 116 | } |
| 117 | } |
| 118 | config.hasNewExamples = hasNewExamples; |
| 119 | } |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | var title = utils.getLocalPairs(config, "name"); |
| 125 | var li = $("<li id='iclient_" + id + "' class='treeview ' title='" + title + "'></li>"); |
| 126 | if (config.content) { |
| 127 | createSideBarMenuTitle(id, title, true, config.hasNewExamples).appendTo(li); |
| 128 | createSideBarSecondMenu(config.content, id).appendTo(li); |
| 129 | } else { |
| 130 | createSideBarMenuTitle(id, title, false, config.hasNewExamples).appendTo(li); |
| 131 | } |
| 132 | return li; |
| 133 | } |
| 134 | |
| 135 | //创建二级菜单 |
| 136 | function createSideBarSecondMenu(config, name) { |
no test coverage detected