dfae4d3e87f483710f1753b6d4b393b0bac2e95f.svn-base 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679
  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. Ext.enableFx = true;
  7. Ext.Fx = {
  8. slideIn : function(A, C) {
  9. var B = this.getFxEl();
  10. C = C || {};
  11. B.queueFx(C, function() {
  12. A = A || "t";
  13. this.fixDisplay();
  14. var D = this.getFxRestore();
  15. var I = this.getBox();
  16. this.setSize(I);
  17. var F = this.fxWrap(D.pos, C, "hidden");
  18. var K = this.dom.style;
  19. K.visibility = "visible";
  20. K.position = "absolute";
  21. var E = function() {
  22. B.fxUnwrap(F, D.pos, C);
  23. K.width = D.width;
  24. K.height = D.height;
  25. B.afterFx(C)
  26. };
  27. var J, L = {
  28. to : [I.x, I.y]
  29. }, H = {
  30. to : I.width
  31. }, G = {
  32. to : I.height
  33. };
  34. switch (A.toLowerCase()) {
  35. case "t" :
  36. F.setSize(I.width, 0);
  37. K.left = K.bottom = "0";
  38. J = {
  39. height : G
  40. };
  41. break;
  42. case "l" :
  43. F.setSize(0, I.height);
  44. K.right = K.top = "0";
  45. J = {
  46. width : H
  47. };
  48. break;
  49. case "r" :
  50. F.setSize(0, I.height);
  51. F.setX(I.right);
  52. K.left = K.top = "0";
  53. J = {
  54. width : H,
  55. points : L
  56. };
  57. break;
  58. case "b" :
  59. F.setSize(I.width, 0);
  60. F.setY(I.bottom);
  61. K.left = K.top = "0";
  62. J = {
  63. height : G,
  64. points : L
  65. };
  66. break;
  67. case "tl" :
  68. F.setSize(0, 0);
  69. K.right = K.bottom = "0";
  70. J = {
  71. width : H,
  72. height : G
  73. };
  74. break;
  75. case "bl" :
  76. F.setSize(0, 0);
  77. F.setY(I.y + I.height);
  78. K.right = K.top = "0";
  79. J = {
  80. width : H,
  81. height : G,
  82. points : L
  83. };
  84. break;
  85. case "br" :
  86. F.setSize(0, 0);
  87. F.setXY([I.right, I.bottom]);
  88. K.left = K.top = "0";
  89. J = {
  90. width : H,
  91. height : G,
  92. points : L
  93. };
  94. break;
  95. case "tr" :
  96. F.setSize(0, 0);
  97. F.setX(I.x + I.width);
  98. K.left = K.bottom = "0";
  99. J = {
  100. width : H,
  101. height : G,
  102. points : L
  103. };
  104. break
  105. }
  106. this.dom.style.visibility = "visible";
  107. F.show();
  108. arguments.callee.anim = F.fxanim(J, C, "motion", 0.5,
  109. "easeOut", E)
  110. });
  111. return this
  112. },
  113. slideOut : function(A, C) {
  114. var B = this.getFxEl();
  115. C = C || {};
  116. B.queueFx(C, function() {
  117. A = A || "t";
  118. var I = this.getFxRestore();
  119. var D = this.getBox();
  120. this.setSize(D);
  121. var G = this.fxWrap(I.pos, C, "visible");
  122. var F = this.dom.style;
  123. F.visibility = "visible";
  124. F.position = "absolute";
  125. G.setSize(D);
  126. var J = function() {
  127. if (C.useDisplay) {
  128. B.setDisplayed(false)
  129. } else {
  130. B.hide()
  131. }
  132. B.fxUnwrap(G, I.pos, C);
  133. F.width = I.width;
  134. F.height = I.height;
  135. B.afterFx(C)
  136. };
  137. var E, H = {
  138. to : 0
  139. };
  140. switch (A.toLowerCase()) {
  141. case "t" :
  142. F.left = F.bottom = "0";
  143. E = {
  144. height : H
  145. };
  146. break;
  147. case "l" :
  148. F.right = F.top = "0";
  149. E = {
  150. width : H
  151. };
  152. break;
  153. case "r" :
  154. F.left = F.top = "0";
  155. E = {
  156. width : H,
  157. points : {
  158. to : [D.right, D.y]
  159. }
  160. };
  161. break;
  162. case "b" :
  163. F.left = F.top = "0";
  164. E = {
  165. height : H,
  166. points : {
  167. to : [D.x, D.bottom]
  168. }
  169. };
  170. break;
  171. case "tl" :
  172. F.right = F.bottom = "0";
  173. E = {
  174. width : H,
  175. height : H
  176. };
  177. break;
  178. case "bl" :
  179. F.right = F.top = "0";
  180. E = {
  181. width : H,
  182. height : H,
  183. points : {
  184. to : [D.x, D.bottom]
  185. }
  186. };
  187. break;
  188. case "br" :
  189. F.left = F.top = "0";
  190. E = {
  191. width : H,
  192. height : H,
  193. points : {
  194. to : [D.x + D.width, D.bottom]
  195. }
  196. };
  197. break;
  198. case "tr" :
  199. F.left = F.bottom = "0";
  200. E = {
  201. width : H,
  202. height : H,
  203. points : {
  204. to : [D.right, D.y]
  205. }
  206. };
  207. break
  208. }
  209. arguments.callee.anim = G.fxanim(E, C, "motion", 0.5,
  210. "easeOut", J)
  211. });
  212. return this
  213. },
  214. puff : function(B) {
  215. var A = this.getFxEl();
  216. B = B || {};
  217. A.queueFx(B, function() {
  218. this.clearOpacity();
  219. this.show();
  220. var F = this.getFxRestore();
  221. var D = this.dom.style;
  222. var G = function() {
  223. if (B.useDisplay) {
  224. A.setDisplayed(false)
  225. } else {
  226. A.hide()
  227. }
  228. A.clearOpacity();
  229. A.setPositioning(F.pos);
  230. D.width = F.width;
  231. D.height = F.height;
  232. D.fontSize = "";
  233. A.afterFx(B)
  234. };
  235. var E = this.getWidth();
  236. var C = this.getHeight();
  237. arguments.callee.anim = this.fxanim({
  238. width : {
  239. to : this.adjustWidth(E * 2)
  240. },
  241. height : {
  242. to : this.adjustHeight(C * 2)
  243. },
  244. points : {
  245. by : [-(E * 0.5), -(C * 0.5)]
  246. },
  247. opacity : {
  248. to : 0
  249. },
  250. fontSize : {
  251. to : 200,
  252. unit : "%"
  253. }
  254. }, B, "motion", 0.5, "easeOut", G)
  255. });
  256. return this
  257. },
  258. switchOff : function(B) {
  259. var A = this.getFxEl();
  260. B = B || {};
  261. A.queueFx(B, function() {
  262. this.clearOpacity();
  263. this.clip();
  264. var D = this.getFxRestore();
  265. var C = this.dom.style;
  266. var E = function() {
  267. if (B.useDisplay) {
  268. A.setDisplayed(false)
  269. } else {
  270. A.hide()
  271. }
  272. A.clearOpacity();
  273. A.setPositioning(D.pos);
  274. C.width = D.width;
  275. C.height = D.height;
  276. A.afterFx(B)
  277. };
  278. this.fxanim({
  279. opacity : {
  280. to : 0.3
  281. }
  282. }, null, null, 0.1, null, function() {
  283. this.clearOpacity();
  284. (function() {
  285. this.fxanim({
  286. height : {
  287. to : 1
  288. },
  289. points : {
  290. by : [
  291. 0,
  292. this.getHeight()
  293. * 0.5]
  294. }
  295. }, B, "motion", 0.3, "easeIn", E)
  296. }).defer(100, this)
  297. })
  298. });
  299. return this
  300. },
  301. highlight : function(A, C) {
  302. var B = this.getFxEl();
  303. C = C || {};
  304. B.queueFx(C, function() {
  305. A = A || "ffff9c";
  306. var D = C.attr || "backgroundColor";
  307. this.clearOpacity();
  308. this.show();
  309. var G = this.getColor(D);
  310. var H = this.dom.style[D];
  311. var F = (C.endColor || G) || "ffffff";
  312. var I = function() {
  313. B.dom.style[D] = H;
  314. B.afterFx(C)
  315. };
  316. var E = {};
  317. E[D] = {
  318. from : A,
  319. to : F
  320. };
  321. arguments.callee.anim = this.fxanim(E, C, "color", 1,
  322. "easeIn", I)
  323. });
  324. return this
  325. },
  326. frame : function(A, C, D) {
  327. var B = this.getFxEl();
  328. D = D || {};
  329. B.queueFx(D, function() {
  330. A = A || "#C3DAF9";
  331. if (A.length == 6) {
  332. A = "#" + A
  333. }
  334. C = C || 1;
  335. var G = D.duration || 1;
  336. this.show();
  337. var E = this.getBox();
  338. var F = function() {
  339. var H = Ext.getBody().createChild({
  340. style : {
  341. visbility : "hidden",
  342. position : "absolute",
  343. "z-index" : "35000",
  344. border : "0px solid " + A
  345. }
  346. });
  347. var I = Ext.isBorderBox ? 2 : 1;
  348. H.animate({
  349. top : {
  350. from : E.y,
  351. to : E.y - 20
  352. },
  353. left : {
  354. from : E.x,
  355. to : E.x - 20
  356. },
  357. borderWidth : {
  358. from : 0,
  359. to : 10
  360. },
  361. opacity : {
  362. from : 1,
  363. to : 0
  364. },
  365. height : {
  366. from : E.height,
  367. to : (E.height + (20 * I))
  368. },
  369. width : {
  370. from : E.width,
  371. to : (E.width + (20 * I))
  372. }
  373. }, G, function() {
  374. H.remove();
  375. if (--C > 0) {
  376. F()
  377. } else {
  378. B.afterFx(D)
  379. }
  380. })
  381. };
  382. F.call(this)
  383. });
  384. return this
  385. },
  386. pause : function(C) {
  387. var A = this.getFxEl();
  388. var B = {};
  389. A.queueFx(B, function() {
  390. setTimeout(function() {
  391. A.afterFx(B)
  392. }, C * 1000)
  393. });
  394. return this
  395. },
  396. fadeIn : function(B) {
  397. var A = this.getFxEl();
  398. B = B || {};
  399. A.queueFx(B, function() {
  400. this.setOpacity(0);
  401. this.fixDisplay();
  402. this.dom.style.visibility = "visible";
  403. var C = B.endOpacity || 1;
  404. arguments.callee.anim = this.fxanim({
  405. opacity : {
  406. to : C
  407. }
  408. }, B, null, 0.5, "easeOut", function() {
  409. if (C == 1) {
  410. this.clearOpacity()
  411. }
  412. A.afterFx(B)
  413. })
  414. });
  415. return this
  416. },
  417. fadeOut : function(B) {
  418. var A = this.getFxEl();
  419. B = B || {};
  420. A.queueFx(B, function() {
  421. arguments.callee.anim = this.fxanim({
  422. opacity : {
  423. to : B.endOpacity || 0
  424. }
  425. }, B, null, 0.5, "easeOut", function() {
  426. if (this.visibilityMode == Ext.Element.DISPLAY
  427. || B.useDisplay) {
  428. this.dom.style.display = "none"
  429. } else {
  430. this.dom.style.visibility = "hidden"
  431. }
  432. this.clearOpacity();
  433. A.afterFx(B)
  434. })
  435. });
  436. return this
  437. },
  438. scale : function(A, B, C) {
  439. this.shift(Ext.apply({}, C, {
  440. width : A,
  441. height : B
  442. }));
  443. return this
  444. },
  445. shift : function(B) {
  446. var A = this.getFxEl();
  447. B = B || {};
  448. A.queueFx(B, function() {
  449. var E = {}, D = B.width, F = B.height, C = B.x, H = B.y, G = B.opacity;
  450. if (D !== undefined) {
  451. E.width = {
  452. to : this.adjustWidth(D)
  453. }
  454. }
  455. if (F !== undefined) {
  456. E.height = {
  457. to : this.adjustHeight(F)
  458. }
  459. }
  460. if (C !== undefined || H !== undefined) {
  461. E.points = {
  462. to : [C !== undefined ? C : this.getX(),
  463. H !== undefined ? H : this.getY()]
  464. }
  465. }
  466. if (G !== undefined) {
  467. E.opacity = {
  468. to : G
  469. }
  470. }
  471. if (B.xy !== undefined) {
  472. E.points = {
  473. to : B.xy
  474. }
  475. }
  476. arguments.callee.anim = this.fxanim(E, B, "motion", 0.35,
  477. "easeOut", function() {
  478. A.afterFx(B)
  479. })
  480. });
  481. return this
  482. },
  483. ghost : function(A, C) {
  484. var B = this.getFxEl();
  485. C = C || {};
  486. B.queueFx(C, function() {
  487. A = A || "b";
  488. var H = this.getFxRestore();
  489. var E = this.getWidth(), G = this.getHeight();
  490. var F = this.dom.style;
  491. var J = function() {
  492. if (C.useDisplay) {
  493. B.setDisplayed(false)
  494. } else {
  495. B.hide()
  496. }
  497. B.clearOpacity();
  498. B.setPositioning(H.pos);
  499. F.width = H.width;
  500. F.height = H.height;
  501. B.afterFx(C)
  502. };
  503. var D = {
  504. opacity : {
  505. to : 0
  506. },
  507. points : {}
  508. }, I = D.points;
  509. switch (A.toLowerCase()) {
  510. case "t" :
  511. I.by = [0, -G];
  512. break;
  513. case "l" :
  514. I.by = [-E, 0];
  515. break;
  516. case "r" :
  517. I.by = [E, 0];
  518. break;
  519. case "b" :
  520. I.by = [0, G];
  521. break;
  522. case "tl" :
  523. I.by = [-E, -G];
  524. break;
  525. case "bl" :
  526. I.by = [-E, G];
  527. break;
  528. case "br" :
  529. I.by = [E, G];
  530. break;
  531. case "tr" :
  532. I.by = [E, -G];
  533. break
  534. }
  535. arguments.callee.anim = this.fxanim(D, C, "motion", 0.5,
  536. "easeOut", J)
  537. });
  538. return this
  539. },
  540. syncFx : function() {
  541. this.fxDefaults = Ext.apply(this.fxDefaults || {}, {
  542. block : false,
  543. concurrent : true,
  544. stopFx : false
  545. });
  546. return this
  547. },
  548. sequenceFx : function() {
  549. this.fxDefaults = Ext.apply(this.fxDefaults || {}, {
  550. block : false,
  551. concurrent : false,
  552. stopFx : false
  553. });
  554. return this
  555. },
  556. nextFx : function() {
  557. var A = this.fxQueue[0];
  558. if (A) {
  559. A.call(this)
  560. }
  561. },
  562. hasActiveFx : function() {
  563. return this.fxQueue && this.fxQueue[0]
  564. },
  565. stopFx : function() {
  566. if (this.hasActiveFx()) {
  567. var A = this.fxQueue[0];
  568. if (A && A.anim && A.anim.isAnimated()) {
  569. this.fxQueue = [A];
  570. A.anim.stop(true)
  571. }
  572. }
  573. return this
  574. },
  575. beforeFx : function(A) {
  576. if (this.hasActiveFx() && !A.concurrent) {
  577. if (A.stopFx) {
  578. this.stopFx();
  579. return true
  580. }
  581. return false
  582. }
  583. return true
  584. },
  585. hasFxBlock : function() {
  586. var A = this.fxQueue;
  587. return A && A[0] && A[0].block
  588. },
  589. queueFx : function(C, A) {
  590. if (!this.fxQueue) {
  591. this.fxQueue = []
  592. }
  593. if (!this.hasFxBlock()) {
  594. Ext.applyIf(C, this.fxDefaults);
  595. if (!C.concurrent) {
  596. var B = this.beforeFx(C);
  597. A.block = C.block;
  598. this.fxQueue.push(A);
  599. if (B) {
  600. this.nextFx()
  601. }
  602. } else {
  603. A.call(this)
  604. }
  605. }
  606. return this
  607. },
  608. fxWrap : function(F, D, C) {
  609. var B;
  610. if (!D.wrap || !(B = Ext.get(D.wrap))) {
  611. var A;
  612. if (D.fixPosition) {
  613. A = this.getXY()
  614. }
  615. var E = document.createElement("div");
  616. E.style.visibility = C;
  617. B = Ext.get(this.dom.parentNode.insertBefore(E, this.dom));
  618. B.setPositioning(F);
  619. if (B.getStyle("position") == "static") {
  620. B.position("relative")
  621. }
  622. this.clearPositioning("auto");
  623. B.clip();
  624. B.dom.appendChild(this.dom);
  625. if (A) {
  626. B.setXY(A)
  627. }
  628. }
  629. return B
  630. },
  631. fxUnwrap : function(A, C, B) {
  632. this.clearPositioning();
  633. this.setPositioning(C);
  634. if (!B.wrap) {
  635. A.dom.parentNode.insertBefore(this.dom, A.dom);
  636. A.remove()
  637. }
  638. },
  639. getFxRestore : function() {
  640. var A = this.dom.style;
  641. return {
  642. pos : this.getPositioning(),
  643. width : A.width,
  644. height : A.height
  645. }
  646. },
  647. afterFx : function(A) {
  648. if (A.afterStyle) {
  649. this.applyStyles(A.afterStyle)
  650. }
  651. if (A.afterCls) {
  652. this.addClass(A.afterCls)
  653. }
  654. if (A.remove === true) {
  655. this.remove()
  656. }
  657. Ext.callback(A.callback, A.scope, [this]);
  658. if (!A.concurrent) {
  659. this.fxQueue.shift();
  660. this.nextFx()
  661. }
  662. },
  663. getFxEl : function() {
  664. return Ext.get(this.dom)
  665. },
  666. fxanim : function(D, E, B, F, C, A) {
  667. B = B || "run";
  668. E = E || {};
  669. var G = Ext.lib.Anim[B](this.dom, D, (E.duration || F) || 0.35,
  670. (E.easing || C) || "easeOut", function() {
  671. Ext.callback(A, this)
  672. }, this);
  673. E.anim = G;
  674. return G
  675. }
  676. };
  677. Ext.Fx.resize = Ext.Fx.scale;
  678. Ext.apply(Ext.Element.prototype, Ext.Fx);