api.js 38 KB

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