api.js 29 KB

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