api.js 30 KB

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