api.js 29 KB

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