api.js 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  1. var apiContent = {
  2. zTree_Setting: null,
  3. zTree_Node: null,
  4. zTree_Function: null,
  5. overlayDiv : null,
  6. overlayContent : null,
  7. overlayDetailDiv : null,
  8. overlayCloseBtn: null,
  9. overlayArrow: null,
  10. contentBoxDiv : null,
  11. settingDiv : null,
  12. functionDiv : null,
  13. overlaySearch: null,
  14. searchKey: null,
  15. searchResultInput: null,
  16. searchPrevBtn: null,
  17. searchNextBtn: null,
  18. apiCache: {},
  19. lastValue: "",
  20. searchNodes: [],
  21. searchNodesCur: 0,
  22. _init: function() {
  23. this.overlayDiv = $("#overlayDiv");
  24. this.overlayContent = $("#overlayContent");
  25. this.overlayDetailDiv = $("#overlayDetailDiv");
  26. this.overlayCloseBtn = $("#overlayDivCloseBtn");
  27. this.overlayArrow = $("#overlayDivArrow");
  28. this.contentBoxDiv = $("#contentBox");
  29. this.settingDiv = $("#api_setting");
  30. this.functionDiv = $("#api_function");
  31. this.searchKey = $(".searchKey");
  32. this.overlaySearch = $(".overlaySearch");
  33. this.searchResultInput = $(".searchResult");
  34. this.searchPrevBtn = $(".searchPrev");
  35. this.searchNextBtn = $(".searchNext");
  36. var setting = {
  37. view: {
  38. fontCss: this.getFontCss,
  39. showLine: false,
  40. showIcon: this.showIcon,
  41. showTitle: this.getTitle,
  42. selectedMulti: false,
  43. dblClickExpand: false
  44. },
  45. data: {
  46. key: {
  47. title: "tt"
  48. },
  49. simpleData: {
  50. enable:true,
  51. idKey: "id",
  52. pIdKey: "pId",
  53. rootPId: ""
  54. }
  55. },
  56. callback: {
  57. onNodeCreated: this.onNodeCreated,
  58. beforeClick: this.beforeClick
  59. }
  60. };
  61. var setting_nodes =[
  62. {id:1, pId:0, t:"setting", name:"var setting = {", open:true},
  63. {id:11, pId:1, t:"treeId", name:"treeId : \"\",", iconSkin:"core", showAPI:true},
  64. {id:12, pId:1, t:"treeObj", name:"treeObj : null,", iconSkin:"core", showAPI:true},
  65. {id:121, pId:1, name:""},
  66. {id:20, pId:1, t:"async", name:"async : {", open:true},
  67. {id:201, pId:20, t:"autoParam", name:"autoParam : [],", iconSkin:"core", showAPI:true},
  68. {id:208, pId:20, t:"contentType", name:"contentType : \"application...\",", iconSkin:"core", showAPI:true},
  69. {id:202, pId:20, t:"dataFilter", name:"dataFilter : null,", iconSkin:"core", showAPI:true},
  70. {id:203, pId:20, t:"dataType", name:"dataType : \"text\",", iconSkin:"core", showAPI:true},
  71. {id:204, pId:20, t:"enable", name:"enable : false,", iconSkin:"core", showAPI:true},
  72. {id:205, pId:20, t:"otherParam", name:"otherParam : [],", iconSkin:"core", showAPI:true},
  73. {id:206, pId:20, t:"type", name:"type : \"post\",", iconSkin:"core", showAPI:true},
  74. {id:209, pId:20, t:"headers", name:"headers : {},", iconSkin:"core", showAPI:true},
  75. {id:210, pId:20, t:"xhrFields", name:"xhrFields : {},", iconSkin:"core", showAPI:true},
  76. {id:207, pId:20, t:"url", name:"url : \"\"", iconSkin:"core", showAPI:true},
  77. {id:21, pId:1, name:"},"},
  78. {id:22, pId:1, name:""},
  79. {id:30, pId:1, t:"callback", name:"callback : {", open:true},
  80. {id:3001, pId:30, t:"beforeAsync", name:"beforeAsync : null,", iconSkin:"core", showAPI:true},
  81. {id:3002, pId:30, t:"beforeCheck", name:"beforeCheck : null,", iconSkin:"check", showAPI:true},
  82. {id:3003, pId:30, t:"beforeClick", name:"beforeClick : null,", iconSkin:"core", showAPI:true},
  83. {id:3004, pId:30, t:"beforeCollapse", name:"beforeCollapse : null,", iconSkin:"core", showAPI:true},
  84. {id:3004, pId:30, t:"beforeDblClick", name:"beforeDblClick : null,", iconSkin:"core", showAPI:true},
  85. {id:3005, pId:30, t:"beforeDrag", name:"beforeDrag : null,", iconSkin:"edit", showAPI:true},
  86. {id:3006, pId:30, t:"beforeDragOpen", name:"beforeDragOpen : null,", iconSkin:"edit", showAPI:true},
  87. {id:3007, pId:30, t:"beforeDrop", name:"beforeDrop : null,", iconSkin:"edit", showAPI:true},
  88. {id:3029, pId:30, t:"beforeEditName", name:"beforeEditName : null,", iconSkin:"edit", showAPI:true},
  89. {id:3008, pId:30, t:"beforeExpand", name:"beforeExpand : null,", iconSkin:"core", showAPI:true},
  90. {id:3009, pId:30, t:"beforeMouseDown", name:"beforeMouseDown : null,", iconSkin:"core", showAPI:true},
  91. {id:3010, pId:30, t:"beforeMouseUp", name:"beforeMouseUp : null,", iconSkin:"core", showAPI:true},
  92. {id:3011, pId:30, t:"beforeRemove", name:"beforeRemove : null,", iconSkin:"edit", showAPI:true},
  93. {id:3012, pId:30, t:"beforeRename", name:"beforeRename : null,", iconSkin:"edit", showAPI:true},
  94. {id:3013, pId:30, t:"beforeRightClick", name:"beforeRightClick : null,", iconSkin:"core", showAPI:true},
  95. {id:3014, pId:30, name:""},
  96. {id:3015, pId:30, t:"onAsyncError", name:"onAsyncError : null,", iconSkin:"core", showAPI:true},
  97. {id:3016, pId:30, t:"onAsyncSuccess", name:"onAsyncSuccess : null,", iconSkin:"core", showAPI:true},
  98. {id:3017, pId:30, t:"onCheck", name:"onCheck : null,", iconSkin:"check", showAPI:true},
  99. {id:3018, pId:30, t:"onClick", name:"onClick : null,", iconSkin:"core", showAPI:true},
  100. {id:3019, pId:30, t:"onCollapse", name:"onCollapse : null,", iconSkin:"core", showAPI:true},
  101. {id:3029, pId:30, t:"onDblClick", name:"onDblClick : null,", iconSkin:"core", showAPI:true},
  102. {id:3020, pId:30, t:"onDrag", name:"onDrag : null,", iconSkin:"edit", showAPI:true},
  103. {id:3030, pId:30, t:"onDragMove", name:"onDragMove : null,", iconSkin:"edit", showAPI:true},
  104. {id:3021, pId:30, t:"onDrop", name:"onDrop : null,", iconSkin:"edit", showAPI:true},
  105. {id:3022, pId:30, t:"onExpand", name:"onExpand : null,", iconSkin:"core", showAPI:true},
  106. {id:3023, pId:30, t:"onMouseDown", name:"onMouseDown : null,", iconSkin:"core", showAPI:true},
  107. {id:3024, pId:30, t:"onMouseUp", name:"onMouseUp : null,", iconSkin:"core", showAPI:true},
  108. {id:3025, pId:30, t:"onNodeCreated", name:"onNodeCreated : null,", iconSkin:"core", showAPI:true},
  109. {id:3026, pId:30, t:"onRemove", name:"onRemove : null,", iconSkin:"edit", showAPI:true},
  110. {id:3027, pId:30, t:"onRename", name:"onRename : null,", iconSkin:"edit", showAPI:true},
  111. {id:3028, pId:30, t:"onRightClick", name:"onRightClick : null", iconSkin:"core", showAPI:true},
  112. {id:31, pId:1, name:"},"},
  113. {id:32, pId:1, name:""},
  114. {id:40, pId:1, t:"check", name:"check : {", open:true},
  115. {id:405, pId:40, t:"autoCheckTrigger", name:"autoCheckTrigger : false,", iconSkin:"check", showAPI:true},
  116. {id:401, pId:40, t:"chkboxType", name:"chkboxType : {\"Y\": \"ps\", \"N\": \"ps\"},", iconSkin:"check", showAPI:true},
  117. {id:402, pId:40, t:"chkStyle", name:"chkStyle : \"checkbox\",", iconSkin:"check", showAPI:true},
  118. {id:403, pId:40, t:"enable", name:"enable : false,", iconSkin:"check", showAPI:true},
  119. {id:406, pId:40, t:"nocheckInherit", name:"nocheckInherit : false", iconSkin:"check", showAPI:true},
  120. {id:407, pId:40, t:"chkDisabledInherit", name:"chkDisabledInherit : false", iconSkin:"check", showAPI:true},
  121. {id:404, pId:40, t:"radioType", name:"radioType : \"level\"", iconSkin:"check", showAPI:true},
  122. {id:41, pId:1, name:"},"},
  123. {id:42, pId:1, name:""},
  124. {id:50, pId:1, t:"data", name:"data : {", open:true},
  125. {id:500, pId:50, t:"keep", name:"keep : {", open:true},
  126. {id:5001, pId:500, t:"leaf", name:"leaf : false,", iconSkin:"core", showAPI:true},
  127. {id:5002, pId:500, t:"parent", name:"parent : false", iconSkin:"core", showAPI:true},
  128. {id:501, pId:50, name:"},"},
  129. {id:510, pId:50, t:"key", name:"key : {", open:true},
  130. {id:5101, pId:510, t:"checked", name:"checked : \"checked\",", iconSkin:"check", showAPI:true},
  131. {id:5102, pId:510, t:"children", name:"children : \"children\",", iconSkin:"core", showAPI:true},
  132. {id:5106, pId:510, t:"isParent", name:"isParent : \"isParent\",", iconSkin:"core", showAPI:true},
  133. {id:5107, pId:510, t:"isHidden", name:"isHidden : \"isHidden\",", iconSkin:"hide", showAPI:true},
  134. {id:5103, pId:510, t:"name", name:"name : \"name\",", iconSkin:"core", showAPI:true},
  135. {id:5104, pId:510, t:"title", name:"title : \"\"", iconSkin:"core", showAPI:true},
  136. {id:5105, pId:510, t:"url", name:"url : \"url\"", iconSkin:"core", showAPI:true},
  137. {id:511, pId:50, name:"},"},
  138. {id:520, pId:50, t:"simpleData", name:"simpleData : {", open:true},
  139. {id:5201, pId:520, t:"enable", name:"enable : false,", iconSkin:"core", showAPI:true},
  140. {id:5202, pId:520, t:"idKey", name:"idKey : \"id\",", iconSkin:"core", showAPI:true},
  141. {id:5203, pId:520, t:"pIdKey", name:"pIdKey : \"pId\",", iconSkin:"core", showAPI:true},
  142. {id:5204, pId:520, t:"rootPId", name:"rootPId : null", iconSkin:"core", showAPI:true},
  143. {id:521, pId:50, name:"},"},
  144. {id:530, pId:50, t:"render", name:"render : {", open:true},
  145. {id:5301, pId:530, t:"name", name:"name : null,", iconSkin:"core", showAPI:true},
  146. {id:5302, pId:530, t:"title", name:"title : null", iconSkin:"core", showAPI:true},
  147. {id:531, pId:50, name:"}"},
  148. {id:51, pId:1, name:"},"},
  149. {id:52, pId:1, name:""},
  150. {id:60, pId:1, t:"edit", name:"edit : {", open:true},
  151. {id:601, pId:60, t:"drag", name:"drag : {", open:true},
  152. {id:60111, pId:601, t:"autoExpandTrigger", name:"autoExpandTrigger : true,", iconSkin:"edit", showAPI:true},
  153. {id:60101, pId:601, t:"isCopy", name:"isCopy : true,", iconSkin:"edit", showAPI:true},
  154. {id:60102, pId:601, t:"isMove", name:"isMove : true,", iconSkin:"edit", showAPI:true},
  155. {id:60103, pId:601, t:"prev", name:"prev : true,", iconSkin:"edit", showAPI:true},
  156. {id:60104, pId:601, t:"next", name:"next : true,", iconSkin:"edit", showAPI:true},
  157. {id:60105, pId:601, t:"inner", name:"inner : true,", iconSkin:"edit", showAPI:true},
  158. {id:60107, pId:601, t:"borderMax", name:"borderMax : 10,", iconSkin:"edit", showAPI:true},
  159. {id:60108, pId:601, t:"borderMin", name:"borderMin : -5,", iconSkin:"edit", showAPI:true},
  160. {id:60106, pId:601, t:"minMoveSize", name:"minMoveSize : 5,", iconSkin:"edit", showAPI:true},
  161. {id:60109, pId:601, t:"maxShowNodeNum", name:"maxShowNodeNum : 5,", iconSkin:"edit", showAPI:true},
  162. {id:60110, pId:601, t:"autoOpenTime", name:"autoOpenTime : 500", iconSkin:"edit", showAPI:true},
  163. {id:602, pId:60, name:"},"},
  164. {id:608, pId:60, t:"editNameSelectAll", name:"editNameSelectAll : false,", iconSkin:"edit", showAPI:true},
  165. {id:603, pId:60, t:"enable", name:"enable : false,", iconSkin:"edit", showAPI:true},
  166. {id:604, pId:60, t:"removeTitle", name:"removeTitle : \"remove\",", iconSkin:"edit", showAPI:true},
  167. {id:605, pId:60, t:"renameTitle", name:"renameTitle : \"rename\",", iconSkin:"edit", showAPI:true},
  168. {id:606, pId:60, t:"showRemoveBtn", name:"showRemoveBtn : true,", iconSkin:"edit", showAPI:true},
  169. {id:607, pId:60, t:"showRenameBtn", name:"showRenameBtn : true", iconSkin:"edit", showAPI:true},
  170. {id:61, pId:1, name:"},"},
  171. {id:62, pId:1, name:""},
  172. {id:70, pId:1, t:"view", name:"view : {", open:true},
  173. {id:7001, pId:70, t:"addDiyDom", name:"addDiyDom : null,", iconSkin:"core", showAPI:true},
  174. {id:7002, pId:70, t:"addHoverDom", name:"addHoverDom : null,", iconSkin:"edit", showAPI:true},
  175. {id:7003, pId:70, t:"autoCancelSelected", name:"autoCancelSelected : true,", iconSkin:"core", showAPI:true},
  176. {id:7004, pId:70, t:"dblClickExpand", name:"dblClickExpand : true,", iconSkin:"core", showAPI:true},
  177. {id:7005, pId:70, t:"expandSpeed", name:"expandSpeed : \"fast\",", iconSkin:"core", showAPI:true},
  178. {id:7006, pId:70, t:"fontCss", name:"fontCss : {},", iconSkin:"core", showAPI:true},
  179. {id:7014, pId:70, t:"nodeClasses", name:"nodeClasses : {},", iconSkin:"core", showAPI:true},
  180. {id:7013, pId:70, t:"nameIsHTML", name:"nameIsHTML : false,", iconSkin:"core", showAPI:true},
  181. {id:7007, pId:70, t:"removeHoverDom", name:"removeHoverDom : null,", iconSkin:"edit", showAPI:true},
  182. {id:7008, pId:70, t:"selectedMulti", name:"selectedMulti : true,", iconSkin:"core", showAPI:true},
  183. {id:7009, pId:70, t:"showIcon", name:"showIcon : true,", iconSkin:"core", showAPI:true},
  184. {id:7010, pId:70, t:"showLine", name:"showLine : true,", iconSkin:"core", showAPI:true},
  185. {id:7011, pId:70, t:"showTitle", name:"showTitle : true,", iconSkin:"core", showAPI:true},
  186. {id:7012, pId:70, t:"txtSelectedEnable", name:"txtSelectedEnable : false", iconSkin:"core", showAPI:true},
  187. {id:71, pId:1, name:"}"},
  188. {id:2, pId:0, name:"}"}
  189. ];
  190. var treenode_nodes =[
  191. {id:1, pId:0, t:"treeNode", name:"treeNode : {", open:true},
  192. {id:101, pId:1, t:"checked", name:"checked", iconSkin:"check", showAPI:true},
  193. {id:102, pId:1, t:"children", name:"children", iconSkin:"core", showAPI:true},
  194. {id:128, pId:1, t:"chkDisabled", name:"chkDisabled", iconSkin:"check", showAPI:true},
  195. {id:127, pId:1, t:"click", name:"click", iconSkin:"core", showAPI:true},
  196. {id:103, pId:1, t:"getCheckStatus", name:"getCheckStatus ()", iconSkin:"check", showAPI:true},
  197. {id:135, pId:1, t:"getIndex", name:"getIndex ()", iconSkin:"core", showAPI:true},
  198. {id:104, pId:1, t:"getNextNode", name:"getNextNode ()", iconSkin:"core", showAPI:true},
  199. {id:105, pId:1, t:"getParentNode", name:"getParentNode ()", iconSkin:"core", showAPI:true},
  200. {id:136, pId:1, t:"getPath", name:"getPath ()", iconSkin:"core", showAPI:true},
  201. {id:106, pId:1, t:"getPreNode", name:"getPreNode ()", iconSkin:"core", showAPI:true},
  202. {id:129, pId:1, t:"halfCheck", name:"halfCheck", iconSkin:"check", showAPI:true},
  203. {id:107, pId:1, t:"icon", name:"icon", iconSkin:"core", showAPI:true},
  204. {id:108, pId:1, t:"iconClose", name:"iconClose", iconSkin:"core", showAPI:true},
  205. {id:109, pId:1, t:"iconOpen", name:"iconOpen", iconSkin:"core", showAPI:true},
  206. {id:110, pId:1, t:"iconSkin", name:"iconSkin", iconSkin:"core", showAPI:true},
  207. {id:131, pId:1, t:"isHidden", name:"isHidden", iconSkin:"hide", showAPI:true},
  208. {id:111, pId:1, t:"isParent", name:"isParent", iconSkin:"core", showAPI:true},
  209. {id:132, pId:1, t:"name", name:"name", iconSkin:"core", showAPI:true},
  210. {id:112, pId:1, t:"nocheck", name:"nocheck", iconSkin:"check", showAPI:true},
  211. {id:113, pId:1, t:"open", name:"open", iconSkin:"core", showAPI:true},
  212. {id:133, pId:1, t:"target", name:"target", iconSkin:"core", showAPI:true},
  213. {id:134, pId:1, t:"url", name:"url", iconSkin:"core", showAPI:true},
  214. {id:114, pId:1, t:"diy", name:"*DIY*", iconSkin:"core", showAPI:true},
  215. {id:115, pId:1, name:""},
  216. {id:116, pId:1, t:"check_Child_State", name:"[check_Child_State]", iconSkin:"check", showAPI:true},
  217. {id:117, pId:1, t:"check_Focus", name:"[check_Focus]", iconSkin:"check", showAPI:true},
  218. {id:118, pId:1, t:"checkedOld", name:"[checkedOld]", iconSkin:"check", showAPI:true},
  219. {id:119, pId:1, t:"editNameFlag", name:"[editNameFlag]", iconSkin:"edit", showAPI:true},
  220. {id:120, pId:1, t:"isAjaxing", name:"[isAjaxing]", iconSkin:"core", showAPI:true},
  221. {id:121, pId:1, t:"isFirstNode", name:"[isFirstNode]", iconSkin:"core", showAPI:true},
  222. {id:122, pId:1, t:"isHover", name:"[isHover]", iconSkin:"edit", showAPI:true},
  223. {id:123, pId:1, t:"isLastNode", name:"[isLastNode]", iconSkin:"core", showAPI:true},
  224. {id:124, pId:1, t:"level", name:"[level]", iconSkin:"core", showAPI:true},
  225. {id:125, pId:1, t:"parentTId", name:"[parentTId]", iconSkin:"core", showAPI:true},
  226. {id:126, pId:1, t:"tId", name:"[tId]", iconSkin:"core", showAPI:true},
  227. {id:130, pId:1, t:"zAsync", name:"[zAsync]", iconSkin:"core", showAPI:true},
  228. {id:2, pId:0, name:"}"}
  229. ];
  230. var function_nodes =[
  231. {id:1, pId:0, t:"$.fn.zTree", name:"$.fn.zTree : {", open:true},
  232. {id:11, pId:1, t:"init", name:"init (obj, zSetting, zNodes)", iconSkin:"core", showAPI:true},
  233. {id:12, pId:1, t:"getZTreeObj", name:"getZTreeObj (treeId)", iconSkin:"core", showAPI:true},
  234. {id:14, pId:1, t:"destroy", name:"destroy (treeId)", iconSkin:"core", showAPI:true},
  235. {id:13, pId:1, t:"_z", name:"_z : {tools, view, event, data}", iconSkin:"core", showAPI:true},
  236. {id:2, pId:0, name:"}"},
  237. {id:3, pId:0, name:""},
  238. {id:4, pId:0, t:"zTreeObj", name:"zTreeObj : {", open:true},
  239. {id:401, pId:4, t:"setting", name:"setting", iconSkin:"core", showAPI:true},
  240. {id:402, pId:4, t:"addNodes", name:"addNodes (parentNode, index, newNodes, isSilent)", iconSkin:"core", showAPI:true},
  241. {id:403, pId:4, t:"cancelEditName", name:"cancelEditName (newName)", iconSkin:"edit", showAPI:true},
  242. {id:404, pId:4, t:"cancelSelectedNode", name:"cancelSelectedNode (node)", iconSkin:"core", showAPI:true},
  243. {id:405, pId:4, t:"checkAllNodes", name:"checkAllNodes (checked)", iconSkin:"check", showAPI:true},
  244. {id:406, pId:4, t:"checkNode", name:"checkNode (node, checked, checkTypeFlag, callbackFlag)", iconSkin:"check", showAPI:true},
  245. {id:407, pId:4, t:"copyNode", name:"copyNode (targetNode, node, moveType, isSilent)", iconSkin:"edit", showAPI:true},
  246. {id:436, pId:4, t:"destroy", name:"destroy ()", iconSkin:"core", showAPI:true},
  247. {id:408, pId:4, t:"editName", name:"editName (node)", iconSkin:"edit", showAPI:true},
  248. {id:409, pId:4, t:"expandAll", name:"expandAll (expandFlag)", iconSkin:"core", showAPI:true},
  249. {id:410, pId:4, t:"expandNode", name:"expandNode (node, expandFlag, sonSign, focus, callbackFlag)", iconSkin:"core", showAPI:true},
  250. {id:411, pId:4, t:"getChangeCheckedNodes", name:"getChangeCheckedNodes ()", iconSkin:"check", showAPI:true},
  251. {id:412, pId:4, t:"getCheckedNodes", name:"getCheckedNodes (checked)", iconSkin:"check", showAPI:true},
  252. {id:413, pId:4, t:"getNodeByParam", name:"getNodeByParam (key, value, parentNode)", iconSkin:"core", showAPI:true},
  253. {id:414, pId:4, t:"getNodeByTId", name:"getNodeByTId (tId)", iconSkin:"core", showAPI:true},
  254. {id:415, pId:4, t:"getNodeIndex", name:"getNodeIndex (node)", iconSkin:"core", showAPI:true},
  255. {id:416, pId:4, t:"getNodes", name:"getNodes ()", iconSkin:"core", showAPI:true},
  256. {id:431, pId:4, t:"getNodesByFilter", name:"getNodesByFilter (filter, isSingle, parentNode, invokeParam)", iconSkin:"core", showAPI:true},
  257. {id:417, pId:4, t:"getNodesByParam", name:"getNodesByParam (key, value, parentNode)", iconSkin:"core", showAPI:true},
  258. {id:418, pId:4, t:"getNodesByParamFuzzy", name:"getNodesByParamFuzzy (key, value, parentNode)", iconSkin:"core", showAPI:true},
  259. {id:419, pId:4, t:"getSelectedNodes", name:"getSelectedNodes ()", iconSkin:"core", showAPI:true},
  260. {id:432, pId:4, t:"hideNode", name:"hideNode (node)", iconSkin:"hide", showAPI:true},
  261. {id:433, pId:4, t:"hideNodes", name:"hideNodes (nodes)", iconSkin:"hide", showAPI:true},
  262. {id:420, pId:4, t:"moveNode", name:"moveNode (targetNode, node, moveType, isSilent)", iconSkin:"edit", showAPI:true},
  263. {id:421, pId:4, t:"reAsyncChildNodes", name:"reAsyncChildNodes (parentNode, reloadType, isSilent, callback)", iconSkin:"core", showAPI:true},
  264. {id:437, pId:4, t:"reAsyncChildNodesPromise", name:"reAsyncChildNodesPromise(parentNode, reloadType, isSilent)", iconSkin:"core", showAPI:true},
  265. {id:422, pId:4, t:"refresh", name:"refresh ()", iconSkin:"core", showAPI:true},
  266. {id:423, pId:4, t:"removeChildNodes", name:"removeChildNodes (parentNode)", iconSkin:"core", showAPI:true},
  267. {id:424, pId:4, t:"removeNode", name:"removeNode (node, callbackFlag)", iconSkin:"core", showAPI:true},
  268. {id:425, pId:4, t:"selectNode", name:"selectNode (node, addFlag, isSilent)", iconSkin:"core", showAPI:true},
  269. {id:430, pId:4, t:"setChkDisabled", name:"setChkDisabled (node, disabled, inheritParent, inheritChildren)", iconSkin:"check", showAPI:true},
  270. {id:426, pId:4, t:"setEditable", name:"setEditable (editable)", iconSkin:"edit", showAPI:true},
  271. {id:434, pId:4, t:"showNode", name:"showNode (node)", iconSkin:"hide", showAPI:true},
  272. {id:435, pId:4, t:"showNodes", name:"showNodes (nodes)", iconSkin:"hide", showAPI:true},
  273. {id:427, pId:4, t:"transformToArray", name:"transformToArray (nodes)", iconSkin:"core", showAPI:true},
  274. {id:428, pId:4, t:"transformTozTreeNodes", name:"transformTozTreeNodes (simpleNodes)", iconSkin:"core", showAPI:true},
  275. {id:429, pId:4, t:"updateNode", name:"updateNode (node, checkTypeFlag)", iconSkin:"core", showAPI:true},
  276. {id:5, pId:0, name:"}"}
  277. ];
  278. apiContent.zTree_Setting = $.fn.zTree.init($("#settingTree"), $.fn.zTree._z.tools.clone(setting), setting_nodes);
  279. apiContent.zTree_Node = $.fn.zTree.init($("#treenodeTree"), $.fn.zTree._z.tools.clone(setting), treenode_nodes);
  280. apiContent.zTree_Function = $.fn.zTree.init($("#functionTree"), $.fn.zTree._z.tools.clone(setting), function_nodes);
  281. this.bindEvent();
  282. },
  283. bindEvent: function() {
  284. $(document).bind("keydown", this.listenKeyDown)
  285. this.overlayCloseBtn.bind("click", apiContent.overlayClose);
  286. this.searchResultInput.bind("click", function(e) {
  287. $(this).prev().get(0).focus();
  288. this.blur();
  289. }).bind("focus", function(e) {
  290. this.blur();
  291. });
  292. this.searchKey.bind("focus", this.focusKey)
  293. .bind("blur", this.blurKey)
  294. .bind("propertychange", this.searchNode)
  295. .bind("input", this.searchNode);
  296. this.searchPrevBtn.bind("click", this.searchPrev);
  297. this.searchNextBtn.bind("click", this.searchNext);
  298. },
  299. setSameKey: function(value) {
  300. apiContent.searchKey.attr("value", value);
  301. },
  302. focusKey: function(e) {
  303. if (apiContent.searchKey.hasClass("empty")) {
  304. apiContent.searchKey.removeClass("empty");
  305. }
  306. },
  307. blurKey: function(e) {
  308. apiContent.setSameKey(e.target.value);
  309. if (e.target.value === "") {
  310. apiContent.searchKey.addClass("empty");
  311. }
  312. },
  313. listenKeyDown: function(e) {
  314. if (e.keyCode=="13" && apiContent.overlayDiv.is(":hidden")) {
  315. apiContent.openAPI();
  316. } else if (e.keyCode=="37") {
  317. apiContent.searchPrev();
  318. } else if (e.keyCode=="13" || e.keyCode=="39") {
  319. apiContent.searchNext();
  320. }
  321. },
  322. openAPI: function() {
  323. if (apiContent.searchNodes.length > 0) {
  324. var setting_zTree = $.fn.zTree.getZTreeObj("settingTree"),
  325. treenode_zTree = $.fn.zTree.getZTreeObj("treenodeTree"),
  326. function_zTree = $.fn.zTree.getZTreeObj("functionTree");
  327. if (apiContent.searchNodesCur < 0 || apiContent.searchNodesCur > apiContent.searchNodes.length -1) {
  328. apiContent.searchNodesCur = 0;
  329. }
  330. var node = apiContent.searchNodes[apiContent.searchNodesCur];
  331. if (node.tId.indexOf("setting") > -1) {
  332. setting_zTree.selectNode(node);
  333. } else if (node.tId.indexOf("treenode") > -1) {
  334. treenode_zTree.selectNode(node);
  335. } else {
  336. function_zTree.selectNode(node);
  337. }
  338. apiContent.beforeClick(node.tId.substring(0, node.tId.indexOf("_")), node, true);
  339. apiContent.searchCur();
  340. }
  341. },
  342. searchNode: function(e) {
  343. var setting_zTree = $.fn.zTree.getZTreeObj("settingTree"),
  344. treenode_zTree = $.fn.zTree.getZTreeObj("treenodeTree"),
  345. function_zTree = $.fn.zTree.getZTreeObj("functionTree");
  346. if (apiContent.curKey == e.target.value) return;
  347. apiContent.curKey = e.target.value;
  348. var value = $.trim(apiContent.curKey);
  349. apiContent.setSameKey(apiContent.curKey);
  350. if (apiContent.searchKey.hasClass("empty")) {
  351. value = "";
  352. apiContent.searchResultInput.removeClass("noResult").attr("value","");
  353. }
  354. if (apiContent.lastValue === value) return;
  355. apiContent.updateNodes(false);
  356. apiContent.lastValue = value;
  357. if (value === "" || value.length < 2) {
  358. apiContent.searchNodes = [];
  359. apiContent.searchNodesCur = -1;
  360. apiContent.searchCur(true);
  361. return;
  362. }
  363. var settingNodeList = setting_zTree.getNodesByFilter(apiContent.searchFilter);
  364. var functionNodeList = function_zTree.getNodesByFilter(apiContent.searchFilter);
  365. var treenodeNodeList = treenode_zTree.getNodesByFilter(apiContent.searchFilter);
  366. apiContent.searchNodes = settingNodeList.concat(functionNodeList).concat(treenodeNodeList);
  367. apiContent.searchNodesCur = -1;
  368. apiContent.searchCur();
  369. apiContent.updateNodes(true);
  370. },
  371. searchFilter: function(node) {
  372. var value = $.trim(apiContent.searchKey.get(0).value).toLowerCase();
  373. return (node.showAPI && node.name.toLowerCase().indexOf(value) > -1);
  374. },
  375. searchPrev: function(e) {
  376. if (apiContent.searchPrevBtn.hasClass("disabled")) return;
  377. apiContent.searchNodesCur--;
  378. if (apiContent.searchNodesCur < 0 || apiContent.searchNodesCur > apiContent.searchNodes.length -1) {
  379. apiContent.searchNodesCur = apiContent.searchNodes.length -1;
  380. }
  381. apiContent.openAPI();
  382. },
  383. searchNext: function(e) {
  384. if (apiContent.searchNextBtn.hasClass("disabled")) return;
  385. apiContent.searchNodesCur++;
  386. apiContent.openAPI();
  387. },
  388. searchCur: function(init) {
  389. var result = apiContent.searchNodes;
  390. if (init) {
  391. apiContent.searchResultInput.removeClass("noResult").attr("value","");
  392. } else if (result.length == 0) {
  393. apiContent.searchResultInput.addClass("noResult").attr("value"," [ 0 / 0 ] ");
  394. } else {
  395. apiContent.searchResultInput.removeClass("noResult").attr("value"," [ " + (apiContent.searchNodesCur > -1 ? apiContent.searchNodesCur+1 : "?")+ " / " + result.length + " ] ");
  396. }
  397. if (result.length > 0) {
  398. apiContent.searchPrevBtn.removeClass("disabled");
  399. apiContent.searchNextBtn.removeClass("disabled");
  400. } else {
  401. apiContent.searchPrevBtn.addClass("disabled");
  402. apiContent.searchNextBtn.addClass("disabled");
  403. }
  404. },
  405. updateNodes: function(highlight) {
  406. var setting_zTree = $.fn.zTree.getZTreeObj("settingTree"),
  407. treenode_zTree = $.fn.zTree.getZTreeObj("treenodeTree"),
  408. function_zTree = $.fn.zTree.getZTreeObj("functionTree"),
  409. node = null;
  410. for( var i=0, l=apiContent.searchNodes.length; i<l; i++) {
  411. node = apiContent.searchNodes[i];
  412. if (node.level > 0) {
  413. node.highlight = highlight;
  414. if (node.tId.indexOf("setting") > -1) {
  415. setting_zTree.updateNode(node);
  416. } else if (node.tId.indexOf("treenode") > -1) {
  417. treenode_zTree.updateNode(node);
  418. } else {
  419. function_zTree.updateNode(node);
  420. }
  421. }
  422. }
  423. },
  424. getFontCss: function(treeId, treeNode) {
  425. return (!!treeNode.highlight) ? {color:"#A60000", "font-weight":"bold"} : {color:"#333", "font-weight":"normal"};
  426. },
  427. getTitle: function(treeId, node) {
  428. var t = [], n = node;
  429. while (n && !!n.t) {
  430. t.push(n.t);
  431. n = n.getParentNode();
  432. }
  433. t = t.reverse();
  434. node.tt = t.join('.');
  435. return true;
  436. },
  437. showIcon: function(treeId, node) {
  438. return (!!node.iconSkin);
  439. },
  440. onNodeCreated: function (e, treeId, node) {
  441. var a = $("#" + node.tId + "_a");
  442. if (node.showAPI) {
  443. a.attr("rel", "#overlayDiv");
  444. } else {
  445. a.css({cursor: "default"});
  446. }
  447. },
  448. beforeClick: function (treeId, node, noClear) {
  449. if (!node.showAPI) return false;
  450. var o = $("#" + node.tId + "_a");
  451. if (!!apiContent.apiCache[node.tId]) {
  452. apiContent.tmpDiv.html(apiContent.apiCache[node.tId]);
  453. apiContent.overlayShow(o, (apiContent.lastNode === node));
  454. } else {
  455. apiContent.overlayAjax(treeId, node);
  456. }
  457. apiContent.lastNode = node;
  458. if (node.tId.indexOf("settingTree")>-1) {
  459. apiContent.settingDiv.removeClass("right").addClass("left");
  460. apiContent.functionDiv.removeClass("left").addClass("right");
  461. } else {
  462. apiContent.settingDiv.removeClass("left").addClass("right");
  463. apiContent.functionDiv.removeClass("right").addClass("left");
  464. }
  465. if (!noClear) {
  466. apiContent.clearSelectedNode();
  467. }
  468. return true;
  469. },
  470. clearSelectedNode: function() {
  471. apiContent.zTree_Setting.cancelSelectedNode();
  472. apiContent.zTree_Node.cancelSelectedNode();
  473. apiContent.zTree_Function.cancelSelectedNode();
  474. },
  475. overlayAutoClose: function(e) {
  476. var eId = e.target.id, eRel = e.target.getAttribute("rel"), eClass = e.target.className;
  477. if (eId === "overlayDiv" || eId === "overlayDivArrow" || eClass.indexOf("searchPrev") > -1 || eClass.indexOf("searchNext") > -1 || !!eRel) return;
  478. if (!$(e.target).parents("[rel]").length && !$(e.target).parents("#overlayDiv").length) {
  479. apiContent.overlayClose();
  480. }
  481. },
  482. overlayClose: function() {
  483. var o = apiContent.overlayDiv;
  484. o.stop();
  485. apiContent.clearSelectedNode();
  486. if (ie) {
  487. o.hide();
  488. } else {
  489. setTimeout(function() {o.fadeTo("fast", 0, function(){o.hide();})}, 200);
  490. }
  491. $(document).unbind("click", apiContent.overlayAutoClose);
  492. },
  493. overlayShow: function(target, isSameNode) {
  494. var w = $(window), o = apiContent.overlayDiv, a = apiContent.overlayArrow,
  495. oc = apiContent.overlayContent, c = apiContent.contentBoxDiv,
  496. t = target.offset().top - 30,
  497. cMaxLeft = c.offset().left + c.outerWidth({margin:true}) - o.outerWidth({margin:true}) - 10,
  498. l = Math.min(cMaxLeft, target.offset().left + target.width() + 40),
  499. arrowT = target.offset().top + 16,
  500. wMinTop = 100, footerHeight = 50, onlyFade = false,
  501. wHeight = w.height(), wScrollTop=w.scrollTop(), wMaxTop = wHeight + wScrollTop - footerHeight;
  502. if (!apiContent.overlayMaxTop) {
  503. apiContent.overlayMaxTop = apiContent.contentBoxDiv.offset().top + apiContent.contentBoxDiv.height();
  504. }
  505. o.stop();
  506. if (o.css("display") !== "block") {
  507. o.css({top: t, left: l});
  508. a.css({top:arrowT - t});
  509. $(document).bind("click", apiContent.overlayAutoClose);
  510. }
  511. if (ie) {
  512. onlyFade = true;
  513. o.show();
  514. } else {
  515. o.fadeTo("fast", 1);
  516. }
  517. var h = apiContent.tmpDiv.outerHeight({margin:true}) + apiContent.overlaySearch.outerHeight();
  518. if ((t + h) > wMaxTop) {
  519. t = wMaxTop - h;
  520. }
  521. if ((t + h) > apiContent.overlayMaxTop) {
  522. t = apiContent.overlayMaxTop - h;
  523. }
  524. t = Math.max(t, wScrollTop, wMinTop);
  525. if ((t + h) > ($("body").height()-footerHeight-20)) {
  526. o.css("padding-bottom", footerHeight + "px");
  527. } else {
  528. o.css("padding-bottom", "0");
  529. }
  530. apiContent.overlayDetailDiv.empty();
  531. apiContent.overlayDetailDiv.append(apiContent.tmpDiv.children());
  532. if (!onlyFade) {
  533. onlyFade = (isSameNode && t === parseInt(o.css("top").replace("px", "")));
  534. }
  535. a.removeClass("reverse");
  536. if ( (arrowT - t) > (h-55) ) {
  537. a.addClass("reverse");
  538. arrowT -= 55;
  539. }
  540. if (onlyFade) {
  541. o.css({top: t, left: l});
  542. oc.css({height: h});
  543. a.css({top:arrowT - t});
  544. } else {
  545. o.animate({top: t, left: l}, {duration: "normal",easing: "swing", complete:null});
  546. oc.animate({height: h}, {duration: "fast",easing: "swing", complete:null});
  547. a.animate({top:arrowT - t}, {duration: "normal",easing: "linear", complete:null});
  548. }
  549. },
  550. overlayAjax: function(treeId, node) {
  551. var o = $("#" + node.tId + "_a");
  552. if (node.isAjax) return;
  553. node.isAjax = true;
  554. $.ajax({
  555. type: "get",
  556. url: "" + lang + "/" + node.tt.replace("$.", "") + ".html",
  557. data: null,
  558. dataType: "text",
  559. success: function(msg) {
  560. if (!apiContent.tmpDiv) {
  561. var tmpDiv = $(document.createElement("div"));
  562. tmpDiv.addClass("baby_overlay_tmp");
  563. $("body").append(tmpDiv)
  564. apiContent.tmpDiv = $(document.createElement("div"));
  565. apiContent.tmpDiv.addClass("details");
  566. tmpDiv.append(apiContent.tmpDiv);
  567. } else {
  568. apiContent.tmpDiv.empty();
  569. }
  570. apiContent.tmpDiv.html(msg);
  571. apiContent.overlayShow(o, false);
  572. apiContent.apiCache[node.tId] = msg;
  573. node.isAjax = false;
  574. },
  575. error: function(XMLHttpRequest, textStatus, errorThrown) {
  576. alert(ajaxMsg)
  577. if (apiContent.tmpDiv) apiContent.tmpDiv.empty();
  578. node.isAjax = false;
  579. }
  580. });
  581. }
  582. }