3da5e19454f7095fca5be8cde91b604b6c335ce2.svn-base 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. /*
  2. * Ext JS Library 2.0 Copyright(c) 2006-2007, Ext JS, LLC. licensing@extjs.com
  3. *
  4. * http://extjs.com/license
  5. */
  6. if (typeof YAHOO == "undefined") {
  7. throw "Unable to load Ext, core YUI utilities (yahoo, dom, event) not found."
  8. }
  9. (function() {
  10. var I = YAHOO.util.Event;
  11. var J = YAHOO.util.Dom;
  12. var C = YAHOO.util.Connect;
  13. var K = YAHOO.util.Easing;
  14. var B = YAHOO.util.Anim;
  15. var G;
  16. Ext.lib.Dom = {
  17. getViewWidth : function(A) {
  18. return A ? J.getDocumentWidth() : J.getViewportWidth()
  19. },
  20. getViewHeight : function(A) {
  21. return A ? J.getDocumentHeight() : J.getViewportHeight()
  22. },
  23. isAncestor : function(A, D) {
  24. return J.isAncestor(A, D)
  25. },
  26. getRegion : function(A) {
  27. return J.getRegion(A)
  28. },
  29. getY : function(A) {
  30. return this.getXY(A)[1]
  31. },
  32. getX : function(A) {
  33. return this.getXY(A)[0]
  34. },
  35. getXY : function(E) {
  36. var D, O, Q, R, N = (document.body || document.documentElement);
  37. E = Ext.getDom(E);
  38. if (E == N) {
  39. return [0, 0]
  40. }
  41. if (E.getBoundingClientRect) {
  42. Q = E.getBoundingClientRect();
  43. R = H(document).getScroll();
  44. return [Q.left + R.left, Q.top + R.top]
  45. }
  46. var S = 0, P = 0;
  47. D = E;
  48. var A = H(E).getStyle("position") == "absolute";
  49. while (D) {
  50. S += D.offsetLeft;
  51. P += D.offsetTop;
  52. if (!A && H(D).getStyle("position") == "absolute") {
  53. A = true
  54. }
  55. if (Ext.isGecko) {
  56. O = H(D);
  57. var T = parseInt(O.getStyle("borderTopWidth"), 10) || 0;
  58. var L = parseInt(O.getStyle("borderLeftWidth"), 10) || 0;
  59. S += L;
  60. P += T;
  61. if (D != E && O.getStyle("overflow") != "visible") {
  62. S += L;
  63. P += T
  64. }
  65. }
  66. D = D.offsetParent
  67. }
  68. if (Ext.isSafari && A) {
  69. S -= N.offsetLeft;
  70. P -= N.offsetTop
  71. }
  72. if (Ext.isGecko && !A) {
  73. var M = H(N);
  74. S += parseInt(M.getStyle("borderLeftWidth"), 10) || 0;
  75. P += parseInt(M.getStyle("borderTopWidth"), 10) || 0
  76. }
  77. D = E.parentNode;
  78. while (D && D != N) {
  79. if (!Ext.isOpera
  80. || (D.tagName != "TR" && H(D).getStyle("display") != "inline")) {
  81. S -= D.scrollLeft;
  82. P -= D.scrollTop
  83. }
  84. D = D.parentNode
  85. }
  86. return [S, P]
  87. },
  88. setXY : function(A, D) {
  89. A = Ext.fly(A, "_setXY");
  90. A.position();
  91. var E = A.translatePoints(D);
  92. if (D[0] !== false) {
  93. A.dom.style.left = E.left + "px"
  94. }
  95. if (D[1] !== false) {
  96. A.dom.style.top = E.top + "px"
  97. }
  98. },
  99. setX : function(D, A) {
  100. this.setXY(D, [A, false])
  101. },
  102. setY : function(A, D) {
  103. this.setXY(A, [false, D])
  104. }
  105. };
  106. Ext.lib.Event = {
  107. getPageX : function(A) {
  108. return I.getPageX(A.browserEvent || A)
  109. },
  110. getPageY : function(A) {
  111. return I.getPageY(A.browserEvent || A)
  112. },
  113. getXY : function(A) {
  114. return I.getXY(A.browserEvent || A)
  115. },
  116. getTarget : function(A) {
  117. return I.getTarget(A.browserEvent || A)
  118. },
  119. getRelatedTarget : function(A) {
  120. return I.getRelatedTarget(A.browserEvent || A)
  121. },
  122. on : function(M, A, L, E, D) {
  123. I.on(M, A, L, E, D)
  124. },
  125. un : function(E, A, D) {
  126. I.removeListener(E, A, D)
  127. },
  128. purgeElement : function(A) {
  129. I.purgeElement(A)
  130. },
  131. preventDefault : function(A) {
  132. I.preventDefault(A.browserEvent || A)
  133. },
  134. stopPropagation : function(A) {
  135. I.stopPropagation(A.browserEvent || A)
  136. },
  137. stopEvent : function(A) {
  138. I.stopEvent(A.browserEvent || A)
  139. },
  140. onAvailable : function(L, E, D, A) {
  141. return I.onAvailable(L, E, D, A)
  142. }
  143. };
  144. Ext.lib.Ajax = {
  145. request : function(O, M, A, N, D) {
  146. if (D) {
  147. var E = D.headers;
  148. if (E) {
  149. for (var L in E) {
  150. if (E.hasOwnProperty(L)) {
  151. C.initHeader(L, E[L], false)
  152. }
  153. }
  154. }
  155. if (D.xmlData) {
  156. C.initHeader("Content-Type", "text/xml", false);
  157. O = "POST";
  158. N = D.xmlData
  159. } else {
  160. if (D.jsonData) {
  161. C.initHeader("Content-Type", "text/javascript", false);
  162. O = "POST";
  163. N = typeof D.jsonData == "object" ? Ext
  164. .encode(D.jsonData) : D.jsonData
  165. }
  166. }
  167. }
  168. return C.asyncRequest(O, M, A, N)
  169. },
  170. formRequest : function(M, L, D, N, A, E) {
  171. C.setForm(M, A, E);
  172. return C.asyncRequest(Ext.getDom(M).method || "POST", L, D, N)
  173. },
  174. isCallInProgress : function(A) {
  175. return C.isCallInProgress(A)
  176. },
  177. abort : function(A) {
  178. return C.abort(A)
  179. },
  180. serializeForm : function(A) {
  181. var D = C.setForm(A.dom || A);
  182. C.resetFormState();
  183. return D
  184. }
  185. };
  186. Ext.lib.Region = YAHOO.util.Region;
  187. Ext.lib.Point = YAHOO.util.Point;
  188. Ext.lib.Anim = {
  189. scroll : function(L, D, M, N, A, E) {
  190. this.run(L, D, M, N, A, E, YAHOO.util.Scroll)
  191. },
  192. motion : function(L, D, M, N, A, E) {
  193. this.run(L, D, M, N, A, E, YAHOO.util.Motion)
  194. },
  195. color : function(L, D, M, N, A, E) {
  196. this.run(L, D, M, N, A, E, YAHOO.util.ColorAnim)
  197. },
  198. run : function(M, D, O, P, A, L, E) {
  199. E = E || YAHOO.util.Anim;
  200. if (typeof P == "string") {
  201. P = YAHOO.util.Easing[P]
  202. }
  203. var N = new E(M, D, O, P);
  204. N.animateX(function() {
  205. Ext.callback(A, L)
  206. });
  207. return N
  208. }
  209. };
  210. function H(A) {
  211. if (!G) {
  212. G = new Ext.Element.Flyweight()
  213. }
  214. G.dom = A;
  215. return G
  216. }
  217. if (Ext.isIE) {
  218. function F() {
  219. var A = Function.prototype;
  220. delete A.createSequence;
  221. delete A.defer;
  222. delete A.createDelegate;
  223. delete A.createCallback;
  224. delete A.createInterceptor;
  225. window.detachEvent("onunload", F)
  226. }
  227. window.attachEvent("onunload", F)
  228. }
  229. if (YAHOO.util.Anim) {
  230. YAHOO.util.Anim.prototype.animateX = function(E, A) {
  231. var D = function() {
  232. this.onComplete.unsubscribe(D);
  233. if (typeof E == "function") {
  234. E.call(A || this, this)
  235. }
  236. };
  237. this.onComplete.subscribe(D, this, true);
  238. this.animate()
  239. }
  240. }
  241. if (YAHOO.util.DragDrop && Ext.dd.DragDrop) {
  242. YAHOO.util.DragDrop.defaultPadding = Ext.dd.DragDrop.defaultPadding;
  243. YAHOO.util.DragDrop.constrainTo = Ext.dd.DragDrop.constrainTo
  244. }
  245. YAHOO.util.Dom.getXY = function(A) {
  246. var D = function(E) {
  247. return Ext.lib.Dom.getXY(E)
  248. };
  249. return YAHOO.util.Dom.batch(A, D, YAHOO.util.Dom, true)
  250. };
  251. if (YAHOO.util.AnimMgr) {
  252. YAHOO.util.AnimMgr.fps = 1000
  253. }
  254. YAHOO.util.Region.prototype.adjust = function(E, D, A, L) {
  255. this.top += E;
  256. this.left += D;
  257. this.right += L;
  258. this.bottom += A;
  259. return this
  260. };
  261. YAHOO.util.Region.prototype.constrainTo = function(A) {
  262. this.top = this.top.constrain(A.top, A.bottom);
  263. this.bottom = this.bottom.constrain(A.top, A.bottom);
  264. this.left = this.left.constrain(A.left, A.right);
  265. this.right = this.right.constrain(A.left, A.right);
  266. return this
  267. }
  268. })();