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.

1515 lines
60 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>The source code</title>
  6. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  7. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  8. <style type="text/css">
  9. .highlight { display: block; background-color: #ddd; }
  10. </style>
  11. <script type="text/javascript">
  12. function highlight() {
  13. document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
  14. }
  15. </script>
  16. </head>
  17. <body onload="prettyPrint(); highlight();">
  18. <pre class="prettyprint lang-js">// for old browsers
  19. window.undefined = window.undefined;
  20. <span id='Ext'>/**
  21. </span> * @class Ext
  22. * Ext core utilities and functions.
  23. * @singleton
  24. */
  25. Ext = {
  26. <span id='Ext-property-version'> /**
  27. </span> * The version of the framework
  28. * @type String
  29. */
  30. version : '3.4.1.1',
  31. <span id='Ext-property-versionDetail'> versionDetail : {
  32. </span> major : 3,
  33. minor : 4,
  34. patch : 1.1
  35. }
  36. };
  37. <span id='Ext-method-apply'>/**
  38. </span> * Copies all the properties of config to obj.
  39. * @param {Object} obj The receiver of the properties
  40. * @param {Object} config The source of the properties
  41. * @param {Object} defaults A different object that will also be applied for default values
  42. * @return {Object} returns obj
  43. * @member Ext apply
  44. */
  45. Ext.apply = function(o, c, defaults){
  46. // no &quot;this&quot; reference for friendly out of scope calls
  47. if(defaults){
  48. Ext.apply(o, defaults);
  49. }
  50. if(o &amp;&amp; c &amp;&amp; typeof c == 'object'){
  51. for(var p in c){
  52. o[p] = c[p];
  53. }
  54. }
  55. return o;
  56. };
  57. (function(){
  58. var idSeed = 0,
  59. toString = Object.prototype.toString,
  60. ua = navigator.userAgent.toLowerCase(),
  61. check = function(r){
  62. return r.test(ua);
  63. },
  64. DOC = document,
  65. docMode = DOC.documentMode,
  66. isStrict = DOC.compatMode == &quot;CSS1Compat&quot;,
  67. isOpera = check(/opera/),
  68. isChrome = check(/\bchrome\b/),
  69. isWebKit = check(/webkit/),
  70. isSafari = !isChrome &amp;&amp; check(/safari/),
  71. isSafari2 = isSafari &amp;&amp; check(/applewebkit\/4/), // unique to Safari 2
  72. isSafari3 = isSafari &amp;&amp; check(/version\/3/),
  73. isSafari4 = isSafari &amp;&amp; check(/version\/4/),
  74. isIE = !isOpera &amp;&amp; check(/msie/),
  75. isIE7 = isIE &amp;&amp; ((check(/msie 7/) &amp;&amp; docMode != 8 &amp;&amp; docMode != 9 &amp;&amp; docMode != 10) || docMode == 7),
  76. isIE8 = isIE &amp;&amp; ((check(/msie 8/) &amp;&amp; docMode != 7 &amp;&amp; docMode != 9 &amp;&amp; docMode != 10) || docMode == 8),
  77. isIE9 = isIE &amp;&amp; ((check(/msie 9/) &amp;&amp; docMode != 7 &amp;&amp; docMode != 8 &amp;&amp; docMode != 10) || docMode == 9),
  78. isIE10 = isIE &amp;&amp; ((check(/msie 10/) &amp;&amp; docMode != 7 &amp;&amp; docMode != 8 &amp;&amp; docMode != 9) || docMode == 10),
  79. isIE6 = isIE &amp;&amp; check(/msie 6/),
  80. isIE9m = isIE &amp;&amp; (isIE6 || isIE7 || isIE8 || isIE9),
  81. isGecko = !isWebKit &amp;&amp; check(/gecko/),
  82. isGecko2 = isGecko &amp;&amp; check(/rv:1\.8/),
  83. isGecko3 = isGecko &amp;&amp; check(/rv:1\.9/),
  84. isBorderBox = isIE9m &amp;&amp; !isStrict,
  85. isWindows = check(/windows|win32/),
  86. isMac = check(/macintosh|mac os x/),
  87. isAir = check(/adobeair/),
  88. isLinux = check(/linux/),
  89. isSecure = /^https/i.test(window.location.protocol),
  90. noArgs = [],
  91. nonEnumerables = [],
  92. emptyFn = Ext.emptyFn,
  93. t = Ext.apply({}, {
  94. constructor: emptyFn,
  95. toString: emptyFn,
  96. valueOf: emptyFn
  97. }),
  98. callOverrideParent = function () {
  99. var method = callOverrideParent.caller.caller; // skip callParent (our caller)
  100. return method.$owner.prototype[method.$name].apply(this, arguments);
  101. };
  102. if (t.constructor !== emptyFn) {
  103. nonEnumerables.push('constructor');
  104. }
  105. if (t.toString !== emptyFn) {
  106. nonEnumerables.push('toString');
  107. }
  108. if (t.valueOf !== emptyFn) {
  109. nonEnumerables.push('valueOf');
  110. }
  111. if (!nonEnumerables.length) {
  112. nonEnumerables = null;
  113. }
  114. // Create the abstract Base class to provide an empty constructor and callParent implementations
  115. function Base () {
  116. //
  117. }
  118. Ext.apply(Base, {
  119. $isClass: true,
  120. callParent: function (args) {
  121. var method;
  122. // This code is intentionally inlined for the least number of debugger stepping
  123. return (method = this.callParent.caller) &amp;&amp; (method.$previous ||
  124. ((method = method.$owner ? method : method.caller) &amp;&amp;
  125. method.$owner.superclass.self[method.$name])).apply(this, args || noArgs);
  126. }
  127. });
  128. Base.prototype = {
  129. constructor: function() {
  130. },
  131. callParent: function(args) {
  132. // NOTE: this code is deliberately as few expressions (and no function calls)
  133. // as possible so that a debugger can skip over this noise with the minimum number
  134. // of steps. Basically, just hit Step Into until you are where you really wanted
  135. // to be.
  136. var method,
  137. superMethod = (method = this.callParent.caller) &amp;&amp; (method.$previous ||
  138. ((method = method.$owner ? method : method.caller) &amp;&amp;
  139. method.$owner.superclass[method.$name]));
  140. return superMethod.apply(this, args || noArgs);
  141. }
  142. };
  143. // remove css image flicker
  144. if(isIE6){
  145. try{
  146. DOC.execCommand(&quot;BackgroundImageCache&quot;, false, true);
  147. }catch(e){}
  148. }
  149. Ext.apply(Ext, {
  150. <span id='Ext-property-SSL_SECURE_URL'> /**
  151. </span> * URL to a blank file used by Ext when in secure mode for iframe src and onReady src to prevent
  152. * the IE insecure content warning (&lt;tt&gt;'about:blank'&lt;/tt&gt;, except for IE in secure mode, which is &lt;tt&gt;'javascript:&quot;&quot;'&lt;/tt&gt;).
  153. * @type String
  154. */
  155. SSL_SECURE_URL : isSecure &amp;&amp; isIE ? 'javascript:&quot;&quot;' : 'about:blank',
  156. <span id='Ext-property-isStrict'> /**
  157. </span> * True if the browser is in strict (standards-compliant) mode, as opposed to quirks mode
  158. * @type Boolean
  159. */
  160. isStrict : isStrict,
  161. <span id='Ext-property-isSecure'> /**
  162. </span> * True if the page is running over SSL
  163. * @type Boolean
  164. */
  165. isSecure : isSecure,
  166. <span id='Ext-property-isReady'> /**
  167. </span> * True when the document is fully initialized and ready for action
  168. * @type Boolean
  169. */
  170. isReady : false,
  171. <span id='Ext-property-enableFx'> /**
  172. </span> * True if the {@link Ext.Fx} Class is available
  173. * @type Boolean
  174. * @property enableFx
  175. */
  176. <span id='Ext-property-enableForcedBoxModel'> /**
  177. </span> * HIGHLY EXPERIMENTAL
  178. * True to force css based border-box model override and turning off javascript based adjustments. This is a
  179. * runtime configuration and must be set before onReady.
  180. * @type Boolean
  181. */
  182. enableForcedBoxModel : false,
  183. <span id='Ext-property-enableGarbageCollector'> /**
  184. </span> * True to automatically uncache orphaned Ext.Elements periodically (defaults to true)
  185. * @type Boolean
  186. */
  187. enableGarbageCollector : true,
  188. <span id='Ext-property-enableListenerCollection'> /**
  189. </span> * True to automatically purge event listeners during garbageCollection (defaults to false).
  190. * @type Boolean
  191. */
  192. enableListenerCollection : false,
  193. <span id='Ext-property-enableNestedListenerRemoval'> /**
  194. </span> * EXPERIMENTAL - True to cascade listener removal to child elements when an element is removed.
  195. * Currently not optimized for performance.
  196. * @type Boolean
  197. */
  198. enableNestedListenerRemoval : false,
  199. <span id='Ext-property-USE_NATIVE_JSON'> /**
  200. </span> * Indicates whether to use native browser parsing for JSON methods.
  201. * This option is ignored if the browser does not support native JSON methods.
  202. * &lt;b&gt;Note: Native JSON methods will not work with objects that have functions.
  203. * Also, property names must be quoted, otherwise the data will not parse.&lt;/b&gt; (Defaults to false)
  204. * @type Boolean
  205. */
  206. USE_NATIVE_JSON : false,
  207. <span id='Ext-method-applyIf'> /**
  208. </span> * Copies all the properties of config to obj if they don't already exist.
  209. * @param {Object} obj The receiver of the properties
  210. * @param {Object} config The source of the properties
  211. * @return {Object} returns obj
  212. */
  213. applyIf : function(o, c){
  214. if(o){
  215. for(var p in c){
  216. if(!Ext.isDefined(o[p])){
  217. o[p] = c[p];
  218. }
  219. }
  220. }
  221. return o;
  222. },
  223. <span id='Ext-method-id'> /**
  224. </span> * Generates unique ids. If the element already has an id, it is unchanged
  225. * @param {Mixed} el (optional) The element to generate an id for
  226. * @param {String} prefix (optional) Id prefix (defaults &quot;ext-gen&quot;)
  227. * @return {String} The generated Id.
  228. */
  229. id : function(el, prefix){
  230. el = Ext.getDom(el, true) || {};
  231. if (!el.id) {
  232. el.id = (prefix || &quot;ext-gen&quot;) + (++idSeed);
  233. }
  234. return el.id;
  235. },
  236. <span id='Ext-method-extend'> /**
  237. </span> * &lt;p&gt;Extends one class to create a subclass and optionally overrides members with the passed literal. This method
  238. * also adds the function &quot;override()&quot; to the subclass that can be used to override members of the class.&lt;/p&gt;
  239. * For example, to create a subclass of Ext GridPanel:
  240. * &lt;pre&gt;&lt;code&gt;
  241. MyGridPanel = Ext.extend(Ext.grid.GridPanel, {
  242. constructor: function(config) {
  243. // Create configuration for this Grid.
  244. var store = new Ext.data.Store({...});
  245. var colModel = new Ext.grid.ColumnModel({...});
  246. // Create a new config object containing our computed properties
  247. // *plus* whatever was in the config parameter.
  248. config = Ext.apply({
  249. store: store,
  250. colModel: colModel
  251. }, config);
  252. MyGridPanel.superclass.constructor.call(this, config);
  253. // Your postprocessing here
  254. },
  255. yourMethod: function() {
  256. // etc.
  257. }
  258. });
  259. &lt;/code&gt;&lt;/pre&gt;
  260. *
  261. * &lt;p&gt;This function also supports a 3-argument call in which the subclass's constructor is
  262. * passed as an argument. In this form, the parameters are as follows:&lt;/p&gt;
  263. * &lt;div class=&quot;mdetail-params&quot;&gt;&lt;ul&gt;
  264. * &lt;li&gt;&lt;code&gt;subclass&lt;/code&gt; : Function &lt;div class=&quot;sub-desc&quot;&gt;The subclass constructor.&lt;/div&gt;&lt;/li&gt;
  265. * &lt;li&gt;&lt;code&gt;superclass&lt;/code&gt; : Function &lt;div class=&quot;sub-desc&quot;&gt;The constructor of class being extended&lt;/div&gt;&lt;/li&gt;
  266. * &lt;li&gt;&lt;code&gt;overrides&lt;/code&gt; : Object &lt;div class=&quot;sub-desc&quot;&gt;A literal with members which are copied into the subclass's
  267. * prototype, and are therefore shared among all instances of the new class.&lt;/div&gt;&lt;/li&gt;
  268. * &lt;/ul&gt;&lt;/div&gt;
  269. *
  270. * @param {Function} superclass The constructor of class being extended.
  271. * @param {Object} overrides &lt;p&gt;A literal with members which are copied into the subclass's
  272. * prototype, and are therefore shared between all instances of the new class.&lt;/p&gt;
  273. * &lt;p&gt;This may contain a special member named &lt;tt&gt;&lt;b&gt;constructor&lt;/b&gt;&lt;/tt&gt;. This is used
  274. * to define the constructor of the new class, and is returned. If this property is
  275. * &lt;i&gt;not&lt;/i&gt; specified, a constructor is generated and returned which just calls the
  276. * superclass's constructor passing on its parameters.&lt;/p&gt;
  277. * &lt;p&gt;&lt;b&gt;It is essential that you call the superclass constructor in any provided constructor. See example code.&lt;/b&gt;&lt;/p&gt;
  278. * @return {Function} The subclass constructor from the &lt;code&gt;overrides&lt;/code&gt; parameter, or a generated one if not provided.
  279. */
  280. extend : function(){
  281. // inline overrides
  282. var io = function(o){
  283. for(var m in o){
  284. this[m] = o[m];
  285. }
  286. };
  287. var oc = Object.prototype.constructor;
  288. return function(sb, sp, overrides){
  289. if(typeof sp == 'object'){
  290. overrides = sp;
  291. sp = sb;
  292. sb = overrides.constructor != oc ? overrides.constructor : function(){sp.apply(this, arguments);};
  293. }
  294. var F = function(){},
  295. sbp,
  296. spp = sp.prototype;
  297. F.prototype = spp;
  298. sbp = sb.prototype = new F();
  299. sbp.constructor=sb;
  300. sb.superclass=spp;
  301. if(spp.constructor == oc){
  302. spp.constructor=sp;
  303. }
  304. sb.override = function(o){
  305. Ext.override(sb, o);
  306. };
  307. sbp.superclass = sbp.supr = (function(){
  308. return spp;
  309. });
  310. sbp.override = io;
  311. Ext.override(sb, overrides);
  312. sb.extend = function(o){return Ext.extend(sb, o);};
  313. return sb;
  314. };
  315. }(),
  316. global: (function () {
  317. return this;
  318. })(),
  319. Base: Base,
  320. namespaceCache: {},
  321. createNamespace: function (namespaceOrClass, isClass) {
  322. var cache = Ext.namespaceCache,
  323. namespace = isClass ? namespaceOrClass.substring(0, namespaceOrClass.lastIndexOf('.'))
  324. : namespaceOrClass,
  325. ns = cache[namespace],
  326. i, n, part, parts, partials;
  327. if (!ns) {
  328. ns = Ext.global;
  329. if (namespace) {
  330. partials = [];
  331. parts = namespace.split('.');
  332. for (i = 0, n = parts.length; i &lt; n; ++i) {
  333. part = parts[i];
  334. ns = ns[part] || (ns[part] = {});
  335. partials.push(part);
  336. cache[partials.join('.')] = ns; // build up prefixes as we go
  337. }
  338. }
  339. }
  340. return ns;
  341. },
  342. getClassByName: function (className) {
  343. var parts = className.split('.'),
  344. cls = Ext.global,
  345. n = parts.length,
  346. i;
  347. for (i = 0; cls &amp;&amp; i &lt; n; ++i) {
  348. cls = cls[parts[i]];
  349. }
  350. return cls || null;
  351. },
  352. addMembers: function (cls, target, members, handleNonEnumerables) {
  353. var i, name, member;
  354. for (name in members) {
  355. if (members.hasOwnProperty(name)) {
  356. member = members[name];
  357. if (typeof member == 'function') {
  358. member.$owner = cls;
  359. member.$name = name;
  360. }
  361. target[name] = member;
  362. }
  363. }
  364. if (handleNonEnumerables &amp;&amp; nonEnumerables) {
  365. for (i = nonEnumerables.length; i-- &gt; 0; ) {
  366. name = nonEnumerables[i];
  367. if (members.hasOwnProperty(name)) {
  368. member = members[name];
  369. if (typeof member == 'function') {
  370. member.$owner = cls;
  371. member.$name = name;
  372. }
  373. target[name] = member;
  374. }
  375. }
  376. }
  377. },
  378. <span id='Ext-method-define'> /**
  379. </span> * @method
  380. * Defines a class or override. A basic class is defined like this:
  381. *
  382. * Ext.define('My.awesome.Class', {
  383. * someProperty: 'something',
  384. *
  385. * someMethod: function(s) {
  386. * alert(s + this.someProperty);
  387. * }
  388. *
  389. * ...
  390. * });
  391. *
  392. * var obj = new My.awesome.Class();
  393. *
  394. * obj.someMethod('Say '); // alerts 'Say something'
  395. *
  396. * To create an anonymous class, pass `null` for the `className`:
  397. *
  398. * Ext.define(null, {
  399. * constructor: function () {
  400. * // ...
  401. * }
  402. * });
  403. *
  404. * In some cases, it is helpful to create a nested scope to contain some private
  405. * properties. The best way to do this is to pass a function instead of an object
  406. * as the second parameter. This function will be called to produce the class
  407. * body:
  408. *
  409. * Ext.define('MyApp.foo.Bar', function () {
  410. * var id = 0;
  411. *
  412. * return {
  413. * nextId: function () {
  414. * return ++id;
  415. * }
  416. * };
  417. * });
  418. *
  419. * When using this form of `Ext.define`, the function is passed a reference to its
  420. * class. This can be used as an efficient way to access any static properties you
  421. * may have:
  422. *
  423. * Ext.define('MyApp.foo.Bar', function (Bar) {
  424. * return {
  425. * statics: {
  426. * staticMethod: function () {
  427. * // ...
  428. * }
  429. * },
  430. *
  431. * method: function () {
  432. * return Bar.staticMethod();
  433. * }
  434. * };
  435. * });
  436. *
  437. * To define an override, include the `override` property. The content of an
  438. * override is aggregated with the specified class in order to extend or modify
  439. * that class. This can be as simple as setting default property values or it can
  440. * extend and/or replace methods. This can also extend the statics of the class.
  441. *
  442. * One use for an override is to break a large class into manageable pieces.
  443. *
  444. * // File: /src/app/Panel.js
  445. *
  446. * Ext.define('My.app.Panel', {
  447. * extend: 'Ext.panel.Panel',
  448. *
  449. * constructor: function (config) {
  450. * this.callParent(arguments); // calls Ext.panel.Panel's constructor
  451. * //...
  452. * },
  453. *
  454. * statics: {
  455. * method: function () {
  456. * return 'abc';
  457. * }
  458. * }
  459. * });
  460. *
  461. * // File: /src/app/PanelPart2.js
  462. * Ext.define('My.app.PanelPart2', {
  463. * override: 'My.app.Panel',
  464. *
  465. * constructor: function (config) {
  466. * this.callParent(arguments); // calls My.app.Panel's constructor
  467. * //...
  468. * }
  469. * });
  470. *
  471. * Another use of overrides is to provide optional parts of classes that can be
  472. * independently required. In this case, the class may even be unaware of the
  473. * override altogether.
  474. *
  475. * Ext.define('My.ux.CoolTip', {
  476. * override: 'Ext.tip.ToolTip',
  477. *
  478. * constructor: function (config) {
  479. * this.callParent(arguments); // calls Ext.tip.ToolTip's constructor
  480. * //...
  481. * }
  482. * });
  483. *
  484. * Overrides can also contain statics:
  485. *
  486. * Ext.define('My.app.BarMod', {
  487. * override: 'Ext.foo.Bar',
  488. *
  489. * statics: {
  490. * method: function (x) {
  491. * return this.callParent([x * 2]); // call Ext.foo.Bar.method
  492. * }
  493. * }
  494. * });
  495. *
  496. * @param {String} className The class name to create in string dot-namespaced format, for example:
  497. * 'My.very.awesome.Class', 'FeedViewer.plugin.CoolPager'
  498. * It is highly recommended to follow this simple convention:
  499. * - The root and the class name are 'CamelCased'
  500. * - Everything else is lower-cased
  501. * Pass `null` to create an anonymous class.
  502. * @param {Object} data The key - value pairs of properties to apply to this class. Property names can be of any valid
  503. * strings, except those in the reserved listed below:
  504. * - `mixins`
  505. * - `statics`
  506. * - `config`
  507. * - `alias`
  508. * - `self`
  509. * - `singleton`
  510. * - `alternateClassName`
  511. * - `override`
  512. *
  513. * @param {Function} createdFn Optional callback to execute after the class is created, the execution scope of which
  514. * (`this`) will be the newly created class itself.
  515. * @return {Ext.Base}
  516. * @markdown
  517. * @member Ext
  518. * @method define
  519. */
  520. define: function (className, body, createdFn) {
  521. var override = body.override,
  522. cls, extend, name, namespace;
  523. if (override) {
  524. delete body.override;
  525. cls = Ext.getClassByName(override);
  526. Ext.override(cls, body);
  527. } else {
  528. if (className) {
  529. namespace = Ext.createNamespace(className, true);
  530. name = className.substring(className.lastIndexOf('.')+1);
  531. }
  532. cls = function ctor () {
  533. this.constructor.apply(this, arguments);
  534. }
  535. if (className) {
  536. cls.displayName = className;
  537. }
  538. cls.$isClass = true;
  539. cls.callParent = Ext.Base.callParent;
  540. if (typeof body == 'function') {
  541. body = body(cls);
  542. }
  543. extend = body.extend;
  544. if (extend) {
  545. delete body.extend;
  546. if (typeof extend == 'string') {
  547. extend = Ext.getClassByName(extend);
  548. }
  549. } else {
  550. extend = Base;
  551. }
  552. Ext.extend(cls, extend, body);
  553. if (cls.prototype.constructor === cls) {
  554. delete cls.prototype.constructor;
  555. }
  556. // Not extending a class which derives from Base...
  557. if (!cls.prototype.$isClass) {
  558. Ext.applyIf(cls.prototype, Base.prototype);
  559. }
  560. cls.prototype.self = cls;
  561. if (body.xtype) {
  562. Ext.reg(body.xtype, cls);
  563. }
  564. cls = body.singleton ? new cls() : cls;
  565. if (className) {
  566. namespace[name] = cls;
  567. }
  568. }
  569. if (createdFn) {
  570. createdFn.call(cls);
  571. }
  572. return cls;
  573. },
  574. <span id='Ext-method-override'> /**
  575. </span> * Overrides members of the specified `target` with the given values.
  576. *
  577. * If the `target` is a function, it is assumed to be a constructor and the contents
  578. * of `overrides` are applied to its `prototype` using {@link Ext#apply Ext.apply}.
  579. *
  580. * If the `target` is an instance of a class created using {@link #define},
  581. * the `overrides` are applied to only that instance. In this case, methods are
  582. * specially processed to allow them to use {@link Ext.Base#callParent}.
  583. *
  584. * var panel = new Ext.Panel({ ... });
  585. *
  586. * Ext.override(panel, {
  587. * initComponent: function () {
  588. * // extra processing...
  589. *
  590. * this.callParent();
  591. * }
  592. * });
  593. *
  594. * If the `target` is none of these, the `overrides` are applied to the `target`
  595. * using {@link Ext#apply Ext.apply}.
  596. *
  597. * Please refer to {@link Ext#define Ext.define} for further details.
  598. *
  599. * @param {Object} target The target to override.
  600. * @param {Object} overrides The properties to add or replace on `target`.
  601. * @method override
  602. */
  603. override: function (target, overrides) {
  604. var proto, statics;
  605. if (overrides) {
  606. if (target.$isClass) {
  607. statics = overrides.statics;
  608. if (statics) {
  609. delete overrides.statics;
  610. }
  611. Ext.addMembers(target, target.prototype, overrides, true);
  612. if (statics) {
  613. Ext.addMembers(target, target, statics);
  614. }
  615. } else if (typeof target == 'function') {
  616. proto = target.prototype;
  617. Ext.apply(proto, overrides);
  618. if(Ext.isIE &amp;&amp; overrides.hasOwnProperty('toString')){
  619. proto.toString = overrides.toString;
  620. }
  621. } else {
  622. var owner = target.self,
  623. name, value;
  624. if (owner &amp;&amp; owner.$isClass) {
  625. for (name in overrides) {
  626. if (overrides.hasOwnProperty(name)) {
  627. value = overrides[name];
  628. if (typeof value == 'function') {
  629. //&lt;debug&gt;
  630. if (owner.$className) {
  631. value.displayName = owner.$className + '#' + name;
  632. }
  633. //&lt;/debug&gt;
  634. value.$name = name;
  635. value.$owner = owner;
  636. value.$previous = target.hasOwnProperty(name)
  637. ? target[name] // already hooked, so call previous hook
  638. : callOverrideParent; // calls by name on prototype
  639. }
  640. target[name] = value;
  641. }
  642. }
  643. } else {
  644. Ext.apply(target, overrides);
  645. if (!target.constructor.$isClass) {
  646. target.constructor.prototype.callParent = Base.prototype.callParent;
  647. target.constructor.callParent = Base.callParent;
  648. }
  649. }
  650. }
  651. }
  652. },
  653. <span id='Ext-method-namespace'> /**
  654. </span> * Creates namespaces to be used for scoping variables and classes so that they are not global.
  655. * Specifying the last node of a namespace implicitly creates all other nodes. Usage:
  656. * &lt;pre&gt;&lt;code&gt;
  657. Ext.namespace('Company', 'Company.data');
  658. Ext.namespace('Company.data'); // equivalent and preferable to above syntax
  659. Company.Widget = function() { ... }
  660. Company.data.CustomStore = function(config) { ... }
  661. &lt;/code&gt;&lt;/pre&gt;
  662. * @param {String} namespace1
  663. * @param {String} namespace2
  664. * @param {String} etc
  665. * @return {Object} The namespace object. (If multiple arguments are passed, this will be the last namespace created)
  666. * @method namespace
  667. */
  668. namespace : function(){
  669. var len1 = arguments.length,
  670. i = 0,
  671. len2,
  672. j,
  673. main,
  674. ns,
  675. sub,
  676. current;
  677. for(; i &lt; len1; ++i) {
  678. main = arguments[i];
  679. ns = arguments[i].split('.');
  680. current = window[ns[0]];
  681. if (current === undefined) {
  682. current = window[ns[0]] = {};
  683. }
  684. sub = ns.slice(1);
  685. len2 = sub.length;
  686. for(j = 0; j &lt; len2; ++j) {
  687. current = current[sub[j]] = current[sub[j]] || {};
  688. }
  689. }
  690. return current;
  691. },
  692. <span id='Ext-method-urlEncode'> /**
  693. </span> * Takes an object and converts it to an encoded URL. e.g. Ext.urlEncode({foo: 1, bar: 2}); would return &quot;foo=1&amp;bar=2&quot;. 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.
  694. * @param {Object} o
  695. * @param {String} pre (optional) A prefix to add to the url encoded string
  696. * @return {String}
  697. */
  698. urlEncode : function(o, pre){
  699. var empty,
  700. buf = [],
  701. e = encodeURIComponent;
  702. Ext.iterate(o, function(key, item){
  703. empty = Ext.isEmpty(item);
  704. Ext.each(empty ? key : item, function(val){
  705. buf.push('&amp;', e(key), '=', (!Ext.isEmpty(val) &amp;&amp; (val != key || !empty)) ? (Ext.isDate(val) ? Ext.encode(val).replace(/&quot;/g, '') : e(val)) : '');
  706. });
  707. });
  708. if(!pre){
  709. buf.shift();
  710. pre = '';
  711. }
  712. return pre + buf.join('');
  713. },
  714. <span id='Ext-method-urlDecode'> /**
  715. </span> * Takes an encoded URL and and converts it to an object. Example: &lt;pre&gt;&lt;code&gt;
  716. Ext.urlDecode(&quot;foo=1&amp;bar=2&quot;); // returns {foo: &quot;1&quot;, bar: &quot;2&quot;}
  717. Ext.urlDecode(&quot;foo=1&amp;bar=2&amp;bar=3&amp;bar=4&quot;, false); // returns {foo: &quot;1&quot;, bar: [&quot;2&quot;, &quot;3&quot;, &quot;4&quot;]}
  718. &lt;/code&gt;&lt;/pre&gt;
  719. * @param {String} string
  720. * @param {Boolean} overwrite (optional) Items of the same name will overwrite previous values instead of creating an an array (Defaults to false).
  721. * @return {Object} A literal with members
  722. */
  723. urlDecode : function(string, overwrite){
  724. if(Ext.isEmpty(string)){
  725. return {};
  726. }
  727. var obj = {},
  728. pairs = string.split('&amp;'),
  729. d = decodeURIComponent,
  730. name,
  731. value;
  732. Ext.each(pairs, function(pair) {
  733. pair = pair.split('=');
  734. name = d(pair[0]);
  735. value = d(pair[1]);
  736. obj[name] = overwrite || !obj[name] ? value :
  737. [].concat(obj[name]).concat(value);
  738. });
  739. return obj;
  740. },
  741. <span id='Ext-method-urlAppend'> /**
  742. </span> * Appends content to the query string of a URL, handling logic for whether to place
  743. * a question mark or ampersand.
  744. * @param {String} url The URL to append to.
  745. * @param {String} s The content to append to the URL.
  746. * @return (String) The resulting URL
  747. */
  748. urlAppend : function(url, s){
  749. if(!Ext.isEmpty(s)){
  750. return url + (url.indexOf('?') === -1 ? '?' : '&amp;') + s;
  751. }
  752. return url;
  753. },
  754. <span id='Ext-method-toArray'> /**
  755. </span> * Converts any iterable (numeric indices and a length property) into a true array
  756. * Don't use this on strings. IE doesn't support &quot;abc&quot;[0] which this implementation depends on.
  757. * For strings, use this instead: &quot;abc&quot;.match(/./g) =&gt; [a,b,c];
  758. * @param {Iterable} the iterable object to be turned into a true Array.
  759. * @return (Array) array
  760. */
  761. toArray : function(){
  762. return isIE ?
  763. function(a, i, j, res){
  764. res = [];
  765. for(var x = 0, len = a.length; x &lt; len; x++) {
  766. res.push(a[x]);
  767. }
  768. return res.slice(i || 0, j || res.length);
  769. } :
  770. function(a, i, j){
  771. return Array.prototype.slice.call(a, i || 0, j || a.length);
  772. };
  773. }(),
  774. isIterable : function(v){
  775. //check for array or arguments
  776. if(Ext.isArray(v) || v.callee){
  777. return true;
  778. }
  779. //check for node list type
  780. if(/NodeList|HTMLCollection/.test(toString.call(v))){
  781. return true;
  782. }
  783. //NodeList has an item and length property
  784. //IXMLDOMNodeList has nextNode method, needs to be checked first.
  785. return ((typeof v.nextNode != 'undefined' || v.item) &amp;&amp; Ext.isNumber(v.length));
  786. },
  787. <span id='Ext-method-each'> /**
  788. </span> * Iterates an array calling the supplied function.
  789. * @param {Array/NodeList/Mixed} array The array to be iterated. If this
  790. * argument is not really an array, the supplied function is called once.
  791. * @param {Function} fn The function to be called with each item. If the
  792. * supplied function returns false, iteration stops and this method returns
  793. * the current &lt;code&gt;index&lt;/code&gt;. This function is called with
  794. * the following arguments:
  795. * &lt;div class=&quot;mdetail-params&quot;&gt;&lt;ul&gt;
  796. * &lt;li&gt;&lt;code&gt;item&lt;/code&gt; : &lt;i&gt;Mixed&lt;/i&gt;
  797. * &lt;div class=&quot;sub-desc&quot;&gt;The item at the current &lt;code&gt;index&lt;/code&gt;
  798. * in the passed &lt;code&gt;array&lt;/code&gt;&lt;/div&gt;&lt;/li&gt;
  799. * &lt;li&gt;&lt;code&gt;index&lt;/code&gt; : &lt;i&gt;Number&lt;/i&gt;
  800. * &lt;div class=&quot;sub-desc&quot;&gt;The current index within the array&lt;/div&gt;&lt;/li&gt;
  801. * &lt;li&gt;&lt;code&gt;allItems&lt;/code&gt; : &lt;i&gt;Array&lt;/i&gt;
  802. * &lt;div class=&quot;sub-desc&quot;&gt;The &lt;code&gt;array&lt;/code&gt; passed as the first
  803. * argument to &lt;code&gt;Ext.each&lt;/code&gt;.&lt;/div&gt;&lt;/li&gt;
  804. * &lt;/ul&gt;&lt;/div&gt;
  805. * @param {Object} scope The scope (&lt;code&gt;this&lt;/code&gt; reference) in which the specified function is executed.
  806. * Defaults to the &lt;code&gt;item&lt;/code&gt; at the current &lt;code&gt;index&lt;/code&gt;
  807. * within the passed &lt;code&gt;array&lt;/code&gt;.
  808. * @return See description for the fn parameter.
  809. */
  810. each : function(array, fn, scope){
  811. if(Ext.isEmpty(array, true)){
  812. return;
  813. }
  814. if(!Ext.isIterable(array) || Ext.isPrimitive(array)){
  815. array = [array];
  816. }
  817. for(var i = 0, len = array.length; i &lt; len; i++){
  818. if(fn.call(scope || array[i], array[i], i, array) === false){
  819. return i;
  820. };
  821. }
  822. },
  823. <span id='Ext-method-iterate'> /**
  824. </span> * Iterates either the elements in an array, or each of the properties in an object.
  825. * &lt;b&gt;Note&lt;/b&gt;: If you are only iterating arrays, it is better to call {@link #each}.
  826. * @param {Object/Array} object The object or array to be iterated
  827. * @param {Function} fn The function to be called for each iteration.
  828. * The iteration will stop if the supplied function returns false, or
  829. * all array elements / object properties have been covered. The signature
  830. * varies depending on the type of object being interated:
  831. * &lt;div class=&quot;mdetail-params&quot;&gt;&lt;ul&gt;
  832. * &lt;li&gt;Arrays : &lt;tt&gt;(Object item, Number index, Array allItems)&lt;/tt&gt;
  833. * &lt;div class=&quot;sub-desc&quot;&gt;
  834. * When iterating an array, the supplied function is called with each item.&lt;/div&gt;&lt;/li&gt;
  835. * &lt;li&gt;Objects : &lt;tt&gt;(String key, Object value, Object)&lt;/tt&gt;
  836. * &lt;div class=&quot;sub-desc&quot;&gt;
  837. * When iterating an object, the supplied function is called with each key-value pair in
  838. * the object, and the iterated object&lt;/div&gt;&lt;/li&gt;
  839. * &lt;/ul&gt;&lt;/div&gt;
  840. * @param {Object} scope The scope (&lt;code&gt;this&lt;/code&gt; reference) in which the specified function is executed. Defaults to
  841. * the &lt;code&gt;object&lt;/code&gt; being iterated.
  842. */
  843. iterate : function(obj, fn, scope){
  844. if(Ext.isEmpty(obj)){
  845. return;
  846. }
  847. if(Ext.isIterable(obj)){
  848. Ext.each(obj, fn, scope);
  849. return;
  850. }else if(typeof obj == 'object'){
  851. for(var prop in obj){
  852. if(obj.hasOwnProperty(prop)){
  853. if(fn.call(scope || obj, prop, obj[prop], obj) === false){
  854. return;
  855. };
  856. }
  857. }
  858. }
  859. },
  860. <span id='Ext-method-getDom'> /**
  861. </span> * Return the dom node for the passed String (id), dom node, or Ext.Element.
  862. * Optional 'strict' flag is needed for IE since it can return 'name' and
  863. * 'id' elements by using getElementById.
  864. * Here are some examples:
  865. * &lt;pre&gt;&lt;code&gt;
  866. // gets dom node based on id
  867. var elDom = Ext.getDom('elId');
  868. // gets dom node based on the dom node
  869. var elDom1 = Ext.getDom(elDom);
  870. // If we don&amp;#39;t know if we are working with an
  871. // Ext.Element or a dom node use Ext.getDom
  872. function(el){
  873. var dom = Ext.getDom(el);
  874. // do something with the dom node
  875. }
  876. * &lt;/code&gt;&lt;/pre&gt;
  877. * &lt;b&gt;Note&lt;/b&gt;: the dom node to be found actually needs to exist (be rendered, etc)
  878. * when this method is called to be successful.
  879. * @param {Mixed} el
  880. * @return HTMLElement
  881. */
  882. getDom : function(el, strict){
  883. if(!el || !DOC){
  884. return null;
  885. }
  886. if (el.dom){
  887. return el.dom;
  888. } else {
  889. if (typeof el == 'string') {
  890. var e = DOC.getElementById(el);
  891. // IE returns elements with the 'name' and 'id' attribute.
  892. // we do a strict check to return the element with only the id attribute
  893. if (e &amp;&amp; isIE &amp;&amp; strict) {
  894. if (el == e.getAttribute('id')) {
  895. return e;
  896. } else {
  897. return null;
  898. }
  899. }
  900. return e;
  901. } else {
  902. return el;
  903. }
  904. }
  905. },
  906. <span id='Ext-method-getBody'> /**
  907. </span> * Returns the current document body as an {@link Ext.Element}.
  908. * @return Ext.Element The document body
  909. */
  910. getBody : function(){
  911. return Ext.get(DOC.body || DOC.documentElement);
  912. },
  913. <span id='Ext-method-getHead'> /**
  914. </span> * Returns the current document body as an {@link Ext.Element}.
  915. * @return Ext.Element The document body
  916. * @method
  917. */
  918. getHead : function() {
  919. var head;
  920. return function() {
  921. if (head == undefined) {
  922. head = Ext.get(DOC.getElementsByTagName(&quot;head&quot;)[0]);
  923. }
  924. return head;
  925. };
  926. }(),
  927. <span id='Ext-method-removeNode'> /**
  928. </span> * &lt;p&gt;Removes this element from the document, removes all DOM event listeners, and deletes the cache reference.
  929. * All DOM event listeners are removed from this element. If {@link Ext#enableNestedListenerRemoval} is
  930. * &lt;code&gt;true&lt;/code&gt;, then DOM event listeners are also removed from all child nodes. The body node
  931. * will be ignored if passed in.&lt;/p&gt;
  932. * @param {HTMLElement} node The node to remove
  933. * @method
  934. */
  935. removeNode : isIE &amp;&amp; !isIE8 ? function(){
  936. var d;
  937. return function(n){
  938. if(n &amp;&amp; n.tagName != 'BODY'){
  939. (Ext.enableNestedListenerRemoval) ? Ext.EventManager.purgeElement(n, true) : Ext.EventManager.removeAll(n);
  940. d = d || DOC.createElement('div');
  941. d.appendChild(n);
  942. d.innerHTML = '';
  943. delete Ext.elCache[n.id];
  944. }
  945. };
  946. }() : function(n){
  947. if(n &amp;&amp; n.parentNode &amp;&amp; n.tagName != 'BODY'){
  948. (Ext.enableNestedListenerRemoval) ? Ext.EventManager.purgeElement(n, true) : Ext.EventManager.removeAll(n);
  949. n.parentNode.removeChild(n);
  950. delete Ext.elCache[n.id];
  951. }
  952. },
  953. <span id='Ext-method-isEmpty'> /**
  954. </span> * &lt;p&gt;Returns true if the passed value is empty.&lt;/p&gt;
  955. * &lt;p&gt;The value is deemed to be empty if it is&lt;div class=&quot;mdetail-params&quot;&gt;&lt;ul&gt;
  956. * &lt;li&gt;null&lt;/li&gt;
  957. * &lt;li&gt;undefined&lt;/li&gt;
  958. * &lt;li&gt;an empty array&lt;/li&gt;
  959. * &lt;li&gt;a zero length string (Unless the &lt;tt&gt;allowBlank&lt;/tt&gt; parameter is &lt;tt&gt;true&lt;/tt&gt;)&lt;/li&gt;
  960. * &lt;/ul&gt;&lt;/div&gt;
  961. * @param {Mixed} value The value to test
  962. * @param {Boolean} allowBlank (optional) true to allow empty strings (defaults to false)
  963. * @return {Boolean}
  964. */
  965. isEmpty : function(v, allowBlank){
  966. return v === null || v === undefined || ((Ext.isArray(v) &amp;&amp; !v.length)) || (!allowBlank ? v === '' : false);
  967. },
  968. <span id='Ext-method-isArray'> /**
  969. </span> * Returns true if the passed value is a JavaScript array, otherwise false.
  970. * @param {Mixed} value The value to test
  971. * @return {Boolean}
  972. */
  973. isArray : function(v){
  974. return toString.apply(v) === '[object Array]';
  975. },
  976. <span id='Ext-method-isDate'> /**
  977. </span> * Returns true if the passed object is a JavaScript date object, otherwise false.
  978. * @param {Object} object The object to test
  979. * @return {Boolean}
  980. */
  981. isDate : function(v){
  982. return toString.apply(v) === '[object Date]';
  983. },
  984. <span id='Ext-method-isObject'> /**
  985. </span> * Returns true if the passed value is a JavaScript Object, otherwise false.
  986. * @param {Mixed} value The value to test
  987. * @return {Boolean}
  988. */
  989. isObject : function(v){
  990. return !!v &amp;&amp; Object.prototype.toString.call(v) === '[object Object]';
  991. },
  992. <span id='Ext-method-isPrimitive'> /**
  993. </span> * Returns true if the passed value is a JavaScript 'primitive', a string, number or boolean.
  994. * @param {Mixed} value The value to test
  995. * @return {Boolean}
  996. */
  997. isPrimitive : function(v){
  998. return Ext.isString(v) || Ext.isNumber(v) || Ext.isBoolean(v);
  999. },
  1000. <span id='Ext-method-isFunction'> /**
  1001. </span> * Returns true if the passed value is a JavaScript Function, otherwise false.
  1002. * @param {Mixed} value The value to test
  1003. * @return {Boolean}
  1004. */
  1005. isFunction : function(v){
  1006. return toString.apply(v) === '[object Function]';
  1007. },
  1008. <span id='Ext-method-isNumber'> /**
  1009. </span> * Returns true if the passed value is a number. Returns false for non-finite numbers.
  1010. * @param {Mixed} value The value to test
  1011. * @return {Boolean}
  1012. */
  1013. isNumber : function(v){
  1014. return typeof v === 'number' &amp;&amp; isFinite(v);
  1015. },
  1016. <span id='Ext-method-isString'> /**
  1017. </span> * Returns true if the passed value is a string.
  1018. * @param {Mixed} value The value to test
  1019. * @return {Boolean}
  1020. */
  1021. isString : function(v){
  1022. return typeof v === 'string';
  1023. },
  1024. <span id='Ext-method-isBoolean'> /**
  1025. </span> * Returns true if the passed value is a boolean.
  1026. * @param {Mixed} value The value to test
  1027. * @return {Boolean}
  1028. */
  1029. isBoolean : function(v){
  1030. return typeof v === 'boolean';
  1031. },
  1032. <span id='Ext-method-isElement'> /**
  1033. </span> * Returns true if the passed value is an HTMLElement
  1034. * @param {Mixed} value The value to test
  1035. * @return {Boolean}
  1036. */
  1037. isElement : function(v) {
  1038. return v ? !!v.tagName : false;
  1039. },
  1040. <span id='Ext-method-isDefined'> /**
  1041. </span> * Returns true if the passed value is not undefined.
  1042. * @param {Mixed} value The value to test
  1043. * @return {Boolean}
  1044. */
  1045. isDefined : function(v){
  1046. return typeof v !== 'undefined';
  1047. },
  1048. <span id='Ext-property-isOpera'> /**
  1049. </span> * True if the detected browser is Opera.
  1050. * @type Boolean
  1051. */
  1052. isOpera : isOpera,
  1053. <span id='Ext-property-isWebKit'> /**
  1054. </span> * True if the detected browser uses WebKit.
  1055. * @type Boolean
  1056. */
  1057. isWebKit : isWebKit,
  1058. <span id='Ext-property-isChrome'> /**
  1059. </span> * True if the detected browser is Chrome.
  1060. * @type Boolean
  1061. */
  1062. isChrome : isChrome,
  1063. <span id='Ext-property-isSafari'> /**
  1064. </span> * True if the detected browser is Safari.
  1065. * @type Boolean
  1066. */
  1067. isSafari : isSafari,
  1068. <span id='Ext-property-isSafari3'> /**
  1069. </span> * True if the detected browser is Safari 3.x.
  1070. * @type Boolean
  1071. */
  1072. isSafari3 : isSafari3,
  1073. <span id='Ext-property-isSafari4'> /**
  1074. </span> * True if the detected browser is Safari 4.x.
  1075. * @type Boolean
  1076. */
  1077. isSafari4 : isSafari4,
  1078. <span id='Ext-property-isSafari2'> /**
  1079. </span> * True if the detected browser is Safari 2.x.
  1080. * @type Boolean
  1081. */
  1082. isSafari2 : isSafari2,
  1083. <span id='Ext-property-isIE'> /**
  1084. </span> * True if the detected browser is Internet Explorer.
  1085. * @type Boolean
  1086. */
  1087. isIE : isIE,
  1088. <span id='Ext-property-isIE6'> /**
  1089. </span> * True if the detected browser is Internet Explorer 6.x.
  1090. * @type Boolean
  1091. */
  1092. isIE6 : isIE6,
  1093. <span id='Ext-property-isIE7'> /**
  1094. </span> * True if the detected browser is Internet Explorer 7.x.
  1095. * @type Boolean
  1096. */
  1097. isIE7 : isIE7,
  1098. <span id='Ext-property-isIE8'> /**
  1099. </span> * True if the detected browser is Internet Explorer 8.x.
  1100. * @type Boolean
  1101. */
  1102. isIE8 : isIE8,
  1103. <span id='Ext-property-isIE9'> /**
  1104. </span> * True if the detected browser is Internet Explorer 9.x.
  1105. * @type Boolean
  1106. */
  1107. isIE9 : isIE9,
  1108. <span id='Ext-property-isIE10'> /**
  1109. </span> * True if the detected browser is Internet Explorer 10.x
  1110. * @type Boolean
  1111. */
  1112. isIE10 : isIE10,
  1113. <span id='Ext-property-isIE9m'> /**
  1114. </span> * True if the detected browser is Internet Explorer 9.x or lower
  1115. * @type Boolean
  1116. */
  1117. isIE9m : isIE9m,
  1118. <span id='Ext-property-isIE10p'> /**
  1119. </span> * True if the detected browser is Internet Explorer 10.x or higher
  1120. * @type Boolean
  1121. */
  1122. isIE10p : isIE &amp;&amp; !(isIE6 || isIE7 || isIE8 || isIE9),
  1123. // IE10 quirks behaves like Gecko/WebKit quirks, so don't include it here
  1124. // Used internally
  1125. isIEQuirks: isIE &amp;&amp; (!isStrict &amp;&amp; (isIE6 || isIE7 || isIE8 || isIE9)),
  1126. <span id='Ext-property-isGecko'> /**
  1127. </span> * True if the detected browser uses the Gecko layout engine (e.g. Mozilla, Firefox).
  1128. * @type Boolean
  1129. */
  1130. isGecko : isGecko,
  1131. <span id='Ext-property-isGecko2'> /**
  1132. </span> * True if the detected browser uses a pre-Gecko 1.9 layout engine (e.g. Firefox 2.x).
  1133. * @type Boolean
  1134. */
  1135. isGecko2 : isGecko2,
  1136. <span id='Ext-property-isGecko3'> /**
  1137. </span> * True if the detected browser uses a Gecko 1.9+ layout engine (e.g. Firefox 3.x).
  1138. * @type Boolean
  1139. */
  1140. isGecko3 : isGecko3,
  1141. <span id='Ext-property-isBorderBox'> /**
  1142. </span> * True if the detected browser is Internet Explorer running in non-strict mode.
  1143. * @type Boolean
  1144. */
  1145. isBorderBox : isBorderBox,
  1146. <span id='Ext-property-isLinux'> /**
  1147. </span> * True if the detected platform is Linux.
  1148. * @type Boolean
  1149. */
  1150. isLinux : isLinux,
  1151. <span id='Ext-property-isWindows'> /**
  1152. </span> * True if the detected platform is Windows.
  1153. * @type Boolean
  1154. */
  1155. isWindows : isWindows,
  1156. <span id='Ext-property-isMac'> /**
  1157. </span> * True if the detected platform is Mac OS.
  1158. * @type Boolean
  1159. */
  1160. isMac : isMac,
  1161. <span id='Ext-property-isAir'> /**
  1162. </span> * True if the detected platform is Adobe Air.
  1163. * @type Boolean
  1164. */
  1165. isAir : isAir
  1166. });
  1167. <span id='Ext-method-ns'> /**
  1168. </span> * Creates namespaces to be used for scoping variables and classes so that they are not global.
  1169. * Specifying the last node of a namespace implicitly creates all other nodes. Usage:
  1170. * &lt;pre&gt;&lt;code&gt;
  1171. Ext.namespace('Company', 'Company.data');
  1172. Ext.namespace('Company.data'); // equivalent and preferable to above syntax
  1173. Company.Widget = function() { ... }
  1174. Company.data.CustomStore = function(config) { ... }
  1175. &lt;/code&gt;&lt;/pre&gt;
  1176. * @param {String} namespace1
  1177. * @param {String} namespace2
  1178. * @param {String} etc
  1179. * @return {Object} The namespace object. (If multiple arguments are passed, this will be the last namespace created)
  1180. * @method ns
  1181. */
  1182. Ext.ns = Ext.namespace;
  1183. })();
  1184. Ext.ns('Ext.util', 'Ext.lib', 'Ext.data', 'Ext.supports');
  1185. Ext.elCache = {};
  1186. <span id='Function'>/**
  1187. </span> * @class Function
  1188. * These functions are available on every Function object (any JavaScript function).
  1189. */
  1190. Ext.apply(Function.prototype, {
  1191. <span id='Function-method-createInterceptor'> /**
  1192. </span> * Creates an interceptor function. The passed function is called before the original one. If it returns false,
  1193. * the original one is not called. The resulting function returns the results of the original function.
  1194. * The passed function is called with the parameters of the original function. Example usage:
  1195. * &lt;pre&gt;&lt;code&gt;
  1196. var sayHi = function(name){
  1197. alert('Hi, ' + name);
  1198. }
  1199. sayHi('Fred'); // alerts &quot;Hi, Fred&quot;
  1200. // create a new function that validates input without
  1201. // directly modifying the original function:
  1202. var sayHiToFriend = sayHi.createInterceptor(function(name){
  1203. return name == 'Brian';
  1204. });
  1205. sayHiToFriend('Fred'); // no alert
  1206. sayHiToFriend('Brian'); // alerts &quot;Hi, Brian&quot;
  1207. &lt;/code&gt;&lt;/pre&gt;
  1208. * @param {Function} fcn The function to call before the original
  1209. * @param {Object} scope (optional) The scope (&lt;code&gt;&lt;b&gt;this&lt;/b&gt;&lt;/code&gt; reference) in which the passed function is executed.
  1210. * &lt;b&gt;If omitted, defaults to the scope in which the original function is called or the browser window.&lt;/b&gt;
  1211. * @return {Function} The new function
  1212. */
  1213. createInterceptor : function(fcn, scope){
  1214. var method = this;
  1215. return !Ext.isFunction(fcn) ?
  1216. this :
  1217. function() {
  1218. var me = this,
  1219. args = arguments;
  1220. fcn.target = me;
  1221. fcn.method = method;
  1222. return (fcn.apply(scope || me || window, args) !== false) ?
  1223. method.apply(me || window, args) :
  1224. null;
  1225. };
  1226. },
  1227. <span id='Function-method-createCallback'> /**
  1228. </span> * Creates a callback that passes arguments[0], arguments[1], arguments[2], ...
  1229. * Call directly on any function. Example: &lt;code&gt;myFunction.createCallback(arg1, arg2)&lt;/code&gt;
  1230. * Will create a function that is bound to those 2 args. &lt;b&gt;If a specific scope is required in the
  1231. * callback, use {@link #createDelegate} instead.&lt;/b&gt; The function returned by createCallback always
  1232. * executes in the window scope.
  1233. * &lt;p&gt;This method is required when you want to pass arguments to a callback function. If no arguments
  1234. * are needed, you can simply pass a reference to the function as a callback (e.g., callback: myFn).
  1235. * However, if you tried to pass a function with arguments (e.g., callback: myFn(arg1, arg2)) the function
  1236. * would simply execute immediately when the code is parsed. Example usage:
  1237. * &lt;pre&gt;&lt;code&gt;
  1238. var sayHi = function(name){
  1239. alert('Hi, ' + name);
  1240. }
  1241. // clicking the button alerts &quot;Hi, Fred&quot;
  1242. new Ext.Button({
  1243. text: 'Say Hi',
  1244. renderTo: Ext.getBody(),
  1245. handler: sayHi.createCallback('Fred')
  1246. });
  1247. &lt;/code&gt;&lt;/pre&gt;
  1248. * @return {Function} The new function
  1249. */
  1250. createCallback : function(/*args...*/){
  1251. // make args available, in function below
  1252. var args = arguments,
  1253. method = this;
  1254. return function() {
  1255. return method.apply(window, args);
  1256. };
  1257. },
  1258. <span id='Function-method-createDelegate'> /**
  1259. </span> * Creates a delegate (callback) that sets the scope to obj.
  1260. * Call directly on any function. Example: &lt;code&gt;this.myFunction.createDelegate(this, [arg1, arg2])&lt;/code&gt;
  1261. * Will create a function that is automatically scoped to obj so that the &lt;tt&gt;this&lt;/tt&gt; variable inside the
  1262. * callback points to obj. Example usage:
  1263. * &lt;pre&gt;&lt;code&gt;
  1264. var sayHi = function(name){
  1265. // Note this use of &quot;this.text&quot; here. This function expects to
  1266. // execute within a scope that contains a text property. In this
  1267. // example, the &quot;this&quot; variable is pointing to the btn object that
  1268. // was passed in createDelegate below.
  1269. alert('Hi, ' + name + '. You clicked the &quot;' + this.text + '&quot; button.');
  1270. }
  1271. var btn = new Ext.Button({
  1272. text: 'Say Hi',
  1273. renderTo: Ext.getBody()
  1274. });
  1275. // This callback will execute in the scope of the
  1276. // button instance. Clicking the button alerts
  1277. // &quot;Hi, Fred. You clicked the &quot;Say Hi&quot; button.&quot;
  1278. btn.on('click', sayHi.createDelegate(btn, ['Fred']));
  1279. &lt;/code&gt;&lt;/pre&gt;
  1280. * @param {Object} scope (optional) The scope (&lt;code&gt;&lt;b&gt;this&lt;/b&gt;&lt;/code&gt; reference) in which the function is executed.
  1281. * &lt;b&gt;If omitted, defaults to the browser window.&lt;/b&gt;
  1282. * @param {Array} args (optional) Overrides arguments for the call. (Defaults to the arguments passed by the caller)
  1283. * @param {Boolean/Number} appendArgs (optional) if True args are appended to call args instead of overriding,
  1284. * if a number the args are inserted at the specified position
  1285. * @return {Function} The new function
  1286. */
  1287. createDelegate : function(obj, args, appendArgs){
  1288. var method = this;
  1289. return function() {
  1290. var callArgs = args || arguments;
  1291. if (appendArgs === true){
  1292. callArgs = Array.prototype.slice.call(arguments, 0);
  1293. callArgs = callArgs.concat(args);
  1294. }else if (Ext.isNumber(appendArgs)){
  1295. callArgs = Array.prototype.slice.call(arguments, 0); // copy arguments first
  1296. var applyArgs = [appendArgs, 0].concat(args); // create method call params
  1297. Array.prototype.splice.apply(callArgs, applyArgs); // splice them in
  1298. }
  1299. return method.apply(obj || window, callArgs);
  1300. };
  1301. },
  1302. <span id='Function-method-defer'> /**
  1303. </span> * Calls this function after the number of millseconds specified, optionally in a specific scope. Example usage:
  1304. * &lt;pre&gt;&lt;code&gt;
  1305. var sayHi = function(name){
  1306. alert('Hi, ' + name);
  1307. }
  1308. // executes immediately:
  1309. sayHi('Fred');
  1310. // executes after 2 seconds:
  1311. sayHi.defer(2000, this, ['Fred']);
  1312. // this syntax is sometimes useful for deferring
  1313. // execution of an anonymous function:
  1314. (function(){
  1315. alert('Anonymous');
  1316. }).defer(100);
  1317. &lt;/code&gt;&lt;/pre&gt;
  1318. * @param {Number} millis The number of milliseconds for the setTimeout call (if less than or equal to 0 the function is executed immediately)
  1319. * @param {Object} scope (optional) The scope (&lt;code&gt;&lt;b&gt;this&lt;/b&gt;&lt;/code&gt; reference) in which the function is executed.
  1320. * &lt;b&gt;If omitted, defaults to the browser window.&lt;/b&gt;
  1321. * @param {Array} args (optional) Overrides arguments for the call. (Defaults to the arguments passed by the caller)
  1322. * @param {Boolean/Number} appendArgs (optional) if True args are appended to call args instead of overriding,
  1323. * if a number the args are inserted at the specified position
  1324. * @return {Number} The timeout id that can be used with clearTimeout
  1325. */
  1326. defer : function(millis, obj, args, appendArgs){
  1327. var fn = this.createDelegate(obj, args, appendArgs);
  1328. if(millis &gt; 0){
  1329. return setTimeout(fn, millis);
  1330. }
  1331. fn();
  1332. return 0;
  1333. }
  1334. });
  1335. <span id='String'>/**
  1336. </span> * @class String
  1337. * These functions are available on every String object.
  1338. */
  1339. Ext.applyIf(String, {
  1340. <span id='String-static-method-format'> /**
  1341. </span> * Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the tokens. Each
  1342. * token must be unique, and must increment in the format {0}, {1}, etc. Example usage:
  1343. * &lt;pre&gt;&lt;code&gt;
  1344. var cls = 'my-class', text = 'Some text';
  1345. var s = String.format('&amp;lt;div class=&quot;{0}&quot;&gt;{1}&amp;lt;/div&gt;', cls, text);
  1346. // s now contains the string: '&amp;lt;div class=&quot;my-class&quot;&gt;Some text&amp;lt;/div&gt;'
  1347. * &lt;/code&gt;&lt;/pre&gt;
  1348. * @param {String} string The tokenized string to be formatted
  1349. * @param {String} value1 The value to replace token {0}
  1350. * @param {String} value2 Etc...
  1351. * @return {String} The formatted string
  1352. * @static
  1353. */
  1354. format : function(format){
  1355. var args = Ext.toArray(arguments, 1);
  1356. return format.replace(/\{(\d+)\}/g, function(m, i){
  1357. return args[i];
  1358. });
  1359. }
  1360. });
  1361. <span id='Array'>/**
  1362. </span> * @class Array
  1363. */
  1364. Ext.applyIf(Array.prototype, {
  1365. <span id='Array-method-indexOf'> /**
  1366. </span> * Checks whether or not the specified object exists in the array.
  1367. * @param {Object} o The object to check for
  1368. * @param {Number} from (Optional) The index at which to begin the search
  1369. * @return {Number} The index of o in the array (or -1 if it is not found)
  1370. */
  1371. indexOf : function(o, from){
  1372. var len = this.length;
  1373. from = from || 0;
  1374. from += (from &lt; 0) ? len : 0;
  1375. for (; from &lt; len; ++from){
  1376. if(this[from] === o){
  1377. return from;
  1378. }
  1379. }
  1380. return -1;
  1381. },
  1382. <span id='Array-method-remove'> /**
  1383. </span> * Removes the specified object from the array. If the object is not found nothing happens.
  1384. * @param {Object} o The object to remove
  1385. * @return {Array} this array
  1386. */
  1387. remove : function(o){
  1388. var index = this.indexOf(o);
  1389. if(index != -1){
  1390. this.splice(index, 1);
  1391. }
  1392. return this;
  1393. }
  1394. });
  1395. </pre>
  1396. </body>
  1397. </html>