You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3351 lines
111 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
2 years ago
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
2 years ago
​
​
2 years ago
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. This file is part of Ext JS 3.4
  3. Copyright (c) 2011-2013 Sencha Inc
  4. Contact: http://www.sencha.com/contact
  5. GNU General Public License Usage
  6. This file may be used under the terms of the GNU General Public License version 3.0 as
  7. published by the Free Software Foundation and appearing in the file LICENSE included in the
  8. packaging of this file.
  9. Please review the following information to ensure the GNU General Public License version 3.0
  10. requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  11. If you are unsure which license is appropriate for your use, please contact the sales department
  12. at http://www.sencha.com/contact.
  13. Build date: 2013-04-03 15:07:25
  14. */
  15. // for old browsers
  16. window.undefined = window.undefined;
  17. /**
  18. * @class Ext
  19. * Ext core utilities and functions.
  20. * @singleton
  21. */
  22. Ext = {
  23. /**
  24. * The version of the framework
  25. * @type String
  26. */
  27. version : '3.4.1.1',
  28. versionDetail : {
  29. major : 3,
  30. minor : 4,
  31. patch : 1.1
  32. }
  33. };
  34. /**
  35. * Copies all the properties of config to obj.
  36. * @param {Object} obj The receiver of the properties
  37. * @param {Object} config The source of the properties
  38. * @param {Object} defaults A different object that will also be applied for default values
  39. * @return {Object} returns obj
  40. * @member Ext apply
  41. */
  42. Ext.apply = function(o, c, defaults){
  43. // no "this" reference for friendly out of scope calls
  44. if(defaults){
  45. Ext.apply(o, defaults);
  46. }
  47. if(o && c && typeof c == 'object'){
  48. for(var p in c){
  49. o[p] = c[p];
  50. }
  51. }
  52. return o;
  53. };
  54. (function(){
  55. var idSeed = 0,
  56. toString = Object.prototype.toString,
  57. ua = navigator.userAgent.toLowerCase(),
  58. check = function(r){
  59. return r.test(ua);
  60. },
  61. DOC = document,
  62. docMode = DOC.documentMode,
  63. isStrict = DOC.compatMode == "CSS1Compat",
  64. isOpera = check(/opera/),
  65. isChrome = check(/\bchrome\b/),
  66. isWebKit = check(/webkit/),
  67. isSafari = !isChrome && check(/safari/),
  68. isSafari2 = isSafari && check(/applewebkit\/4/), // unique to Safari 2
  69. isSafari3 = isSafari && check(/version\/3/),
  70. isSafari4 = isSafari && check(/version\/4/),
  71. isIE = !isOpera && check(/msie/),
  72. isIE7 = isIE && ((check(/msie 7/) && docMode != 8 && docMode != 9 && docMode != 10) || docMode == 7),
  73. isIE8 = isIE && ((check(/msie 8/) && docMode != 7 && docMode != 9 && docMode != 10) || docMode == 8),
  74. isIE9 = isIE && ((check(/msie 9/) && docMode != 7 && docMode != 8 && docMode != 10) || docMode == 9),
  75. isIE10 = isIE && ((check(/msie 10/) && docMode != 7 && docMode != 8 && docMode != 9) || docMode == 10),
  76. isIE6 = isIE && check(/msie 6/),
  77. isIE9m = isIE && (isIE6 || isIE7 || isIE8 || isIE9),
  78. isGecko = !isWebKit && check(/gecko/),
  79. isGecko2 = isGecko && check(/rv:1\.8/),
  80. isGecko3 = isGecko && check(/rv:1\.9/),
  81. isBorderBox = isIE9m && !isStrict,
  82. isWindows = check(/windows|win32/),
  83. isMac = check(/macintosh|mac os x/),
  84. isAir = check(/adobeair/),
  85. isLinux = check(/linux/),
  86. isSecure = /^https/i.test(window.location.protocol),
  87. noArgs = [],
  88. nonEnumerables = [],
  89. emptyFn = Ext.emptyFn,
  90. t = Ext.apply({}, {
  91. constructor: emptyFn,
  92. toString: emptyFn,
  93. valueOf: emptyFn
  94. }),
  95. callOverrideParent = function () {
  96. var method = callOverrideParent.caller.caller; // skip callParent (our caller)
  97. return method.$owner.prototype[method.$name].apply(this, arguments);
  98. };
  99. if (t.constructor !== emptyFn) {
  100. nonEnumerables.push('constructor');
  101. }
  102. if (t.toString !== emptyFn) {
  103. nonEnumerables.push('toString');
  104. }
  105. if (t.valueOf !== emptyFn) {
  106. nonEnumerables.push('valueOf');
  107. }
  108. if (!nonEnumerables.length) {
  109. nonEnumerables = null;
  110. }
  111. // Create the abstract Base class to provide an empty constructor and callParent implementations
  112. function Base () {
  113. //
  114. }
  115. Ext.apply(Base, {
  116. $isClass: true,
  117. callParent: function (args) {
  118. var method;
  119. // This code is intentionally inlined for the least number of debugger stepping
  120. return (method = this.callParent.caller) && (method.$previous ||
  121. ((method = method.$owner ? method : method.caller) &&
  122. method.$owner.superclass.self[method.$name])).apply(this, args || noArgs);
  123. }
  124. });
  125. Base.prototype = {
  126. constructor: function() {
  127. },
  128. callParent: function(args) {
  129. // NOTE: this code is deliberately as few expressions (and no function calls)
  130. // as possible so that a debugger can skip over this noise with the minimum number
  131. // of steps. Basically, just hit Step Into until you are where you really wanted
  132. // to be.
  133. var method,
  134. superMethod = (method = this.callParent.caller) && (method.$previous ||
  135. ((method = method.$owner ? method : method.caller) &&
  136. method.$owner.superclass[method.$name]));
  137. return superMethod.apply(this, args || noArgs);
  138. }
  139. };
  140. // remove css image flicker
  141. if(isIE6){
  142. try{
  143. DOC.execCommand("BackgroundImageCache", false, true);
  144. }catch(e){}
  145. }
  146. Ext.apply(Ext, {
  147. /**
  148. * URL to a blank file used by Ext when in secure mode for iframe src and onReady src to prevent
  149. * the IE insecure content warning (<tt>'about:blank'</tt>, except for IE in secure mode, which is <tt>'javascript:""'</tt>).
  150. * @type String
  151. */
  152. SSL_SECURE_URL : isSecure && isIE ? 'javascript:""' : 'about:blank',
  153. /**
  154. * True if the browser is in strict (standards-compliant) mode, as opposed to quirks mode
  155. * @type Boolean
  156. */
  157. isStrict : isStrict,
  158. /**
  159. * True if the page is running over SSL
  160. * @type Boolean
  161. */
  162. isSecure : isSecure,
  163. /**
  164. * True when the document is fully initialized and ready for action
  165. * @type Boolean
  166. */
  167. isReady : false,
  168. /**
  169. * True if the {@link Ext.Fx} Class is available
  170. * @type Boolean
  171. * @property enableFx
  172. */
  173. /**
  174. * HIGHLY EXPERIMENTAL
  175. * True to force css based border-box model override and turning off javascript based adjustments. This is a
  176. * runtime configuration and must be set before onReady.
  177. * @type Boolean
  178. */
  179. enableForcedBoxModel : false,
  180. /**
  181. * True to automatically uncache orphaned Ext.Elements periodically (defaults to true)
  182. * @type Boolean
  183. */
  184. enableGarbageCollector : true,
  185. /**
  186. * True to automatically purge event listeners during garbageCollection (defaults to false).
  187. * @type Boolean
  188. */
  189. enableListenerCollection : false,
  190. /**
  191. * EXPERIMENTAL - True to cascade listener removal to child elements when an element is removed.
  192. * Currently not optimized for performance.
  193. * @type Boolean
  194. */
  195. enableNestedListenerRemoval : false,
  196. /**
  197. * Indicates whether to use native browser parsing for JSON methods.
  198. * This option is ignored if the browser does not support native JSON methods.
  199. * <b>Note: Native JSON methods will not work with objects that have functions.
  200. * Also, property names must be quoted, otherwise the data will not parse.</b> (Defaults to false)
  201. * @type Boolean
  202. */
  203. USE_NATIVE_JSON : false,
  204. /**
  205. * Copies all the properties of config to obj if they don't already exist.
  206. * @param {Object} obj The receiver of the properties
  207. * @param {Object} config The source of the properties
  208. * @return {Object} returns obj
  209. */
  210. applyIf : function(o, c){
  211. if(o){
  212. for(var p in c){
  213. if(!Ext.isDefined(o[p])){
  214. o[p] = c[p];
  215. }
  216. }
  217. }
  218. return o;
  219. },
  220. /**
  221. * Generates unique ids. If the element already has an id, it is unchanged
  222. * @param {Mixed} el (optional) The element to generate an id for
  223. * @param {String} prefix (optional) Id prefix (defaults "ext-gen")
  224. * @return {String} The generated Id.
  225. */
  226. id : function(el, prefix){
  227. el = Ext.getDom(el, true) || {};
  228. if (!el.id) {
  229. el.id = (prefix || "ext-gen") + (++idSeed);
  230. }
  231. return el.id;
  232. },
  233. /**
  234. * <p>Extends one class to create a subclass and optionally overrides members with the passed literal. This method
  235. * also adds the function "override()" to the subclass that can be used to override members of the class.</p>
  236. * For example, to create a subclass of Ext GridPanel:
  237. * <pre><code>
  238. MyGridPanel = Ext.extend(Ext.grid.GridPanel, {
  239. constructor: function(config) {
  240. // Create configuration for this Grid.
  241. var store = new Ext.data.Store({...});
  242. var colModel = new Ext.grid.ColumnModel({...});
  243. // Create a new config object containing our computed properties
  244. // *plus* whatever was in the config parameter.
  245. config = Ext.apply({
  246. store: store,
  247. colModel: colModel
  248. }, config);
  249. MyGridPanel.superclass.constructor.call(this, config);
  250. // Your postprocessing here
  251. },
  252. yourMethod: function() {
  253. // etc.
  254. }
  255. });
  256. </code></pre>
  257. *
  258. * <p>This function also supports a 3-argument call in which the subclass's constructor is
  259. * passed as an argument. In this form, the parameters are as follows:</p>
  260. * <div class="mdetail-params"><ul>
  261. * <li><code>subclass</code> : Function <div class="sub-desc">The subclass constructor.</div></li>
  262. * <li><code>superclass</code> : Function <div class="sub-desc">The constructor of class being extended</div></li>
  263. * <li><code>overrides</code> : Object <div class="sub-desc">A literal with members which are copied into the subclass's
  264. * prototype, and are therefore shared among all instances of the new class.</div></li>
  265. * </ul></div>
  266. *
  267. * @param {Function} superclass The constructor of class being extended.
  268. * @param {Object} overrides <p>A literal with members which are copied into the subclass's
  269. * prototype, and are therefore shared between all instances of the new class.</p>
  270. * <p>This may contain a special member named <tt><b>constructor</b></tt>. This is used
  271. * to define the constructor of the new class, and is returned. If this property is
  272. * <i>not</i> specified, a constructor is generated and returned which just calls the
  273. * superclass's constructor passing on its parameters.</p>
  274. * <p><b>It is essential that you call the superclass constructor in any provided constructor. See example code.</b></p>
  275. * @return {Function} The subclass constructor from the <code>overrides</code> parameter, or a generated one if not provided.
  276. */
  277. extend : function(){
  278. // inline overrides
  279. var io = function(o){
  280. for(var m in o){
  281. this[m] = o[m];
  282. }
  283. };
  284. var oc = Object.prototype.constructor;
  285. return function(sb, sp, overrides){
  286. if(typeof sp == 'object'){
  287. overrides = sp;
  288. sp = sb;
  289. sb = overrides.constructor != oc ? overrides.constructor : function(){sp.apply(this, arguments);};
  290. }
  291. var F = function(){},
  292. sbp,
  293. spp = sp.prototype;
  294. F.prototype = spp;
  295. sbp = sb.prototype = new F();
  296. sbp.constructor=sb;
  297. sb.superclass=spp;
  298. if(spp.constructor == oc){
  299. spp.constructor=sp;
  300. }
  301. sb.override = function(o){
  302. Ext.override(sb, o);
  303. };
  304. sbp.superclass = sbp.supr = (function(){
  305. return spp;
  306. });
  307. sbp.override = io;
  308. Ext.override(sb, overrides);
  309. sb.extend = function(o){return Ext.extend(sb, o);};
  310. return sb;
  311. };
  312. }(),
  313. global: (function () {
  314. return this;
  315. })(),
  316. Base: Base,
  317. namespaceCache: {},
  318. createNamespace: function (namespaceOrClass, isClass) {
  319. var cache = Ext.namespaceCache,
  320. namespace = isClass ? namespaceOrClass.substring(0, namespaceOrClass.lastIndexOf('.'))
  321. : namespaceOrClass,
  322. ns = cache[namespace],
  323. i, n, part, parts, partials;
  324. if (!ns) {
  325. ns = Ext.global;
  326. if (namespace) {
  327. partials = [];
  328. parts = namespace.split('.');
  329. for (i = 0, n = parts.length; i < n; ++i) {
  330. part = parts[i];
  331. ns = ns[part] || (ns[part] = {});
  332. partials.push(part);
  333. cache[partials.join('.')] = ns; // build up prefixes as we go
  334. }
  335. }
  336. }
  337. return ns;
  338. },
  339. getClassByName: function (className) {
  340. var parts = className.split('.'),
  341. cls = Ext.global,
  342. n = parts.length,
  343. i;
  344. for (i = 0; cls && i < n; ++i) {
  345. cls = cls[parts[i]];
  346. }
  347. return cls || null;
  348. },
  349. addMembers: function (cls, target, members, handleNonEnumerables) {
  350. var i, name, member;
  351. for (name in members) {
  352. if (members.hasOwnProperty(name)) {
  353. member = members[name];
  354. if (typeof member == 'function') {
  355. member.$owner = cls;
  356. member.$name = name;
  357. }
  358. target[name] = member;
  359. }
  360. }
  361. if (handleNonEnumerables && nonEnumerables) {
  362. for (i = nonEnumerables.length; i-- > 0; ) {
  363. name = nonEnumerables[i];
  364. if (members.hasOwnProperty(name)) {
  365. member = members[name];
  366. if (typeof member == 'function') {
  367. member.$owner = cls;
  368. member.$name = name;
  369. }
  370. target[name] = member;
  371. }
  372. }
  373. }
  374. },
  375. /**
  376. * @method
  377. * Defines a class or override. A basic class is defined like this:
  378. *
  379. * Ext.define('My.awesome.Class', {
  380. * someProperty: 'something',
  381. *
  382. * someMethod: function(s) {
  383. * alert(s + this.someProperty);
  384. * }
  385. *
  386. * ...
  387. * });
  388. *
  389. * var obj = new My.awesome.Class();
  390. *
  391. * obj.someMethod('Say '); // alerts 'Say something'
  392. *
  393. * To create an anonymous class, pass `null` for the `className`:
  394. *
  395. * Ext.define(null, {
  396. * constructor: function () {
  397. * // ...
  398. * }
  399. * });
  400. *
  401. * In some cases, it is helpful to create a nested scope to contain some private
  402. * properties. The best way to do this is to pass a function instead of an object
  403. * as the second parameter. This function will be called to produce the class
  404. * body:
  405. *
  406. * Ext.define('MyApp.foo.Bar', function () {
  407. * var id = 0;
  408. *
  409. * return {
  410. * nextId: function () {
  411. * return ++id;
  412. * }
  413. * };
  414. * });
  415. *
  416. * When using this form of `Ext.define`, the function is passed a reference to its
  417. * class. This can be used as an efficient way to access any static properties you
  418. * may have:
  419. *
  420. * Ext.define('MyApp.foo.Bar', function (Bar) {
  421. * return {
  422. * statics: {
  423. * staticMethod: function () {
  424. * // ...
  425. * }
  426. * },
  427. *
  428. * method: function () {
  429. * return Bar.staticMethod();
  430. * }
  431. * };
  432. * });
  433. *
  434. * To define an override, include the `override` property. The content of an
  435. * override is aggregated with the specified class in order to extend or modify
  436. * that class. This can be as simple as setting default property values or it can
  437. * extend and/or replace methods. This can also extend the statics of the class.
  438. *
  439. * One use for an override is to break a large class into manageable pieces.
  440. *
  441. * // File: /src/app/Panel.js
  442. *
  443. * Ext.define('My.app.Panel', {
  444. * extend: 'Ext.panel.Panel',
  445. *
  446. * constructor: function (config) {
  447. * this.callParent(arguments); // calls Ext.panel.Panel's constructor
  448. * //...
  449. * },
  450. *
  451. * statics: {
  452. * method: function () {
  453. * return 'abc';
  454. * }
  455. * }
  456. * });
  457. *
  458. * // File: /src/app/PanelPart2.js
  459. * Ext.define('My.app.PanelPart2', {
  460. * override: 'My.app.Panel',
  461. *
  462. * constructor: function (config) {
  463. * this.callParent(arguments); // calls My.app.Panel's constructor
  464. * //...
  465. * }
  466. * });
  467. *
  468. * Another use of overrides is to provide optional parts of classes that can be
  469. * independently required. In this case, the class may even be unaware of the
  470. * override altogether.
  471. *
  472. * Ext.define('My.ux.CoolTip', {
  473. * override: 'Ext.tip.ToolTip',
  474. *
  475. * constructor: function (config) {
  476. * this.callParent(arguments); // calls Ext.tip.ToolTip's constructor
  477. * //...
  478. * }
  479. * });
  480. *
  481. * Overrides can also contain statics:
  482. *
  483. * Ext.define('My.app.BarMod', {
  484. * override: 'Ext.foo.Bar',
  485. *
  486. * statics: {
  487. * method: function (x) {
  488. * return this.callParent([x * 2]); // call Ext.foo.Bar.method
  489. * }
  490. * }
  491. * });
  492. *
  493. * @param {String} className The class name to create in string dot-namespaced format, for example:
  494. * 'My.very.awesome.Class', 'FeedViewer.plugin.CoolPager'
  495. * It is highly recommended to follow this simple convention:
  496. * - The root and the class name are 'CamelCased'
  497. * - Everything else is lower-cased
  498. * Pass `null` to create an anonymous class.
  499. * @param {Object} data The key - value pairs of properties to apply to this class. Property names can be of any valid
  500. * strings, except those in the reserved listed below:
  501. * - `mixins`
  502. * - `statics`
  503. * - `config`
  504. * - `alias`
  505. * - `self`
  506. * - `singleton`
  507. * - `alternateClassName`
  508. * - `override`
  509. *
  510. * @param {Function} createdFn Optional callback to execute after the class is created, the execution scope of which
  511. * (`this`) will be the newly created class itself.
  512. * @return {Ext.Base}
  513. * @markdown
  514. * @member Ext
  515. * @method define
  516. */
  517. define: function (className, body, createdFn) {
  518. var override = body.override,
  519. cls, extend, name, namespace;
  520. if (override) {
  521. delete body.override;
  522. cls = Ext.getClassByName(override);
  523. Ext.override(cls, body);
  524. } else {
  525. if (className) {
  526. namespace = Ext.createNamespace(className, true);
  527. name = className.substring(className.lastIndexOf('.')+1);
  528. }
  529. cls = function ctor () {
  530. this.constructor.apply(this, arguments);
  531. }
  532. if (className) {
  533. cls.displayName = className;
  534. }
  535. cls.$isClass = true;
  536. cls.callParent = Ext.Base.callParent;
  537. if (typeof body == 'function') {
  538. body = body(cls);
  539. }
  540. extend = body.extend;
  541. if (extend) {
  542. delete body.extend;
  543. if (typeof extend == 'string') {
  544. extend = Ext.getClassByName(extend);
  545. }
  546. } else {
  547. extend = Base;
  548. }
  549. Ext.extend(cls, extend, body);
  550. if (cls.prototype.constructor === cls) {
  551. delete cls.prototype.constructor;
  552. }
  553. // Not extending a class which derives from Base...
  554. if (!cls.prototype.$isClass) {
  555. Ext.applyIf(cls.prototype, Base.prototype);
  556. }
  557. cls.prototype.self = cls;
  558. if (body.xtype) {
  559. Ext.reg(body.xtype, cls);
  560. }
  561. cls = body.singleton ? new cls() : cls;
  562. if (className) {
  563. namespace[name] = cls;
  564. }
  565. }
  566. if (createdFn) {
  567. createdFn.call(cls);
  568. }
  569. return cls;
  570. },
  571. /**
  572. * Overrides members of the specified `target` with the given values.
  573. *
  574. * If the `target` is a function, it is assumed to be a constructor and the contents
  575. * of `overrides` are applied to its `prototype` using {@link Ext#apply Ext.apply}.
  576. *
  577. * If the `target` is an instance of a class created using {@link #define},
  578. * the `overrides` are applied to only that instance. In this case, methods are
  579. * specially processed to allow them to use {@link Ext.Base#callParent}.
  580. *
  581. * var panel = new Ext.Panel({ ... });
  582. *
  583. * Ext.override(panel, {
  584. * initComponent: function () {
  585. * // extra processing...
  586. *
  587. * this.callParent();
  588. * }
  589. * });
  590. *
  591. * If the `target` is none of these, the `overrides` are applied to the `target`
  592. * using {@link Ext#apply Ext.apply}.
  593. *
  594. * Please refer to {@link Ext#define Ext.define} for further details.
  595. *
  596. * @param {Object} target The target to override.
  597. * @param {Object} overrides The properties to add or replace on `target`.
  598. * @method override
  599. */
  600. override: function (target, overrides) {
  601. var proto, statics;
  602. if (overrides) {
  603. if (target.$isClass) {
  604. statics = overrides.statics;
  605. if (statics) {
  606. delete overrides.statics;
  607. }
  608. Ext.addMembers(target, target.prototype, overrides, true);
  609. if (statics) {
  610. Ext.addMembers(target, target, statics);
  611. }
  612. } else if (typeof target == 'function') {
  613. proto = target.prototype;
  614. Ext.apply(proto, overrides);
  615. if(Ext.isIE && overrides.hasOwnProperty('toString')){
  616. proto.toString = overrides.toString;
  617. }
  618. } else {
  619. var owner = target.self,
  620. name, value;
  621. if (owner && owner.$isClass) {
  622. for (name in overrides) {
  623. if (overrides.hasOwnProperty(name)) {
  624. value = overrides[name];
  625. if (typeof value == 'function') {
  626. //<debug>
  627. if (owner.$className) {
  628. value.displayName = owner.$className + '#' + name;
  629. }
  630. //</debug>
  631. value.$name = name;
  632. value.$owner = owner;
  633. value.$previous = target.hasOwnProperty(name)
  634. ? target[name] // already hooked, so call previous hook
  635. : callOverrideParent; // calls by name on prototype
  636. }
  637. target[name] = value;
  638. }
  639. }
  640. } else {
  641. Ext.apply(target, overrides);
  642. if (!target.constructor.$isClass) {
  643. target.constructor.prototype.callParent = Base.prototype.callParent;
  644. target.constructor.callParent = Base.callParent;
  645. }
  646. }
  647. }
  648. }
  649. },
  650. /**
  651. * Creates namespaces to be used for scoping variables and classes so that they are not global.
  652. * Specifying the last node of a namespace implicitly creates all other nodes. Usage:
  653. * <pre><code>
  654. Ext.namespace('Company', 'Company.data');
  655. Ext.namespace('Company.data'); // equivalent and preferable to above syntax
  656. Company.Widget = function() { ... }
  657. Company.data.CustomStore = function(config) { ... }
  658. </code></pre>
  659. * @param {String} namespace1
  660. * @param {String} namespace2
  661. * @param {String} etc
  662. * @return {Object} The namespace object. (If multiple arguments are passed, this will be the last namespace created)
  663. * @method namespace
  664. */
  665. namespace : function(){
  666. var len1 = arguments.length,
  667. i = 0,
  668. len2,
  669. j,
  670. main,
  671. ns,
  672. sub,
  673. current;
  674. for(; i < len1; ++i) {
  675. main = arguments[i];
  676. ns = arguments[i].split('.');
  677. current = window[ns[0]];
  678. if (current === undefined) {
  679. current = window[ns[0]] = {};
  680. }
  681. sub = ns.slice(1);
  682. len2 = sub.length;
  683. for(j = 0; j < len2; ++j) {
  684. current = current[sub[j]] = current[sub[j]] || {};
  685. }
  686. }
  687. return current;
  688. },
  689. /**
  690. * Takes an object and converts it to an encoded URL. e.g. Ext.urlEncode({foo: 1, bar: 2}); would return "foo=1&bar=2". Optionally, property values can be arrays, instead of keys and the resulting string that's returned will contain a name/value pair for each array value.
  691. * @param {Object} o
  692. * @param {String} pre (optional) A prefix to add to the url encoded string
  693. * @return {String}
  694. */
  695. urlEncode : function(o, pre){
  696. var empty,
  697. buf = [],
  698. e = encodeURIComponent;
  699. Ext.iterate(o, function(key, item){
  700. empty = Ext.isEmpty(item);
  701. Ext.each(empty ? key : item, function(val){
  702. buf.push('&', e(key), '=', (!Ext.isEmpty(val) && (val != key || !empty)) ? (Ext.isDate(val) ? Ext.encode(val).replace(/"/g, '') : e(val)) : '');
  703. });
  704. });
  705. if(!pre){
  706. buf.shift();
  707. pre = '';
  708. }
  709. return pre + buf.join('');
  710. },
  711. /**
  712. * Takes an encoded URL and and converts it to an object. Example: <pre><code>
  713. Ext.urlDecode("foo=1&bar=2"); // returns {foo: "1", bar: "2"}
  714. Ext.urlDecode("foo=1&bar=2&bar=3&bar=4", false); // returns {foo: "1", bar: ["2", "3", "4"]}
  715. </code></pre>
  716. * @param {String} string
  717. * @param {Boolean} overwrite (optional) Items of the same name will overwrite previous values instead of creating an an array (Defaults to false).
  718. * @return {Object} A literal with members
  719. */
  720. urlDecode : function(string, overwrite){
  721. if(Ext.isEmpty(string)){
  722. return {};
  723. }
  724. var obj = {},
  725. pairs = string.split('&'),
  726. d = decodeURIComponent,
  727. name,
  728. value;
  729. Ext.each(pairs, function(pair) {
  730. pair = pair.split('=');
  731. name = d(pair[0]);
  732. value = d(pair[1]);
  733. obj[name] = overwrite || !obj[name] ? value :
  734. [].concat(obj[name]).concat(value);
  735. });
  736. return obj;
  737. },
  738. /**
  739. * Appends content to the query string of a URL, handling logic for whether to place
  740. * a question mark or ampersand.
  741. * @param {String} url The URL to append to.
  742. * @param {String} s The content to append to the URL.
  743. * @return (String) The resulting URL
  744. */
  745. urlAppend : function(url, s){
  746. if(!Ext.isEmpty(s)){
  747. return url + (url.indexOf('?') === -1 ? '?' : '&') + s;
  748. }
  749. return url;
  750. },
  751. /**
  752. * Converts any iterable (numeric indices and a length property) into a true array
  753. * Don't use this on strings. IE doesn't support "abc"[0] which this implementation depends on.
  754. * For strings, use this instead: "abc".match(/./g) => [a,b,c];
  755. * @param {Iterable} the iterable object to be turned into a true Array.
  756. * @return (Array) array
  757. */
  758. toArray : function(){
  759. return isIE ?
  760. function(a, i, j, res){
  761. res = [];
  762. for(var x = 0, len = a.length; x < len; x++) {
  763. res.push(a[x]);
  764. }
  765. return res.slice(i || 0, j || res.length);
  766. } :
  767. function(a, i, j){
  768. return Array.prototype.slice.call(a, i || 0, j || a.length);
  769. };
  770. }(),
  771. isIterable : function(v){
  772. //check for array or arguments
  773. if(Ext.isArray(v) || v.callee){
  774. return true;
  775. }
  776. //check for node list type
  777. if(/NodeList|HTMLCollection/.test(toString.call(v))){
  778. return true;
  779. }
  780. //NodeList has an item and length property
  781. //IXMLDOMNodeList has nextNode method, needs to be checked first.
  782. return ((typeof v.nextNode != 'undefined' || v.item) && Ext.isNumber(v.length));
  783. },
  784. /**
  785. * Iterates an array calling the supplied function.
  786. * @param {Array/NodeList/Mixed} array The array to be iterated. If this
  787. * argument is not really an array, the supplied function is called once.
  788. * @param {Function} fn The function to be called with each item. If the
  789. * supplied function returns false, iteration stops and this method returns
  790. * the current <code>index</code>. This function is called with
  791. * the following arguments:
  792. * <div class="mdetail-params"><ul>
  793. * <li><code>item</code> : <i>Mixed</i>
  794. * <div class="sub-desc">The item at the current <code>index</code>
  795. * in the passed <code>array</code></div></li>
  796. * <li><code>index</code> : <i>Number</i>
  797. * <div class="sub-desc">The current index within the array</div></li>
  798. * <li><code>allItems</code> : <i>Array</i>
  799. * <div class="sub-desc">The <code>array</code> passed as the first
  800. * argument to <code>Ext.each</code>.</div></li>
  801. * </ul></div>
  802. * @param {Object} scope The scope (<code>this</code> reference) in which the specified function is executed.
  803. * Defaults to the <code>item</code> at the current <code>index</code>
  804. * within the passed <code>array</code>.
  805. * @return See description for the fn parameter.
  806. */
  807. each : function(array, fn, scope){
  808. if(Ext.isEmpty(array, true)){
  809. return;
  810. }
  811. if(!Ext.isIterable(array) || Ext.isPrimitive(array)){
  812. array = [array];
  813. }
  814. for(var i = 0, len = array.length; i < len; i++){
  815. if(fn.call(scope || array[i], array[i], i, array) === false){
  816. return i;
  817. };
  818. }
  819. },
  820. /**
  821. * Iterates either the elements in an array, or each of the properties in an object.
  822. * <b>Note</b>: If you are only iterating arrays, it is better to call {@link #each}.
  823. * @param {Object/Array} object The object or array to be iterated
  824. * @param {Function} fn The function to be called for each iteration.
  825. * The iteration will stop if the supplied function returns false, or
  826. * all array elements / object properties have been covered. The signature
  827. * varies depending on the type of object being interated:
  828. * <div class="mdetail-params"><ul>
  829. * <li>Arrays : <tt>(Object item, Number index, Array allItems)</tt>
  830. * <div class="sub-desc">
  831. * When iterating an array, the supplied function is called with each item.</div></li>
  832. * <li>Objects : <tt>(String key, Object value, Object)</tt>
  833. * <div class="sub-desc">
  834. * When iterating an object, the supplied function is called with each key-value pair in
  835. * the object, and the iterated object</div></li>
  836. * </ul></div>
  837. * @param {Object} scope The scope (<code>this</code> reference) in which the specified function is executed. Defaults to
  838. * the <code>object</code> being iterated.
  839. */
  840. iterate : function(obj, fn, scope){
  841. if(Ext.isEmpty(obj)){
  842. return;
  843. }
  844. if(Ext.isIterable(obj)){
  845. Ext.each(obj, fn, scope);
  846. return;
  847. }else if(typeof obj == 'object'){
  848. for(var prop in obj){
  849. if(obj.hasOwnProperty(prop)){
  850. if(fn.call(scope || obj, prop, obj[prop], obj) === false){
  851. return;
  852. };
  853. }
  854. }
  855. }
  856. },
  857. /**
  858. * Return the dom node for the passed String (id), dom node, or Ext.Element.
  859. * Optional 'strict' flag is needed for IE since it can return 'name' and
  860. * 'id' elements by using getElementById.
  861. * Here are some examples:
  862. * <pre><code>
  863. // gets dom node based on id
  864. var elDom = Ext.getDom('elId');
  865. // gets dom node based on the dom node
  866. var elDom1 = Ext.getDom(elDom);
  867. // If we don&#39;t know if we are working with an
  868. // Ext.Element or a dom node use Ext.getDom
  869. function(el){
  870. var dom = Ext.getDom(el);
  871. // do something with the dom node
  872. }
  873. * </code></pre>
  874. * <b>Note</b>: the dom node to be found actually needs to exist (be rendered, etc)
  875. * when this method is called to be successful.
  876. * @param {Mixed} el
  877. * @return HTMLElement
  878. */
  879. getDom : function(el, strict){
  880. if(!el || !DOC){
  881. return null;
  882. }
  883. if (el.dom){
  884. return el.dom;
  885. } else {
  886. if (typeof el == 'string') {
  887. var e = DOC.getElementById(el);
  888. // IE returns elements with the 'name' and 'id' attribute.
  889. // we do a strict check to return the element with only the id attribute
  890. if (e && isIE && strict) {
  891. if (el == e.getAttribute('id')) {
  892. return e;
  893. } else {
  894. return null;
  895. }
  896. }
  897. return e;
  898. } else {
  899. return el;
  900. }
  901. }
  902. },
  903. /**
  904. * Returns the current document body as an {@link Ext.Element}.
  905. * @return Ext.Element The document body
  906. */
  907. getBody : function(){
  908. return Ext.get(DOC.body || DOC.documentElement);
  909. },
  910. /**
  911. * Returns the current document body as an {@link Ext.Element}.
  912. * @return Ext.Element The document body
  913. * @method
  914. */
  915. getHead : function() {
  916. var head;
  917. return function() {
  918. if (head == undefined) {
  919. head = Ext.get(DOC.getElementsByTagName("head")[0]);
  920. }
  921. return head;
  922. };
  923. }(),
  924. /**
  925. * <p>Removes this element from the document, removes all DOM event listeners, and deletes the cache reference.
  926. * All DOM event listeners are removed from this element. If {@link Ext#enableNestedListenerRemoval} is
  927. * <code>true</code>, then DOM event listeners are also removed from all child nodes. The body node
  928. * will be ignored if passed in.</p>
  929. * @param {HTMLElement} node The node to remove
  930. * @method
  931. */
  932. removeNode : isIE && !isIE8 ? function(){
  933. var d;
  934. return function(n){
  935. if(n && n.tagName != 'BODY'){
  936. (Ext.enableNestedListenerRemoval) ? Ext.EventManager.purgeElement(n, true) : Ext.EventManager.removeAll(n);
  937. d = d || DOC.createElement('div');
  938. d.appendChild(n);
  939. d.innerHTML = '';
  940. delete Ext.elCache[n.id];
  941. }
  942. };
  943. }() : function(n){
  944. if(n && n.parentNode && n.tagName != 'BODY'){
  945. (Ext.enableNestedListenerRemoval) ? Ext.EventManager.purgeElement(n, true) : Ext.EventManager.removeAll(n);
  946. n.parentNode.removeChild(n);
  947. delete Ext.elCache[n.id];
  948. }
  949. },
  950. /**
  951. * <p>Returns true if the passed value is empty.</p>
  952. * <p>The value is deemed to be empty if it is<div class="mdetail-params"><ul>
  953. * <li>null</li>
  954. * <li>undefined</li>
  955. * <li>an empty array</li>
  956. * <li>a zero length string (Unless the <tt>allowBlank</tt> parameter is <tt>true</tt>)</li>
  957. * </ul></div>
  958. * @param {Mixed} value The value to test
  959. * @param {Boolean} allowBlank (optional) true to allow empty strings (defaults to false)
  960. * @return {Boolean}
  961. */
  962. isEmpty : function(v, allowBlank){
  963. return v === null || v === undefined || ((Ext.isArray(v) && !v.length)) || (!allowBlank ? v === '' : false);
  964. },
  965. /**
  966. * Returns true if the passed value is a JavaScript array, otherwise false.
  967. * @param {Mixed} value The value to test
  968. * @return {Boolean}
  969. */
  970. isArray : function(v){
  971. return toString.apply(v) === '[object Array]';
  972. },
  973. /**
  974. * Returns true if the passed object is a JavaScript date object, otherwise false.
  975. * @param {Object} object The object to test
  976. * @return {Boolean}
  977. */
  978. isDate : function(v){
  979. return toString.apply(v) === '[object Date]';
  980. },
  981. /**
  982. * Returns true if the passed value is a JavaScript Object, otherwise false.
  983. * @param {Mixed} value The value to test
  984. * @return {Boolean}
  985. */
  986. isObject : function(v){
  987. return !!v && Object.prototype.toString.call(v) === '[object Object]';
  988. },
  989. /**
  990. * Returns true if the passed value is a JavaScript 'primitive', a string, number or boolean.
  991. * @param {Mixed} value The value to test
  992. * @return {Boolean}
  993. */
  994. isPrimitive : function(v){
  995. return Ext.isString(v) || Ext.isNumber(v) || Ext.isBoolean(v);
  996. },
  997. /**
  998. * Returns true if the passed value is a JavaScript Function, otherwise false.
  999. * @param {Mixed} value The value to test
  1000. * @return {Boolean}
  1001. */
  1002. isFunction : function(v){
  1003. return toString.apply(v) === '[object Function]';
  1004. },
  1005. /**
  1006. * Returns true if the passed value is a number. Returns false for non-finite numbers.
  1007. * @param {Mixed} value The value to test
  1008. * @return {Boolean}
  1009. */
  1010. isNumber : function(v){
  1011. return typeof v === 'number' && isFinite(v);
  1012. },
  1013. /**
  1014. * Returns true if the passed value is a string.
  1015. * @param {Mixed} value The value to test
  1016. * @return {Boolean}
  1017. */
  1018. isString : function(v){
  1019. return typeof v === 'string';
  1020. },
  1021. /**
  1022. * Returns true if the passed value is a boolean.
  1023. * @param {Mixed} value The value to test
  1024. * @return {Boolean}
  1025. */
  1026. isBoolean : function(v){
  1027. return typeof v === 'boolean';
  1028. },
  1029. /**
  1030. * Returns true if the passed value is an HTMLElement
  1031. * @param {Mixed} value The value to test
  1032. * @return {Boolean}
  1033. */
  1034. isElement : function(v) {
  1035. return v ? !!v.tagName : false;
  1036. },
  1037. /**
  1038. * Returns true if the passed value is not undefined.
  1039. * @param {Mixed} value The value to test
  1040. * @return {Boolean}
  1041. */
  1042. isDefined : function(v){
  1043. return typeof v !== 'undefined';
  1044. },
  1045. /**
  1046. * True if the detected browser is Opera.
  1047. * @type Boolean
  1048. */
  1049. isOpera : isOpera,
  1050. /**
  1051. * True if the detected browser uses WebKit.
  1052. * @type Boolean
  1053. */
  1054. isWebKit : isWebKit,
  1055. /**
  1056. * True if the detected browser is Chrome.
  1057. * @type Boolean
  1058. */
  1059. isChrome : isChrome,
  1060. /**
  1061. * True if the detected browser is Safari.
  1062. * @type Boolean
  1063. */
  1064. isSafari : isSafari,
  1065. /**
  1066. * True if the detected browser is Safari 3.x.
  1067. * @type Boolean
  1068. */
  1069. isSafari3 : isSafari3,
  1070. /**
  1071. * True if the detected browser is Safari 4.x.
  1072. * @type Boolean
  1073. */
  1074. isSafari4 : isSafari4,
  1075. /**
  1076. * True if the detected browser is Safari 2.x.
  1077. * @type Boolean
  1078. */
  1079. isSafari2 : isSafari2,
  1080. /**
  1081. * True if the detected browser is Internet Explorer.
  1082. * @type Boolean
  1083. */
  1084. isIE : isIE,
  1085. /**
  1086. * True if the detected browser is Internet Explorer 6.x.
  1087. * @type Boolean
  1088. */
  1089. isIE6 : isIE6,
  1090. /**
  1091. * True if the detected browser is Internet Explorer 7.x.
  1092. * @type Boolean
  1093. */
  1094. isIE7 : isIE7,
  1095. /**
  1096. * True if the detected browser is Internet Explorer 8.x.
  1097. * @type Boolean
  1098. */
  1099. isIE8 : isIE8,
  1100. /**
  1101. * True if the detected browser is Internet Explorer 9.x.
  1102. * @type Boolean
  1103. */
  1104. isIE9 : isIE9,
  1105. /**
  1106. * True if the detected browser is Internet Explorer 10.x
  1107. * @type Boolean
  1108. */
  1109. isIE10 : isIE10,
  1110. /**
  1111. * True if the detected browser is Internet Explorer 9.x or lower
  1112. * @type Boolean
  1113. */
  1114. isIE9m : isIE9m,
  1115. /**
  1116. * True if the detected browser is Internet Explorer 10.x or higher
  1117. * @type Boolean
  1118. */
  1119. isIE10p : isIE && !(isIE6 || isIE7 || isIE8 || isIE9),
  1120. // IE10 quirks behaves like Gecko/WebKit quirks, so don't include it here
  1121. // Used internally
  1122. isIEQuirks: isIE && (!isStrict && (isIE6 || isIE7 || isIE8 || isIE9)),
  1123. /**
  1124. * True if the detected browser uses the Gecko layout engine (e.g. Mozilla, Firefox).
  1125. * @type Boolean
  1126. */
  1127. isGecko : isGecko,
  1128. /**
  1129. * True if the detected browser uses a pre-Gecko 1.9 layout engine (e.g. Firefox 2.x).
  1130. * @type Boolean
  1131. */
  1132. isGecko2 : isGecko2,
  1133. /**
  1134. * True if the detected browser uses a Gecko 1.9+ layout engine (e.g. Firefox 3.x).
  1135. * @type Boolean
  1136. */
  1137. isGecko3 : isGecko3,
  1138. /**
  1139. * True if the detected browser is Internet Explorer running in non-strict mode.
  1140. * @type Boolean
  1141. */
  1142. isBorderBox : isBorderBox,
  1143. /**
  1144. * True if the detected platform is Linux.
  1145. * @type Boolean
  1146. */
  1147. isLinux : isLinux,
  1148. /**
  1149. * True if the detected platform is Windows.
  1150. * @type Boolean
  1151. */
  1152. isWindows : isWindows,
  1153. /**
  1154. * True if the detected platform is Mac OS.
  1155. * @type Boolean
  1156. */
  1157. isMac : isMac,
  1158. /**
  1159. * True if the detected platform is Adobe Air.
  1160. * @type Boolean
  1161. */
  1162. isAir : isAir
  1163. });
  1164. /**
  1165. * Creates namespaces to be used for scoping variables and classes so that they are not global.
  1166. * Specifying the last node of a namespace implicitly creates all other nodes. Usage:
  1167. * <pre><code>
  1168. Ext.namespace('Company', 'Company.data');
  1169. Ext.namespace('Company.data'); // equivalent and preferable to above syntax
  1170. Company.Widget = function() { ... }
  1171. Company.data.CustomStore = function(config) { ... }
  1172. </code></pre>
  1173. * @param {String} namespace1
  1174. * @param {String} namespace2
  1175. * @param {String} etc
  1176. * @return {Object} The namespace object. (If multiple arguments are passed, this will be the last namespace created)
  1177. * @method ns
  1178. */
  1179. Ext.ns = Ext.namespace;
  1180. })();
  1181. Ext.ns('Ext.util', 'Ext.lib', 'Ext.data', 'Ext.supports');
  1182. Ext.elCache = {};
  1183. /**
  1184. * @class Function
  1185. * These functions are available on every Function object (any JavaScript function).
  1186. */
  1187. Ext.apply(Function.prototype, {
  1188. /**
  1189. * Creates an interceptor function. The passed function is called before the original one. If it returns false,
  1190. * the original one is not called. The resulting function returns the results of the original function.
  1191. * The passed function is called with the parameters of the original function. Example usage:
  1192. * <pre><code>
  1193. var sayHi = function(name){
  1194. alert('Hi, ' + name);
  1195. }
  1196. sayHi('Fred'); // alerts "Hi, Fred"
  1197. // create a new function that validates input without
  1198. // directly modifying the original function:
  1199. var sayHiToFriend = sayHi.createInterceptor(function(name){
  1200. return name == 'Brian';
  1201. });
  1202. sayHiToFriend('Fred'); // no alert
  1203. sayHiToFriend('Brian'); // alerts "Hi, Brian"
  1204. </code></pre>
  1205. * @param {Function} fcn The function to call before the original
  1206. * @param {Object} scope (optional) The scope (<code><b>this</b></code> reference) in which the passed function is executed.
  1207. * <b>If omitted, defaults to the scope in which the original function is called or the browser window.</b>
  1208. * @return {Function} The new function
  1209. */
  1210. createInterceptor : function(fcn, scope){
  1211. var method = this;
  1212. return !Ext.isFunction(fcn) ?
  1213. this :
  1214. function() {
  1215. var me = this,
  1216. args = arguments;
  1217. fcn.target = me;
  1218. fcn.method = method;
  1219. return (fcn.apply(scope || me || window, args) !== false) ?
  1220. method.apply(me || window, args) :
  1221. null;
  1222. };
  1223. },
  1224. /**
  1225. * Creates a callback that passes arguments[0], arguments[1], arguments[2], ...
  1226. * Call directly on any function. Example: <code>myFunction.createCallback(arg1, arg2)</code>
  1227. * Will create a function that is bound to those 2 args. <b>If a specific scope is required in the
  1228. * callback, use {@link #createDelegate} instead.</b> The function returned by createCallback always
  1229. * executes in the window scope.
  1230. * <p>This method is required when you want to pass arguments to a callback function. If no arguments
  1231. * are needed, you can simply pass a reference to the function as a callback (e.g., callback: myFn).
  1232. * However, if you tried to pass a function with arguments (e.g., callback: myFn(arg1, arg2)) the function
  1233. * would simply execute immediately when the code is parsed. Example usage:
  1234. * <pre><code>
  1235. var sayHi = function(name){
  1236. alert('Hi, ' + name);
  1237. }
  1238. // clicking the button alerts "Hi, Fred"
  1239. new Ext.Button({
  1240. text: 'Say Hi',
  1241. renderTo: Ext.getBody(),
  1242. handler: sayHi.createCallback('Fred')
  1243. });
  1244. </code></pre>
  1245. * @return {Function} The new function
  1246. */
  1247. createCallback : function(/*args...*/){
  1248. // make args available, in function below
  1249. var args = arguments,
  1250. method = this;
  1251. return function() {
  1252. return method.apply(window, args);
  1253. };
  1254. },
  1255. /**
  1256. * Creates a delegate (callback) that sets the scope to obj.
  1257. * Call directly on any function. Example: <code>this.myFunction.createDelegate(this, [arg1, arg2])</code>
  1258. * Will create a function that is automatically scoped to obj so that the <tt>this</tt> variable inside the
  1259. * callback points to obj. Example usage:
  1260. * <pre><code>
  1261. var sayHi = function(name){
  1262. // Note this use of "this.text" here. This function expects to
  1263. // execute within a scope that contains a text property. In this
  1264. // example, the "this" variable is pointing to the btn object that
  1265. // was passed in createDelegate below.
  1266. alert('Hi, ' + name + '. You clicked the "' + this.text + '" button.');
  1267. }
  1268. var btn = new Ext.Button({
  1269. text: 'Say Hi',
  1270. renderTo: Ext.getBody()
  1271. });
  1272. // This callback will execute in the scope of the
  1273. // button instance. Clicking the button alerts
  1274. // "Hi, Fred. You clicked the "Say Hi" button."
  1275. btn.on('click', sayHi.createDelegate(btn, ['Fred']));
  1276. </code></pre>
  1277. * @param {Object} scope (optional) The scope (<code><b>this</b></code> reference) in which the function is executed.
  1278. * <b>If omitted, defaults to the browser window.</b>
  1279. * @param {Array} args (optional) Overrides arguments for the call. (Defaults to the arguments passed by the caller)
  1280. * @param {Boolean/Number} appendArgs (optional) if True args are appended to call args instead of overriding,
  1281. * if a number the args are inserted at the specified position
  1282. * @return {Function} The new function
  1283. */
  1284. createDelegate : function(obj, args, appendArgs){
  1285. var method = this;
  1286. return function() {
  1287. var callArgs = args || arguments;
  1288. if (appendArgs === true){
  1289. callArgs = Array.prototype.slice.call(arguments, 0);
  1290. callArgs = callArgs.concat(args);
  1291. }else if (Ext.isNumber(appendArgs)){
  1292. callArgs = Array.prototype.slice.call(arguments, 0); // copy arguments first
  1293. var applyArgs = [appendArgs, 0].concat(args); // create method call params
  1294. Array.prototype.splice.apply(callArgs, applyArgs); // splice them in
  1295. }
  1296. return method.apply(obj || window, callArgs);
  1297. };
  1298. },
  1299. /**
  1300. * Calls this function after the number of millseconds specified, optionally in a specific scope. Example usage:
  1301. * <pre><code>
  1302. var sayHi = function(name){
  1303. alert('Hi, ' + name);
  1304. }
  1305. // executes immediately:
  1306. sayHi('Fred');
  1307. // executes after 2 seconds:
  1308. sayHi.defer(2000, this, ['Fred']);
  1309. // this syntax is sometimes useful for deferring
  1310. // execution of an anonymous function:
  1311. (function(){
  1312. alert('Anonymous');
  1313. }).defer(100);
  1314. </code></pre>
  1315. * @param {Number} millis The number of milliseconds for the setTimeout call (if less than or equal to 0 the function is executed immediately)
  1316. * @param {Object} scope (optional) The scope (<code><b>this</b></code> reference) in which the function is executed.
  1317. * <b>If omitted, defaults to the browser window.</b>
  1318. * @param {Array} args (optional) Overrides arguments for the call. (Defaults to the arguments passed by the caller)
  1319. * @param {Boolean/Number} appendArgs (optional) if True args are appended to call args instead of overriding,
  1320. * if a number the args are inserted at the specified position
  1321. * @return {Number} The timeout id that can be used with clearTimeout
  1322. */
  1323. defer : function(millis, obj, args, appendArgs){
  1324. var fn = this.createDelegate(obj, args, appendArgs);
  1325. if(millis > 0){
  1326. return setTimeout(fn, millis);
  1327. }
  1328. fn();
  1329. return 0;
  1330. }
  1331. });
  1332. /**
  1333. * @class String
  1334. * These functions are available on every String object.
  1335. */
  1336. Ext.applyIf(String, {
  1337. /**
  1338. * Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the tokens. Each
  1339. * token must be unique, and must increment in the format {0}, {1}, etc. Example usage:
  1340. * <pre><code>
  1341. var cls = 'my-class', text = 'Some text';
  1342. var s = String.format('&lt;div class="{0}">{1}&lt;/div>', cls, text);
  1343. // s now contains the string: '&lt;div class="my-class">Some text&lt;/div>'
  1344. * </code></pre>
  1345. * @param {String} string The tokenized string to be formatted
  1346. * @param {String} value1 The value to replace token {0}
  1347. * @param {String} value2 Etc...
  1348. * @return {String} The formatted string
  1349. * @static
  1350. */
  1351. format : function(format){
  1352. var args = Ext.toArray(arguments, 1);
  1353. return format.replace(/\{(\d+)\}/g, function(m, i){
  1354. return args[i];
  1355. });
  1356. }
  1357. });
  1358. /**
  1359. * @class Array
  1360. */
  1361. Ext.applyIf(Array.prototype, {
  1362. /**
  1363. * Checks whether or not the specified object exists in the array.
  1364. * @param {Object} o The object to check for
  1365. * @param {Number} from (Optional) The index at which to begin the search
  1366. * @return {Number} The index of o in the array (or -1 if it is not found)
  1367. */
  1368. indexOf : function(o, from){
  1369. var len = this.length;
  1370. from = from || 0;
  1371. from += (from < 0) ? len : 0;
  1372. for (; from < len; ++from){
  1373. if(this[from] === o){
  1374. return from;
  1375. }
  1376. }
  1377. return -1;
  1378. },
  1379. /**
  1380. * Removes the specified object from the array. If the object is not found nothing happens.
  1381. * @param {Object} o The object to remove
  1382. * @return {Array} this array
  1383. */
  1384. remove : function(o){
  1385. var index = this.indexOf(o);
  1386. if(index != -1){
  1387. this.splice(index, 1);
  1388. }
  1389. return this;
  1390. }
  1391. });
  1392. /**
  1393. * @class Ext.util.TaskRunner
  1394. * Provides the ability to execute one or more arbitrary tasks in a multithreaded
  1395. * manner. Generally, you can use the singleton {@link Ext.TaskMgr} instead, but
  1396. * if needed, you can create separate instances of TaskRunner. Any number of
  1397. * separate tasks can be started at any time and will run independently of each
  1398. * other. Example usage:
  1399. * <pre><code>
  1400. // Start a simple clock task that updates a div once per second
  1401. var updateClock = function(){
  1402. Ext.fly('clock').update(new Date().format('g:i:s A'));
  1403. }
  1404. var task = {
  1405. run: updateClock,
  1406. interval: 1000 //1 second
  1407. }
  1408. var runner = new Ext.util.TaskRunner();
  1409. runner.start(task);
  1410. // equivalent using TaskMgr
  1411. Ext.TaskMgr.start({
  1412. run: updateClock,
  1413. interval: 1000
  1414. });
  1415. * </code></pre>
  1416. * <p>See the {@link #start} method for details about how to configure a task object.</p>
  1417. * Also see {@link Ext.util.DelayedTask}.
  1418. *
  1419. * @constructor
  1420. * @param {Number} interval (optional) The minimum precision in milliseconds supported by this TaskRunner instance
  1421. * (defaults to 10)
  1422. */
  1423. Ext.util.TaskRunner = function(interval){
  1424. interval = interval || 10;
  1425. var tasks = [],
  1426. removeQueue = [],
  1427. id = 0,
  1428. running = false,
  1429. // private
  1430. stopThread = function(){
  1431. running = false;
  1432. clearInterval(id);
  1433. id = 0;
  1434. },
  1435. // private
  1436. startThread = function(){
  1437. if(!running){
  1438. running = true;
  1439. id = setInterval(runTasks, interval);
  1440. }
  1441. },
  1442. // private
  1443. removeTask = function(t){
  1444. removeQueue.push(t);
  1445. if(t.onStop){
  1446. t.onStop.apply(t.scope || t);
  1447. }
  1448. },
  1449. // private
  1450. runTasks = function(){
  1451. var rqLen = removeQueue.length,
  1452. now = new Date().getTime();
  1453. if(rqLen > 0){
  1454. for(var i = 0; i < rqLen; i++){
  1455. tasks.remove(removeQueue[i]);
  1456. }
  1457. removeQueue = [];
  1458. if(tasks.length < 1){
  1459. stopThread();
  1460. return;
  1461. }
  1462. }
  1463. for(var i = 0, t, itime, rt, len = tasks.length; i < len; ++i){
  1464. t = tasks[i];
  1465. itime = now - t.taskRunTime;
  1466. if(t.interval <= itime){
  1467. rt = t.run.apply(t.scope || t, t.args || [++t.taskRunCount]);
  1468. t.taskRunTime = now;
  1469. if(rt === false || t.taskRunCount === t.repeat){
  1470. removeTask(t);
  1471. return;
  1472. }
  1473. }
  1474. if(t.duration && t.duration <= (now - t.taskStartTime)){
  1475. removeTask(t);
  1476. }
  1477. }
  1478. };
  1479. /**
  1480. * Starts a new task.
  1481. * @method start
  1482. * @param {Object} task <p>A config object that supports the following properties:<ul>
  1483. * <li><code>run</code> : Function<div class="sub-desc"><p>The function to execute each time the task is invoked. The
  1484. * function will be called at each interval and passed the <code>args</code> argument if specified, and the
  1485. * current invocation count if not.</p>
  1486. * <p>If a particular scope (<code>this</code> reference) is required, be sure to specify it using the <code>scope</code> argument.</p>
  1487. * <p>Return <code>false</code> from this function to terminate the task.</p></div></li>
  1488. * <li><code>interval</code> : Number<div class="sub-desc">The frequency in milliseconds with which the task
  1489. * should be invoked.</div></li>
  1490. * <li><code>args</code> : Array<div class="sub-desc">(optional) An array of arguments to be passed to the function
  1491. * specified by <code>run</code>. If not specified, the current invocation count is passed.</div></li>
  1492. * <li><code>scope</code> : Object<div class="sub-desc">(optional) The scope (<tt>this</tt> reference) in which to execute the
  1493. * <code>run</code> function. Defaults to the task config object.</div></li>
  1494. * <li><code>duration</code> : Number<div class="sub-desc">(optional) The length of time in milliseconds to invoke
  1495. * the task before stopping automatically (defaults to indefinite).</div></li>
  1496. * <li><code>repeat</code> : Number<div class="sub-desc">(optional) The number of times to invoke the task before
  1497. * stopping automatically (defaults to indefinite).</div></li>
  1498. * </ul></p>
  1499. * <p>Before each invocation, Ext injects the property <code>taskRunCount</code> into the task object so
  1500. * that calculations based on the repeat count can be performed.</p>
  1501. * @return {Object} The task
  1502. */
  1503. this.start = function(task){
  1504. tasks.push(task);
  1505. task.taskStartTime = new Date().getTime();
  1506. task.taskRunTime = 0;
  1507. task.taskRunCount = 0;
  1508. startThread();
  1509. return task;
  1510. };
  1511. /**
  1512. * Stops an existing running task.
  1513. * @method stop
  1514. * @param {Object} task The task to stop
  1515. * @return {Object} The task
  1516. */
  1517. this.stop = function(task){
  1518. removeTask(task);
  1519. return task;
  1520. };
  1521. /**
  1522. * Stops all tasks that are currently running.
  1523. * @method stopAll
  1524. */
  1525. this.stopAll = function(){
  1526. stopThread();
  1527. for(var i = 0, len = tasks.length; i < len; i++){
  1528. if(tasks[i].onStop){
  1529. tasks[i].onStop();
  1530. }
  1531. }
  1532. tasks = [];
  1533. removeQueue = [];
  1534. };
  1535. };
  1536. /**
  1537. * @class Ext.TaskMgr
  1538. * @extends Ext.util.TaskRunner
  1539. * A static {@link Ext.util.TaskRunner} instance that can be used to start and stop arbitrary tasks. See
  1540. * {@link Ext.util.TaskRunner} for supported methods and task config properties.
  1541. * <pre><code>
  1542. // Start a simple clock task that updates a div once per second
  1543. var task = {
  1544. run: function(){
  1545. Ext.fly('clock').update(new Date().format('g:i:s A'));
  1546. },
  1547. interval: 1000 //1 second
  1548. }
  1549. Ext.TaskMgr.start(task);
  1550. </code></pre>
  1551. * <p>See the {@link #start} method for details about how to configure a task object.</p>
  1552. * @singleton
  1553. */
  1554. Ext.TaskMgr = new Ext.util.TaskRunner();(function(){
  1555. var libFlyweight;
  1556. function fly(el) {
  1557. if (!libFlyweight) {
  1558. libFlyweight = new Ext.Element.Flyweight();
  1559. }
  1560. libFlyweight.dom = el;
  1561. return libFlyweight;
  1562. }
  1563. (function(){
  1564. var doc = document,
  1565. isCSS1 = doc.compatMode == "CSS1Compat",
  1566. MAX = Math.max,
  1567. ROUND = Math.round,
  1568. PARSEINT = parseInt;
  1569. Ext.lib.Dom = {
  1570. isAncestor : function(p, c) {
  1571. var ret = false;
  1572. p = Ext.getDom(p);
  1573. c = Ext.getDom(c);
  1574. if (p && c) {
  1575. if (p.contains) {
  1576. return p.contains(c);
  1577. } else if (p.compareDocumentPosition) {
  1578. return !!(p.compareDocumentPosition(c) & 16);
  1579. } else {
  1580. while (c = c.parentNode) {
  1581. ret = c == p || ret;
  1582. }
  1583. }
  1584. }
  1585. return ret;
  1586. },
  1587. getViewWidth : function(full) {
  1588. return full ? this.getDocumentWidth() : this.getViewportWidth();
  1589. },
  1590. getViewHeight : function(full) {
  1591. return full ? this.getDocumentHeight() : this.getViewportHeight();
  1592. },
  1593. getDocumentHeight: function() {
  1594. return MAX(!isCSS1 ? doc.body.scrollHeight : doc.documentElement.scrollHeight, this.getViewportHeight());
  1595. },
  1596. getDocumentWidth: function() {
  1597. return MAX(!isCSS1 ? doc.body.scrollWidth : doc.documentElement.scrollWidth, this.getViewportWidth());
  1598. },
  1599. getViewportHeight: function(){
  1600. return Ext.isIE9m ?
  1601. (Ext.isStrict ? doc.documentElement.clientHeight : doc.body.clientHeight) :
  1602. self.innerHeight;
  1603. },
  1604. getViewportWidth : function() {
  1605. return !Ext.isStrict && !Ext.isOpera ? doc.body.clientWidth :
  1606. Ext.isIE9m ? doc.documentElement.clientWidth : self.innerWidth;
  1607. },
  1608. getY : function(el) {
  1609. return this.getXY(el)[1];
  1610. },
  1611. getX : function(el) {
  1612. return this.getXY(el)[0];
  1613. },
  1614. getXY : function(el) {
  1615. var p,
  1616. pe,
  1617. b,
  1618. bt,
  1619. bl,
  1620. dbd,
  1621. x = 0,
  1622. y = 0,
  1623. scroll,
  1624. hasAbsolute,
  1625. bd = (doc.body || doc.documentElement),
  1626. ret = [0,0];
  1627. el = Ext.getDom(el);
  1628. if(el != bd){
  1629. if (el.getBoundingClientRect) {
  1630. b = el.getBoundingClientRect();
  1631. scroll = fly(document).getScroll();
  1632. ret = [ROUND(b.left + scroll.left), ROUND(b.top + scroll.top)];
  1633. } else {
  1634. p = el;
  1635. hasAbsolute = fly(el).isStyle("position", "absolute");
  1636. while (p) {
  1637. pe = fly(p);
  1638. x += p.offsetLeft;
  1639. y += p.offsetTop;
  1640. hasAbsolute = hasAbsolute || pe.isStyle("position", "absolute");
  1641. if (Ext.isGecko) {
  1642. y += bt = PARSEINT(pe.getStyle("borderTopWidth"), 10) || 0;
  1643. x += bl = PARSEINT(pe.getStyle("borderLeftWidth"), 10) || 0;
  1644. if (p != el && !pe.isStyle('overflow','visible')) {
  1645. x += bl;
  1646. y += bt;
  1647. }
  1648. }
  1649. p = p.offsetParent;
  1650. }
  1651. if (Ext.isSafari && hasAbsolute) {
  1652. x -= bd.offsetLeft;
  1653. y -= bd.offsetTop;
  1654. }
  1655. if (Ext.isGecko && !hasAbsolute) {
  1656. dbd = fly(bd);
  1657. x += PARSEINT(dbd.getStyle("borderLeftWidth"), 10) || 0;
  1658. y += PARSEINT(dbd.getStyle("borderTopWidth"), 10) || 0;
  1659. }
  1660. p = el.parentNode;
  1661. while (p && p != bd) {
  1662. if (!Ext.isOpera || (p.tagName != 'TR' && !fly(p).isStyle("display", "inline"))) {
  1663. x -= p.scrollLeft;
  1664. y -= p.scrollTop;
  1665. }
  1666. p = p.parentNode;
  1667. }
  1668. ret = [x,y];
  1669. }
  1670. }
  1671. return ret;
  1672. },
  1673. setXY : function(el, xy) {
  1674. (el = Ext.fly(el, '_setXY')).position();
  1675. var pts = el.translatePoints(xy),
  1676. style = el.dom.style,
  1677. pos;
  1678. for (pos in pts) {
  1679. if (!isNaN(pts[pos])) {
  1680. style[pos] = pts[pos] + "px";
  1681. }
  1682. }
  1683. },
  1684. setX : function(el, x) {
  1685. this.setXY(el, [x, false]);
  1686. },
  1687. setY : function(el, y) {
  1688. this.setXY(el, [false, y]);
  1689. }
  1690. };
  1691. })();Ext.lib.Event = function() {
  1692. var loadComplete = false,
  1693. unloadListeners = {},
  1694. retryCount = 0,
  1695. onAvailStack = [],
  1696. _interval,
  1697. locked = false,
  1698. win = window,
  1699. doc = document,
  1700. // constants
  1701. POLL_RETRYS = 200,
  1702. POLL_INTERVAL = 20,
  1703. TYPE = 0,
  1704. FN = 1,
  1705. OBJ = 2,
  1706. ADJ_SCOPE = 3,
  1707. SCROLLLEFT = 'scrollLeft',
  1708. SCROLLTOP = 'scrollTop',
  1709. UNLOAD = 'unload',
  1710. MOUSEOVER = 'mouseover',
  1711. MOUSEOUT = 'mouseout',
  1712. // private
  1713. doAdd = function() {
  1714. var ret;
  1715. if (win.addEventListener) {
  1716. ret = function(el, eventName, fn, capture) {
  1717. if (eventName == 'mouseenter') {
  1718. fn = fn.createInterceptor(checkRelatedTarget);
  1719. el.addEventListener(MOUSEOVER, fn, (capture));
  1720. } else if (eventName == 'mouseleave') {
  1721. fn = fn.createInterceptor(checkRelatedTarget);
  1722. el.addEventListener(MOUSEOUT, fn, (capture));
  1723. } else {
  1724. el.addEventListener(eventName, fn, (capture));
  1725. }
  1726. return fn;
  1727. };
  1728. } else if (win.attachEvent) {
  1729. ret = function(el, eventName, fn, capture) {
  1730. el.attachEvent("on" + eventName, fn);
  1731. return fn;
  1732. };
  1733. } else {
  1734. ret = function(){};
  1735. }
  1736. return ret;
  1737. }(),
  1738. // private
  1739. doRemove = function(){
  1740. var ret;
  1741. if (win.removeEventListener) {
  1742. ret = function (el, eventName, fn, capture) {
  1743. if (eventName == 'mouseenter') {
  1744. eventName = MOUSEOVER;
  1745. } else if (eventName == 'mouseleave') {
  1746. eventName = MOUSEOUT;
  1747. }
  1748. el.removeEventListener(eventName, fn, (capture));
  1749. };
  1750. } else if (win.detachEvent) {
  1751. ret = function (el, eventName, fn) {
  1752. el.detachEvent("on" + eventName, fn);
  1753. };
  1754. } else {
  1755. ret = function(){};
  1756. }
  1757. return ret;
  1758. }();
  1759. function checkRelatedTarget(e) {
  1760. return !elContains(e.currentTarget, pub.getRelatedTarget(e));
  1761. }
  1762. function elContains(parent, child) {
  1763. if(parent && parent.firstChild){
  1764. while(child) {
  1765. if(child === parent) {
  1766. return true;
  1767. }
  1768. child = child.parentNode;
  1769. if(child && (child.nodeType != 1)) {
  1770. child = null;
  1771. }
  1772. }
  1773. }
  1774. return false;
  1775. }
  1776. // private
  1777. function _tryPreloadAttach() {
  1778. var ret = false,
  1779. notAvail = [],
  1780. element, i, v, override,
  1781. tryAgain = !loadComplete || (retryCount > 0);
  1782. if(!locked){
  1783. locked = true;
  1784. for(i = 0; i < onAvailStack.length; ++i){
  1785. v = onAvailStack[i];
  1786. if(v && (element = doc.getElementById(v.id))){
  1787. if(!v.checkReady || loadComplete || element.nextSibling || (doc && doc.body)) {
  1788. override = v.override;
  1789. element = override ? (override === true ? v.obj : override) : element;
  1790. v.fn.call(element, v.obj);
  1791. onAvailStack.remove(v);
  1792. --i;
  1793. }else{
  1794. notAvail.push(v);
  1795. }
  1796. }
  1797. }
  1798. retryCount = (notAvail.length === 0) ? 0 : retryCount - 1;
  1799. if (tryAgain) {
  1800. startInterval();
  1801. } else {
  1802. clearInterval(_interval);
  1803. _interval = null;
  1804. }
  1805. ret = !(locked = false);
  1806. }
  1807. return ret;
  1808. }
  1809. // private
  1810. function startInterval() {
  1811. if(!_interval){
  1812. var callback = function() {
  1813. _tryPreloadAttach();
  1814. };
  1815. _interval = setInterval(callback, POLL_INTERVAL);
  1816. }
  1817. }
  1818. // private
  1819. function getScroll() {
  1820. var dd = doc.documentElement,
  1821. db = doc.body;
  1822. if(dd && (dd[SCROLLTOP] || dd[SCROLLLEFT])){
  1823. return [dd[SCROLLLEFT], dd[SCROLLTOP]];
  1824. }else if(db){
  1825. return [db[SCROLLLEFT], db[SCROLLTOP]];
  1826. }else{
  1827. return [0, 0];
  1828. }
  1829. }
  1830. // private
  1831. function getPageCoord (ev, xy) {
  1832. ev = ev.browserEvent || ev;
  1833. var coord = ev['page' + xy];
  1834. if (!coord && coord !== 0) {
  1835. coord = ev['client' + xy] || 0;
  1836. if (Ext.isIE) {
  1837. coord += getScroll()[xy == "X" ? 0 : 1];
  1838. }
  1839. }
  1840. return coord;
  1841. }
  1842. var pub = {
  1843. extAdapter: true,
  1844. onAvailable : function(p_id, p_fn, p_obj, p_override) {
  1845. onAvailStack.push({
  1846. id: p_id,
  1847. fn: p_fn,
  1848. obj: p_obj,
  1849. override: p_override,
  1850. checkReady: false });
  1851. retryCount = POLL_RETRYS;
  1852. startInterval();
  1853. },
  1854. // This function should ALWAYS be called from Ext.EventManager
  1855. addListener: function(el, eventName, fn) {
  1856. el = Ext.getDom(el);
  1857. if (el && fn) {
  1858. if (eventName == UNLOAD) {
  1859. if (unloadListeners[el.id] === undefined) {
  1860. unloadListeners[el.id] = [];
  1861. }
  1862. unloadListeners[el.id].push([eventName, fn]);
  1863. return fn;
  1864. }
  1865. return doAdd(el, eventName, fn, false);
  1866. }
  1867. return false;
  1868. },
  1869. // This function should ALWAYS be called from Ext.EventManager
  1870. removeListener: function(el, eventName, fn) {
  1871. el = Ext.getDom(el);
  1872. var i, len, li, lis;
  1873. if (el && fn) {
  1874. if(eventName == UNLOAD){
  1875. if((lis = unloadListeners[el.id]) !== undefined){
  1876. for(i = 0, len = lis.length; i < len; i++){
  1877. if((li = lis[i]) && li[TYPE] == eventName && li[FN] == fn){
  1878. unloadListeners[el.id].splice(i, 1);
  1879. }
  1880. }
  1881. }
  1882. return;
  1883. }
  1884. doRemove(el, eventName, fn, false);
  1885. }
  1886. },
  1887. getTarget : function(ev) {
  1888. ev = ev.browserEvent || ev;
  1889. return this.resolveTextNode(ev.target || ev.srcElement);
  1890. },
  1891. resolveTextNode : Ext.isGecko ? function(node){
  1892. if(!node){
  1893. return;
  1894. }
  1895. // work around firefox bug, https://bugzilla.mozilla.org/show_bug.cgi?id=101197
  1896. var s = HTMLElement.prototype.toString.call(node);
  1897. if(s == '[xpconnect wrapped native prototype]' || s == '[object XULElement]'){
  1898. return;
  1899. }
  1900. return node.nodeType == 3 ? node.parentNode : node;
  1901. } : function(node){
  1902. return node && node.nodeType == 3 ? node.parentNode : node;
  1903. },
  1904. getRelatedTarget : function(ev) {
  1905. ev = ev.browserEvent || ev;
  1906. return this.resolveTextNode(ev.relatedTarget ||
  1907. (/(mouseout|mouseleave)/.test(ev.type) ? ev.toElement :
  1908. /(mouseover|mouseenter)/.test(ev.type) ? ev.fromElement : null));
  1909. },
  1910. getPageX : function(ev) {
  1911. return getPageCoord(ev, "X");
  1912. },
  1913. getPageY : function(ev) {
  1914. return getPageCoord(ev, "Y");
  1915. },
  1916. getXY : function(ev) {
  1917. return [this.getPageX(ev), this.getPageY(ev)];
  1918. },
  1919. stopEvent : function(ev) {
  1920. this.stopPropagation(ev);
  1921. this.preventDefault(ev);
  1922. },
  1923. stopPropagation : function(ev) {
  1924. ev = ev.browserEvent || ev;
  1925. if (ev.stopPropagation) {
  1926. ev.stopPropagation();
  1927. } else {
  1928. ev.cancelBubble = true;
  1929. }
  1930. },
  1931. preventDefault : function(ev) {
  1932. ev = ev.browserEvent || ev;
  1933. if (ev.preventDefault) {
  1934. ev.preventDefault();
  1935. } else {
  1936. if (ev.keyCode) {
  1937. ev.keyCode = 0;
  1938. }
  1939. ev.returnValue = false;
  1940. }
  1941. },
  1942. getEvent : function(e) {
  1943. e = e || win.event;
  1944. if (!e) {
  1945. var c = this.getEvent.caller;
  1946. while (c) {
  1947. e = c.arguments[0];
  1948. if (e && Event == e.constructor) {
  1949. break;
  1950. }
  1951. c = c.caller;
  1952. }
  1953. }
  1954. return e;
  1955. },
  1956. getCharCode : function(ev) {
  1957. ev = ev.browserEvent || ev;
  1958. return ev.charCode || ev.keyCode || 0;
  1959. },
  1960. //clearCache: function() {},
  1961. // deprecated, call from EventManager
  1962. getListeners : function(el, eventName) {
  1963. Ext.EventManager.getListeners(el, eventName);
  1964. },
  1965. // deprecated, call from EventManager
  1966. purgeElement : function(el, recurse, eventName) {
  1967. Ext.EventManager.purgeElement(el, recurse, eventName);
  1968. },
  1969. _load : function(e) {
  1970. loadComplete = true;
  1971. if (Ext.isIE9m && e !== true) {
  1972. // IE8 complains that _load is null or not an object
  1973. // so lets remove self via arguments.callee
  1974. doRemove(win, "load", arguments.callee);
  1975. }
  1976. },
  1977. _unload : function(e) {
  1978. var EU = Ext.lib.Event,
  1979. i, v, ul, id, len, scope;
  1980. for (id in unloadListeners) {
  1981. ul = unloadListeners[id];
  1982. for (i = 0, len = ul.length; i < len; i++) {
  1983. v = ul[i];
  1984. if (v) {
  1985. try{
  1986. scope = v[ADJ_SCOPE] ? (v[ADJ_SCOPE] === true ? v[OBJ] : v[ADJ_SCOPE]) : win;
  1987. v[FN].call(scope, EU.getEvent(e), v[OBJ]);
  1988. }catch(ex){}
  1989. }
  1990. }
  1991. };
  1992. Ext.EventManager._unload();
  1993. doRemove(win, UNLOAD, EU._unload);
  1994. }
  1995. };
  1996. // Initialize stuff.
  1997. pub.on = pub.addListener;
  1998. pub.un = pub.removeListener;
  1999. if (doc && doc.body) {
  2000. pub._load(true);
  2001. } else {
  2002. doAdd(win, "load", pub._load);
  2003. }
  2004. doAdd(win, UNLOAD, pub._unload);
  2005. _tryPreloadAttach();
  2006. return pub;
  2007. }();
  2008. /*
  2009. * Portions of this file are based on pieces of Yahoo User Interface Library
  2010. * Copyright (c) 2007, Yahoo! Inc. All rights reserved.
  2011. * YUI licensed under the BSD License:
  2012. * http://developer.yahoo.net/yui/license.txt
  2013. */
  2014. Ext.lib.Ajax = function() {
  2015. var activeX = ['Msxml2.XMLHTTP.3.0',
  2016. 'Msxml2.XMLHTTP'],
  2017. CONTENTTYPE = 'Content-Type';
  2018. // private
  2019. function setHeader(o) {
  2020. var conn = o.conn,
  2021. prop,
  2022. headers = {};
  2023. function setTheHeaders(conn, headers){
  2024. for (prop in headers) {
  2025. if (headers.hasOwnProperty(prop)) {
  2026. conn.setRequestHeader(prop, headers[prop]);
  2027. }
  2028. }
  2029. }
  2030. Ext.apply(headers, pub.headers, pub.defaultHeaders);
  2031. setTheHeaders(conn, headers);
  2032. delete pub.headers;
  2033. }
  2034. // private
  2035. function createExceptionObject(tId, callbackArg, isAbort, isTimeout) {
  2036. return {
  2037. tId : tId,
  2038. status : isAbort ? -1 : 0,
  2039. statusText : isAbort ? 'transaction aborted' : 'communication failure',
  2040. isAbort: isAbort,
  2041. isTimeout: isTimeout,
  2042. argument : callbackArg
  2043. };
  2044. }
  2045. // private
  2046. function initHeader(label, value) {
  2047. (pub.headers = pub.headers || {})[label] = value;
  2048. }
  2049. // private
  2050. function createResponseObject(o, callbackArg) {
  2051. var headerObj = {},
  2052. headerStr,
  2053. conn = o.conn,
  2054. t,
  2055. s,
  2056. // see: https://prototype.lighthouseapp.com/projects/8886/tickets/129-ie-mangles-http-response-status-code-204-to-1223
  2057. isBrokenStatus = conn.status == 1223;
  2058. try {
  2059. headerStr = o.conn.getAllResponseHeaders();
  2060. Ext.each(headerStr.replace(/\r\n/g, '\n').split('\n'), function(v){
  2061. t = v.indexOf(':');
  2062. if(t >= 0){
  2063. s = v.substr(0, t).toLowerCase();
  2064. if(v.charAt(t + 1) == ' '){
  2065. ++t;
  2066. }
  2067. headerObj[s] = v.substr(t + 1);
  2068. }
  2069. });
  2070. } catch(e) {}
  2071. return {
  2072. tId : o.tId,
  2073. // Normalize the status and statusText when IE returns 1223, see the above link.
  2074. status : isBrokenStatus ? 204 : conn.status,
  2075. statusText : isBrokenStatus ? 'No Content' : conn.statusText,
  2076. getResponseHeader : function(header){return headerObj[header.toLowerCase()];},
  2077. getAllResponseHeaders : function(){return headerStr;},
  2078. responseText : conn.responseText,
  2079. responseXML : conn.responseXML,
  2080. argument : callbackArg
  2081. };
  2082. }
  2083. // private
  2084. function releaseObject(o) {
  2085. if (o.tId) {
  2086. pub.conn[o.tId] = null;
  2087. }
  2088. o.conn = null;
  2089. o = null;
  2090. }
  2091. // private
  2092. function handleTransactionResponse(o, callback, isAbort, isTimeout) {
  2093. if (!callback) {
  2094. releaseObject(o);
  2095. return;
  2096. }
  2097. var httpStatus, responseObject;
  2098. try {
  2099. if (o.conn.status !== undefined && o.conn.status != 0) {
  2100. httpStatus = o.conn.status;
  2101. }
  2102. else {
  2103. httpStatus = 13030;
  2104. }
  2105. }
  2106. catch(e) {
  2107. httpStatus = 13030;
  2108. }
  2109. if ((httpStatus >= 200 && httpStatus < 300) || (Ext.isIE && httpStatus == 1223)) {
  2110. responseObject = createResponseObject(o, callback.argument);
  2111. if (callback.success) {
  2112. if (!callback.scope) {
  2113. callback.success(responseObject);
  2114. }
  2115. else {
  2116. callback.success.apply(callback.scope, [responseObject]);
  2117. }
  2118. }
  2119. }
  2120. else {
  2121. switch (httpStatus) {
  2122. case 12002:
  2123. case 12029:
  2124. case 12030:
  2125. case 12031:
  2126. case 12152:
  2127. case 13030:
  2128. responseObject = createExceptionObject(o.tId, callback.argument, (isAbort ? isAbort : false), isTimeout);
  2129. if (callback.failure) {
  2130. if (!callback.scope) {
  2131. callback.failure(responseObject);
  2132. }
  2133. else {
  2134. callback.failure.apply(callback.scope, [responseObject]);
  2135. }
  2136. }
  2137. break;
  2138. default:
  2139. responseObject = createResponseObject(o, callback.argument);
  2140. if (callback.failure) {
  2141. if (!callback.scope) {
  2142. callback.failure(responseObject);
  2143. }
  2144. else {
  2145. callback.failure.apply(callback.scope, [responseObject]);
  2146. }
  2147. }
  2148. }
  2149. }
  2150. releaseObject(o);
  2151. responseObject = null;
  2152. }
  2153. function checkResponse(o, callback, conn, tId, poll, cbTimeout){
  2154. if (conn && conn.readyState == 4) {
  2155. clearInterval(poll[tId]);
  2156. poll[tId] = null;
  2157. if (cbTimeout) {
  2158. clearTimeout(pub.timeout[tId]);
  2159. pub.timeout[tId] = null;
  2160. }
  2161. handleTransactionResponse(o, callback);
  2162. }
  2163. }
  2164. function checkTimeout(o, callback){
  2165. pub.abort(o, callback, true);
  2166. }
  2167. // private
  2168. function handleReadyState(o, callback){
  2169. callback = callback || {};
  2170. var conn = o.conn,
  2171. tId = o.tId,
  2172. poll = pub.poll,
  2173. cbTimeout = callback.timeout || null;
  2174. if (cbTimeout) {
  2175. pub.conn[tId] = conn;
  2176. pub.timeout[tId] = setTimeout(checkTimeout.createCallback(o, callback), cbTimeout);
  2177. }
  2178. poll[tId] = setInterval(checkResponse.createCallback(o, callback, conn, tId, poll, cbTimeout), pub.pollInterval);
  2179. }
  2180. // private
  2181. function asyncRequest(method, uri, callback, postData) {
  2182. var o = getConnectionObject() || null;
  2183. if (o) {
  2184. o.conn.open(method, uri, true);
  2185. if (pub.useDefaultXhrHeader) {
  2186. initHeader('X-Requested-With', pub.defaultXhrHeader);
  2187. }
  2188. if(postData && pub.useDefaultHeader && (!pub.headers || !pub.headers[CONTENTTYPE])){
  2189. initHeader(CONTENTTYPE, pub.defaultPostHeader);
  2190. }
  2191. if (pub.defaultHeaders || pub.headers) {
  2192. setHeader(o);
  2193. }
  2194. handleReadyState(o, callback);
  2195. o.conn.send(postData || null);
  2196. }
  2197. return o;
  2198. }
  2199. // private
  2200. function getConnectionObject() {
  2201. var o;
  2202. try {
  2203. if (o = createXhrObject(pub.transactionId)) {
  2204. pub.transactionId++;
  2205. }
  2206. } catch(e) {
  2207. } finally {
  2208. return o;
  2209. }
  2210. }
  2211. // private
  2212. function createXhrObject(transactionId) {
  2213. var http;
  2214. try {
  2215. http = new XMLHttpRequest();
  2216. } catch(e) {
  2217. for (var i = Ext.isIE6 ? 1 : 0; i < activeX.length; ++i) {
  2218. try {
  2219. http = new ActiveXObject(activeX[i]);
  2220. break;
  2221. } catch(e) {}
  2222. }
  2223. } finally {
  2224. return {conn : http, tId : transactionId};
  2225. }
  2226. }
  2227. var pub = {
  2228. request : function(method, uri, cb, data, options) {
  2229. if(options){
  2230. var me = this,
  2231. xmlData = options.xmlData,
  2232. jsonData = options.jsonData,
  2233. hs;
  2234. Ext.applyIf(me, options);
  2235. if(xmlData || jsonData){
  2236. hs = me.headers;
  2237. if(!hs || !hs[CONTENTTYPE]){
  2238. initHeader(CONTENTTYPE, xmlData ? 'text/xml' : 'application/json');
  2239. }
  2240. data = xmlData || (!Ext.isPrimitive(jsonData) ? Ext.encode(jsonData) : jsonData);
  2241. }
  2242. }
  2243. return asyncRequest(method || options.method || "POST", uri, cb, data);
  2244. },
  2245. serializeForm : function(form) {
  2246. var fElements = form.elements || (document.forms[form] || Ext.getDom(form)).elements,
  2247. hasSubmit = false,
  2248. encoder = encodeURIComponent,
  2249. name,
  2250. data = '',
  2251. type,
  2252. hasValue;
  2253. Ext.each(fElements, function(element){
  2254. name = element.name;
  2255. type = element.type;
  2256. if (!element.disabled && name) {
  2257. if (/select-(one|multiple)/i.test(type)) {
  2258. Ext.each(element.options, function(opt){
  2259. if (opt.selected) {
  2260. hasValue = opt.hasAttribute ? opt.hasAttribute('value') : opt.getAttributeNode('value').specified;
  2261. data += String.format("{0}={1}&", encoder(name), encoder(hasValue ? opt.value : opt.text));
  2262. }
  2263. });
  2264. } else if (!(/file|undefined|reset|button/i.test(type))) {
  2265. if (!(/radio|checkbox/i.test(type) && !element.checked) && !(type == 'submit' && hasSubmit)) {
  2266. data += encoder(name) + '=' + encoder(element.value) + '&';
  2267. hasSubmit = /submit/i.test(type);
  2268. }
  2269. }
  2270. }
  2271. });
  2272. return data.substr(0, data.length - 1);
  2273. },
  2274. useDefaultHeader : true,
  2275. defaultPostHeader : 'application/x-www-form-urlencoded; charset=UTF-8',
  2276. useDefaultXhrHeader : true,
  2277. defaultXhrHeader : 'XMLHttpRequest',
  2278. poll : {},
  2279. timeout : {},
  2280. conn: {},
  2281. pollInterval : 50,
  2282. transactionId : 0,
  2283. // This is never called - Is it worth exposing this?
  2284. // setProgId : function(id) {
  2285. // activeX.unshift(id);
  2286. // },
  2287. // This is never called - Is it worth exposing this?
  2288. // setDefaultPostHeader : function(b) {
  2289. // this.useDefaultHeader = b;
  2290. // },
  2291. // This is never called - Is it worth exposing this?
  2292. // setDefaultXhrHeader : function(b) {
  2293. // this.useDefaultXhrHeader = b;
  2294. // },
  2295. // This is never called - Is it worth exposing this?
  2296. // setPollingInterval : function(i) {
  2297. // if (typeof i == 'number' && isFinite(i)) {
  2298. // this.pollInterval = i;
  2299. // }
  2300. // },
  2301. // This is never called - Is it worth exposing this?
  2302. // resetDefaultHeaders : function() {
  2303. // this.defaultHeaders = null;
  2304. // },
  2305. abort : function(o, callback, isTimeout) {
  2306. var me = this,
  2307. tId = o.tId,
  2308. isAbort = false;
  2309. if (me.isCallInProgress(o)) {
  2310. o.conn.abort();
  2311. clearInterval(me.poll[tId]);
  2312. me.poll[tId] = null;
  2313. clearTimeout(pub.timeout[tId]);
  2314. me.timeout[tId] = null;
  2315. handleTransactionResponse(o, callback, (isAbort = true), isTimeout);
  2316. }
  2317. return isAbort;
  2318. },
  2319. isCallInProgress : function(o) {
  2320. // if there is a connection and readyState is not 0 or 4
  2321. return o.conn && !{0:true,4:true}[o.conn.readyState];
  2322. }
  2323. };
  2324. return pub;
  2325. }();(function(){
  2326. var EXTLIB = Ext.lib,
  2327. noNegatives = /width|height|opacity|padding/i,
  2328. offsetAttribute = /^((width|height)|(top|left))$/,
  2329. defaultUnit = /width|height|top$|bottom$|left$|right$/i,
  2330. offsetUnit = /\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i,
  2331. isset = function(v){
  2332. return typeof v !== 'undefined';
  2333. },
  2334. now = function(){
  2335. return new Date();
  2336. };
  2337. EXTLIB.Anim = {
  2338. motion : function(el, args, duration, easing, cb, scope) {
  2339. return this.run(el, args, duration, easing, cb, scope, Ext.lib.Motion);
  2340. },
  2341. run : function(el, args, duration, easing, cb, scope, type) {
  2342. type = type || Ext.lib.AnimBase;
  2343. if (typeof easing == "string") {
  2344. easing = Ext.lib.Easing[easing];
  2345. }
  2346. var anim = new type(el, args, duration, easing);
  2347. anim.animateX(function() {
  2348. if(Ext.isFunction(cb)){
  2349. cb.call(scope);
  2350. }
  2351. });
  2352. return anim;
  2353. }
  2354. };
  2355. EXTLIB.AnimBase = function(el, attributes, duration, method) {
  2356. if (el) {
  2357. this.init(el, attributes, duration, method);
  2358. }
  2359. };
  2360. EXTLIB.AnimBase.prototype = {
  2361. doMethod: function(attr, start, end) {
  2362. var me = this;
  2363. return me.method(me.curFrame, start, end - start, me.totalFrames);
  2364. },
  2365. setAttr: function(attr, val, unit) {
  2366. if (noNegatives.test(attr) && val < 0) {
  2367. val = 0;
  2368. }
  2369. Ext.fly(this.el, '_anim').setStyle(attr, val + unit);
  2370. },
  2371. getAttr: function(attr) {
  2372. var el = Ext.fly(this.el),
  2373. val = el.getStyle(attr),
  2374. a = offsetAttribute.exec(attr) || [];
  2375. if (val !== 'auto' && !offsetUnit.test(val)) {
  2376. return parseFloat(val);
  2377. }
  2378. return (!!(a[2]) || (el.getStyle('position') == 'absolute' && !!(a[3]))) ? el.dom['offset' + a[0].charAt(0).toUpperCase() + a[0].substr(1)] : 0;
  2379. },
  2380. getDefaultUnit: function(attr) {
  2381. return defaultUnit.test(attr) ? 'px' : '';
  2382. },
  2383. animateX : function(callback, scope) {
  2384. var me = this,
  2385. f = function() {
  2386. me.onComplete.removeListener(f);
  2387. if (Ext.isFunction(callback)) {
  2388. callback.call(scope || me, me);
  2389. }
  2390. };
  2391. me.onComplete.addListener(f, me);
  2392. me.animate();
  2393. },
  2394. setRunAttr: function(attr) {
  2395. var me = this,
  2396. a = this.attributes[attr],
  2397. to = a.to,
  2398. by = a.by,
  2399. from = a.from,
  2400. unit = a.unit,
  2401. ra = (this.runAttrs[attr] = {}),
  2402. end;
  2403. if (!isset(to) && !isset(by)){
  2404. return false;
  2405. }
  2406. var start = isset(from) ? from : me.getAttr(attr);
  2407. if (isset(to)) {
  2408. end = to;
  2409. }else if(isset(by)) {
  2410. if (Ext.isArray(start)){
  2411. end = [];
  2412. for(var i=0,len=start.length; i<len; i++) {
  2413. end[i] = start[i] + by[i];
  2414. }
  2415. }else{
  2416. end = start + by;
  2417. }
  2418. }
  2419. Ext.apply(ra, {
  2420. start: start,
  2421. end: end,
  2422. unit: isset(unit) ? unit : me.getDefaultUnit(attr)
  2423. });
  2424. },
  2425. init: function(el, attributes, duration, method) {
  2426. var me = this,
  2427. actualFrames = 0,
  2428. mgr = EXTLIB.AnimMgr;
  2429. Ext.apply(me, {
  2430. isAnimated: false,
  2431. startTime: null,
  2432. el: Ext.getDom(el),
  2433. attributes: attributes || {},
  2434. duration: duration || 1,
  2435. method: method || EXTLIB.Easing.easeNone,
  2436. useSec: true,
  2437. curFrame: 0,
  2438. totalFrames: mgr.fps,
  2439. runAttrs: {},
  2440. animate: function(){
  2441. var me = this,
  2442. d = me.duration;
  2443. if(me.isAnimated){
  2444. return false;
  2445. }
  2446. me.curFrame = 0;
  2447. me.totalFrames = me.useSec ? Math.ceil(mgr.fps * d) : d;
  2448. mgr.registerElement(me);
  2449. },
  2450. stop: function(finish){
  2451. var me = this;
  2452. if(finish){
  2453. me.curFrame = me.totalFrames;
  2454. me._onTween.fire();
  2455. }
  2456. mgr.stop(me);
  2457. }
  2458. });
  2459. var onStart = function(){
  2460. var me = this,
  2461. attr;
  2462. me.onStart.fire();
  2463. me.runAttrs = {};
  2464. for(attr in this.attributes){
  2465. this.setRunAttr(attr);
  2466. }
  2467. me.isAnimated = true;
  2468. me.startTime = now();
  2469. actualFrames = 0;
  2470. };
  2471. var onTween = function(){
  2472. var me = this;
  2473. me.onTween.fire({
  2474. duration: now() - me.startTime,
  2475. curFrame: me.curFrame
  2476. });
  2477. var ra = me.runAttrs;
  2478. for (var attr in ra) {
  2479. this.setAttr(attr, me.doMethod(attr, ra[attr].start, ra[attr].end), ra[attr].unit);
  2480. }
  2481. ++actualFrames;
  2482. };
  2483. var onComplete = function() {
  2484. var me = this,
  2485. actual = (now() - me.startTime) / 1000,
  2486. data = {
  2487. duration: actual,
  2488. frames: actualFrames,
  2489. fps: actualFrames / actual
  2490. };
  2491. me.isAnimated = false;
  2492. actualFrames = 0;
  2493. me.onComplete.fire(data);
  2494. };
  2495. me.onStart = new Ext.util.Event(me);
  2496. me.onTween = new Ext.util.Event(me);
  2497. me.onComplete = new Ext.util.Event(me);
  2498. (me._onStart = new Ext.util.Event(me)).addListener(onStart);
  2499. (me._onTween = new Ext.util.Event(me)).addListener(onTween);
  2500. (me._onComplete = new Ext.util.Event(me)).addListener(onComplete);
  2501. }
  2502. };
  2503. Ext.lib.AnimMgr = new function() {
  2504. var me = this,
  2505. thread = null,
  2506. queue = [],
  2507. tweenCount = 0;
  2508. Ext.apply(me, {
  2509. fps: 1000,
  2510. delay: 1,
  2511. registerElement: function(tween){
  2512. queue.push(tween);
  2513. ++tweenCount;
  2514. tween._onStart.fire();
  2515. me.start();
  2516. },
  2517. unRegister: function(tween, index){
  2518. tween._onComplete.fire();
  2519. index = index || getIndex(tween);
  2520. if (index != -1) {
  2521. queue.splice(index, 1);
  2522. }
  2523. if (--tweenCount <= 0) {
  2524. me.stop();
  2525. }
  2526. },
  2527. start: function(){
  2528. if(thread === null){
  2529. thread = setInterval(me.run, me.delay);
  2530. }
  2531. },
  2532. stop: function(tween){
  2533. if(!tween){
  2534. clearInterval(thread);
  2535. for(var i = 0, len = queue.length; i < len; ++i){
  2536. if(queue[0].isAnimated){
  2537. me.unRegister(queue[0], 0);
  2538. }
  2539. }
  2540. queue = [];
  2541. thread = null;
  2542. tweenCount = 0;
  2543. }else{
  2544. me.unRegister(tween);
  2545. }
  2546. },
  2547. run: function(){
  2548. var tf, i, len, tween;
  2549. for(i = 0, len = queue.length; i<len; i++) {
  2550. tween = queue[i];
  2551. if(tween && tween.isAnimated){
  2552. tf = tween.totalFrames;
  2553. if(tween.curFrame < tf || tf === null){
  2554. ++tween.curFrame;
  2555. if(tween.useSec){
  2556. correctFrame(tween);
  2557. }
  2558. tween._onTween.fire();
  2559. }else{
  2560. me.stop(tween);
  2561. }
  2562. }
  2563. }
  2564. }
  2565. });
  2566. var getIndex = function(anim) {
  2567. var i, len;
  2568. for(i = 0, len = queue.length; i<len; i++) {
  2569. if(queue[i] === anim) {
  2570. return i;
  2571. }
  2572. }
  2573. return -1;
  2574. };
  2575. var correctFrame = function(tween) {
  2576. var frames = tween.totalFrames,
  2577. frame = tween.curFrame,
  2578. duration = tween.duration,
  2579. expected = (frame * duration * 1000 / frames),
  2580. elapsed = (now() - tween.startTime),
  2581. tweak = 0;
  2582. if(elapsed < duration * 1000){
  2583. tweak = Math.round((elapsed / expected - 1) * frame);
  2584. }else{
  2585. tweak = frames - (frame + 1);
  2586. }
  2587. if(tweak > 0 && isFinite(tweak)){
  2588. if(tween.curFrame + tweak >= frames){
  2589. tweak = frames - (frame + 1);
  2590. }
  2591. tween.curFrame += tweak;
  2592. }
  2593. };
  2594. };
  2595. EXTLIB.Bezier = new function() {
  2596. this.getPosition = function(points, t) {
  2597. var n = points.length,
  2598. tmp = [],
  2599. c = 1 - t,
  2600. i,
  2601. j;
  2602. for (i = 0; i < n; ++i) {
  2603. tmp[i] = [points[i][0], points[i][1]];
  2604. }
  2605. for (j = 1; j < n; ++j) {
  2606. for (i = 0; i < n - j; ++i) {
  2607. tmp[i][0] = c * tmp[i][0] + t * tmp[parseInt(i + 1, 10)][0];
  2608. tmp[i][1] = c * tmp[i][1] + t * tmp[parseInt(i + 1, 10)][1];
  2609. }
  2610. }
  2611. return [ tmp[0][0], tmp[0][1] ];
  2612. };
  2613. };
  2614. EXTLIB.Easing = {
  2615. easeNone: function (t, b, c, d) {
  2616. return c * t / d + b;
  2617. },
  2618. easeIn: function (t, b, c, d) {
  2619. return c * (t /= d) * t + b;
  2620. },
  2621. easeOut: function (t, b, c, d) {
  2622. return -c * (t /= d) * (t - 2) + b;
  2623. }
  2624. };
  2625. (function() {
  2626. EXTLIB.Motion = function(el, attributes, duration, method) {
  2627. if (el) {
  2628. EXTLIB.Motion.superclass.constructor.call(this, el, attributes, duration, method);
  2629. }
  2630. };
  2631. Ext.extend(EXTLIB.Motion, Ext.lib.AnimBase);
  2632. var superclass = EXTLIB.Motion.superclass,
  2633. pointsRe = /^points$/i;
  2634. Ext.apply(EXTLIB.Motion.prototype, {
  2635. setAttr: function(attr, val, unit){
  2636. var me = this,
  2637. setAttr = superclass.setAttr;
  2638. if (pointsRe.test(attr)) {
  2639. unit = unit || 'px';
  2640. setAttr.call(me, 'left', val[0], unit);
  2641. setAttr.call(me, 'top', val[1], unit);
  2642. } else {
  2643. setAttr.call(me, attr, val, unit);
  2644. }
  2645. },
  2646. getAttr: function(attr){
  2647. var me = this,
  2648. getAttr = superclass.getAttr;
  2649. return pointsRe.test(attr) ? [getAttr.call(me, 'left'), getAttr.call(me, 'top')] : getAttr.call(me, attr);
  2650. },
  2651. doMethod: function(attr, start, end){
  2652. var me = this;
  2653. return pointsRe.test(attr)
  2654. ? EXTLIB.Bezier.getPosition(me.runAttrs[attr], me.method(me.curFrame, 0, 100, me.totalFrames) / 100)
  2655. : superclass.doMethod.call(me, attr, start, end);
  2656. },
  2657. setRunAttr: function(attr){
  2658. if(pointsRe.test(attr)){
  2659. var me = this,
  2660. el = this.el,
  2661. points = this.attributes.points,
  2662. control = points.control || [],
  2663. from = points.from,
  2664. to = points.to,
  2665. by = points.by,
  2666. DOM = EXTLIB.Dom,
  2667. start,
  2668. i,
  2669. end,
  2670. len,
  2671. ra;
  2672. if(control.length > 0 && !Ext.isArray(control[0])){
  2673. control = [control];
  2674. }else{
  2675. /*
  2676. var tmp = [];
  2677. for (i = 0,len = control.length; i < len; ++i) {
  2678. tmp[i] = control[i];
  2679. }
  2680. control = tmp;
  2681. */
  2682. }
  2683. Ext.fly(el, '_anim').position();
  2684. DOM.setXY(el, isset(from) ? from : DOM.getXY(el));
  2685. start = me.getAttr('points');
  2686. if(isset(to)){
  2687. end = translateValues.call(me, to, start);
  2688. for (i = 0,len = control.length; i < len; ++i) {
  2689. control[i] = translateValues.call(me, control[i], start);
  2690. }
  2691. } else if (isset(by)) {
  2692. end = [start[0] + by[0], start[1] + by[1]];
  2693. for (i = 0,len = control.length; i < len; ++i) {
  2694. control[i] = [ start[0] + control[i][0], start[1] + control[i][1] ];
  2695. }
  2696. }
  2697. ra = this.runAttrs[attr] = [start];
  2698. if (control.length > 0) {
  2699. ra = ra.concat(control);
  2700. }
  2701. ra[ra.length] = end;
  2702. }else{
  2703. superclass.setRunAttr.call(this, attr);
  2704. }
  2705. }
  2706. });
  2707. var translateValues = function(val, start) {
  2708. var pageXY = EXTLIB.Dom.getXY(this.el);
  2709. return [val[0] - pageXY[0] + start[0], val[1] - pageXY[1] + start[1]];
  2710. };
  2711. })();
  2712. })();// Easing functions
  2713. (function(){
  2714. // shortcuts to aid compression
  2715. var abs = Math.abs,
  2716. pi = Math.PI,
  2717. asin = Math.asin,
  2718. pow = Math.pow,
  2719. sin = Math.sin,
  2720. EXTLIB = Ext.lib;
  2721. Ext.apply(EXTLIB.Easing, {
  2722. easeBoth: function (t, b, c, d) {
  2723. return ((t /= d / 2) < 1) ? c / 2 * t * t + b : -c / 2 * ((--t) * (t - 2) - 1) + b;
  2724. },
  2725. easeInStrong: function (t, b, c, d) {
  2726. return c * (t /= d) * t * t * t + b;
  2727. },
  2728. easeOutStrong: function (t, b, c, d) {
  2729. return -c * ((t = t / d - 1) * t * t * t - 1) + b;
  2730. },
  2731. easeBothStrong: function (t, b, c, d) {
  2732. return ((t /= d / 2) < 1) ? c / 2 * t * t * t * t + b : -c / 2 * ((t -= 2) * t * t * t - 2) + b;
  2733. },
  2734. elasticIn: function (t, b, c, d, a, p) {
  2735. if (t == 0 || (t /= d) == 1) {
  2736. return t == 0 ? b : b + c;
  2737. }
  2738. p = p || (d * .3);
  2739. var s;
  2740. if (a >= abs(c)) {
  2741. s = p / (2 * pi) * asin(c / a);
  2742. } else {
  2743. a = c;
  2744. s = p / 4;
  2745. }
  2746. return -(a * pow(2, 10 * (t -= 1)) * sin((t * d - s) * (2 * pi) / p)) + b;
  2747. },
  2748. elasticOut: function (t, b, c, d, a, p) {
  2749. if (t == 0 || (t /= d) == 1) {
  2750. return t == 0 ? b : b + c;
  2751. }
  2752. p = p || (d * .3);
  2753. var s;
  2754. if (a >= abs(c)) {
  2755. s = p / (2 * pi) * asin(c / a);
  2756. } else {
  2757. a = c;
  2758. s = p / 4;
  2759. }
  2760. return a * pow(2, -10 * t) * sin((t * d - s) * (2 * pi) / p) + c + b;
  2761. },
  2762. elasticBoth: function (t, b, c, d, a, p) {
  2763. if (t == 0 || (t /= d / 2) == 2) {
  2764. return t == 0 ? b : b + c;
  2765. }
  2766. p = p || (d * (.3 * 1.5));
  2767. var s;
  2768. if (a >= abs(c)) {
  2769. s = p / (2 * pi) * asin(c / a);
  2770. } else {
  2771. a = c;
  2772. s = p / 4;
  2773. }
  2774. return t < 1 ?
  2775. -.5 * (a * pow(2, 10 * (t -= 1)) * sin((t * d - s) * (2 * pi) / p)) + b :
  2776. a * pow(2, -10 * (t -= 1)) * sin((t * d - s) * (2 * pi) / p) * .5 + c + b;
  2777. },
  2778. backIn: function (t, b, c, d, s) {
  2779. s = s || 1.70158;
  2780. return c * (t /= d) * t * ((s + 1) * t - s) + b;
  2781. },
  2782. backOut: function (t, b, c, d, s) {
  2783. if (!s) {
  2784. s = 1.70158;
  2785. }
  2786. return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
  2787. },
  2788. backBoth: function (t, b, c, d, s) {
  2789. s = s || 1.70158;
  2790. return ((t /= d / 2 ) < 1) ?
  2791. c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b :
  2792. c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b;
  2793. },
  2794. bounceIn: function (t, b, c, d) {
  2795. return c - EXTLIB.Easing.bounceOut(d - t, 0, c, d) + b;
  2796. },
  2797. bounceOut: function (t, b, c, d) {
  2798. if ((t /= d) < (1 / 2.75)) {
  2799. return c * (7.5625 * t * t) + b;
  2800. } else if (t < (2 / 2.75)) {
  2801. return c * (7.5625 * (t -= (1.5 / 2.75)) * t + .75) + b;
  2802. } else if (t < (2.5 / 2.75)) {
  2803. return c * (7.5625 * (t -= (2.25 / 2.75)) * t + .9375) + b;
  2804. }
  2805. return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b;
  2806. },
  2807. bounceBoth: function (t, b, c, d) {
  2808. return (t < d / 2) ?
  2809. EXTLIB.Easing.bounceIn(t * 2, 0, c, d) * .5 + b :
  2810. EXTLIB.Easing.bounceOut(t * 2 - d, 0, c, d) * .5 + c * .5 + b;
  2811. }
  2812. });
  2813. })();
  2814. (function() {
  2815. var EXTLIB = Ext.lib;
  2816. // Color Animation
  2817. EXTLIB.Anim.color = function(el, args, duration, easing, cb, scope) {
  2818. return EXTLIB.Anim.run(el, args, duration, easing, cb, scope, EXTLIB.ColorAnim);
  2819. };
  2820. EXTLIB.ColorAnim = function(el, attributes, duration, method) {
  2821. EXTLIB.ColorAnim.superclass.constructor.call(this, el, attributes, duration, method);
  2822. };
  2823. Ext.extend(EXTLIB.ColorAnim, EXTLIB.AnimBase);
  2824. var superclass = EXTLIB.ColorAnim.superclass,
  2825. colorRE = /color$/i,
  2826. transparentRE = /^transparent|rgba\(0, 0, 0, 0\)$/,
  2827. rgbRE = /^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i,
  2828. hexRE= /^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i,
  2829. hex3RE = /^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i,
  2830. isset = function(v){
  2831. return typeof v !== 'undefined';
  2832. };
  2833. // private
  2834. function parseColor(s) {
  2835. var pi = parseInt,
  2836. base,
  2837. out = null,
  2838. c;
  2839. if (s.length == 3) {
  2840. return s;
  2841. }
  2842. Ext.each([hexRE, rgbRE, hex3RE], function(re, idx){
  2843. base = (idx % 2 == 0) ? 16 : 10;
  2844. c = re.exec(s);
  2845. if(c && c.length == 4){
  2846. out = [pi(c[1], base), pi(c[2], base), pi(c[3], base)];
  2847. return false;
  2848. }
  2849. });
  2850. return out;
  2851. }
  2852. Ext.apply(EXTLIB.ColorAnim.prototype, {
  2853. getAttr : function(attr) {
  2854. var me = this,
  2855. el = me.el,
  2856. val;
  2857. if(colorRE.test(attr)){
  2858. while(el && transparentRE.test(val = Ext.fly(el).getStyle(attr))){
  2859. el = el.parentNode;
  2860. val = "fff";
  2861. }
  2862. }else{
  2863. val = superclass.getAttr.call(me, attr);
  2864. }
  2865. return val;
  2866. },
  2867. doMethod : function(attr, start, end) {
  2868. var me = this,
  2869. val,
  2870. floor = Math.floor,
  2871. i,
  2872. len,
  2873. v;
  2874. if(colorRE.test(attr)){
  2875. val = [];
  2876. end = end || [];
  2877. for(i = 0, len = start.length; i < len; i++) {
  2878. v = start[i];
  2879. val[i] = superclass.doMethod.call(me, attr, v, end[i]);
  2880. }
  2881. val = 'rgb(' + floor(val[0]) + ',' + floor(val[1]) + ',' + floor(val[2]) + ')';
  2882. }else{
  2883. val = superclass.doMethod.call(me, attr, start, end);
  2884. }
  2885. return val;
  2886. },
  2887. setRunAttr : function(attr) {
  2888. var me = this,
  2889. a = me.attributes[attr],
  2890. to = a.to,
  2891. by = a.by,
  2892. ra;
  2893. superclass.setRunAttr.call(me, attr);
  2894. ra = me.runAttrs[attr];
  2895. if(colorRE.test(attr)){
  2896. var start = parseColor(ra.start),
  2897. end = parseColor(ra.end);
  2898. if(!isset(to) && isset(by)){
  2899. end = parseColor(by);
  2900. for(var i=0,len=start.length; i<len; i++) {
  2901. end[i] = start[i] + end[i];
  2902. }
  2903. }
  2904. ra.start = start;
  2905. ra.end = end;
  2906. }
  2907. }
  2908. });
  2909. })();
  2910. (function() {
  2911. // Scroll Animation
  2912. var EXTLIB = Ext.lib;
  2913. EXTLIB.Anim.scroll = function(el, args, duration, easing, cb, scope) {
  2914. return EXTLIB.Anim.run(el, args, duration, easing, cb, scope, EXTLIB.Scroll);
  2915. };
  2916. EXTLIB.Scroll = function(el, attributes, duration, method) {
  2917. if(el){
  2918. EXTLIB.Scroll.superclass.constructor.call(this, el, attributes, duration, method);
  2919. }
  2920. };
  2921. Ext.extend(EXTLIB.Scroll, EXTLIB.ColorAnim);
  2922. var superclass = EXTLIB.Scroll.superclass,
  2923. SCROLL = 'scroll';
  2924. Ext.apply(EXTLIB.Scroll.prototype, {
  2925. doMethod : function(attr, start, end) {
  2926. var val,
  2927. me = this,
  2928. curFrame = me.curFrame,
  2929. totalFrames = me.totalFrames;
  2930. if(attr == SCROLL){
  2931. val = [me.method(curFrame, start[0], end[0] - start[0], totalFrames),
  2932. me.method(curFrame, start[1], end[1] - start[1], totalFrames)];
  2933. }else{
  2934. val = superclass.doMethod.call(me, attr, start, end);
  2935. }
  2936. return val;
  2937. },
  2938. getAttr : function(attr) {
  2939. var me = this;
  2940. if (attr == SCROLL) {
  2941. return [me.el.scrollLeft, me.el.scrollTop];
  2942. }else{
  2943. return superclass.getAttr.call(me, attr);
  2944. }
  2945. },
  2946. setAttr : function(attr, val, unit) {
  2947. var me = this;
  2948. if(attr == SCROLL){
  2949. me.el.scrollLeft = val[0];
  2950. me.el.scrollTop = val[1];
  2951. }else{
  2952. superclass.setAttr.call(me, attr, val, unit);
  2953. }
  2954. }
  2955. });
  2956. })();
  2957. if (Ext.isIE9m) {
  2958. function fnCleanUp() {
  2959. var p = Function.prototype;
  2960. delete p.createSequence;
  2961. delete p.defer;
  2962. delete p.createDelegate;
  2963. delete p.createCallback;
  2964. delete p.createInterceptor;
  2965. window.detachEvent("onunload", fnCleanUp);
  2966. }
  2967. window.attachEvent("onunload", fnCleanUp);
  2968. }
  2969. })();