<html>\r
<head>\r
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> \r
<title>The source code</title>\r
<link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
<script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
</head>\r
<body onload="prettyPrint();">\r
- <pre class="prettyprint lang-js">/**
+ <pre class="prettyprint lang-js"><div id="cls-Ext"></div>/**
* @class Ext
*/
-Ext.ns("Ext.grid", "Ext.dd", "Ext.tree", "Ext.form", "Ext.menu",
+Ext.ns("Ext.grid", "Ext.list", "Ext.dd", "Ext.tree", "Ext.form", "Ext.menu",
"Ext.state", "Ext.layout", "Ext.app", "Ext.ux", "Ext.chart", "Ext.direct");
<div id="prop-Ext-ux"></div>/**
* Namespace alloted for extensions to the framework.
*/
Ext.apply(Ext, function(){
- var E = Ext, idSeed = 0;
+ var E = Ext,
+ idSeed = 0,
+ scrollWidth = null;
return {
<div id="prop-Ext-emptyFn"></div>/**
* For other browsers it uses an inline data URL.
* @type String
*/
- BLANK_IMAGE_URL : Ext.isIE6 || Ext.isIE7 ?
+ BLANK_IMAGE_URL : Ext.isIE6 || Ext.isIE7 || Ext.isAir ?
'http:/' + '/extjs.com/s.gif' :
'data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==',
return Ext.get(document);
},
- <div id="method-Ext-isDate"></div>/**
- * Returns true if the passed object is a JavaScript date object, otherwise false.
- * @param {Object} object The object to test
- * @return {Boolean}
- */
- isDate : function(v){
- return Object.prototype.toString.apply(v) === '[object Date]';
- },
-
<div id="method-Ext-num"></div>/**
* Utility method for validating that a value is numeric, returning the specified default value if it is not.
* @param {Mixed} value Should be a number, but any type will be handled appropriately
* @return {Number} Value, if numeric, else defaultValue
*/
num : function(v, defaultValue){
- v = Number(v === null || typeof v == 'boolean'? NaN : v);
- return isNaN(v)? defaultValue : v;
+ v = Number(Ext.isEmpty(v) || Ext.isArray(v) || Ext.isBoolean(v) || (Ext.isString(v) && v.trim().length == 0) ? NaN : v);
+ return isNaN(v) ? defaultValue : v;
},
<div id="method-Ext-value"></div>/**
* @return {String}
*/
escapeRe : function(s) {
- return s.replace(/([.*+?^${}()|[\]\/\\])/g, "\\$1");
+ return s.replace(/([-.*+?^${}()|[\]\/\\])/g, "\\$1");
},
sequence : function(o, name, fn, scope){
cache = null;
}
},
+
+ <div id="method-Ext-getScrollBarWidth"></div>/**
+ * Utility method for getting the width of the browser scrollbar. This can differ depending on
+ * operating system settings, such as the theme or font size.
+ * @param {Boolean} force (optional) true to force a recalculation of the value.
+ * @return {Number} The width of the scrollbar.
+ */
+ getScrollBarWidth: function(force){
+ if(!Ext.isReady){
+ return 0;
+ }
+
+ if(force === true || scrollWidth === null){
+ // Append our div, do our calculation and then remove it
+ var div = Ext.getBody().createChild('<div class="x-hide-offsets" style="width:100px;height:50px;overflow:hidden;"><div style="height:200px;"></div></div>'),
+ child = div.child('div', true);
+ var w1 = child.offsetWidth;
+ div.setStyle('overflow', (Ext.isWebKit || Ext.isGecko) ? 'auto' : 'scroll');
+ var w2 = child.offsetWidth;
+ div.remove();
+ // Need to add 2 to ensure we leave enough space
+ scrollWidth = w1 - w2 + 2;
+ }
+ return scrollWidth;
+ },
// deprecated
* @return {Object} The modified object.
*/
copyTo : function(dest, source, names){
- if(typeof names == 'string'){
+ if(Ext.isString(names)){
names = names.split(/[,;\s]/);
}
Ext.each(names, function(name){
* @return {Number} The mean.
*/
mean : function(arr){
- return Ext.sum(arr) / arr.length;
+ return arr.length > 0 ? Ext.sum(arr) / arr.length : undefined;
},
<div id="method-Ext-sum"></div>/**
var ret = [],
args = Array.prototype.slice.call(arguments, 2);
Ext.each(arr, function(v,i) {
- if (v && typeof v[methodName] == "function") {
+ if (v && Ext.isFunction(v[methodName])) {
ret.push(v[methodName].apply(v, args));
} else {
ret.push(undefined);
case RegExp: return 'regexp';
case Date: return 'date';
}
- if(typeof o.length == 'number' && typeof o.item == 'function') {
+ if(Ext.isNumber(o.length) && Ext.isFunction(o.item)) {
return 'nodelist';
}
}
};
}());
-/**
+<div id="cls-Function"></div>/**
* @class Function
* These functions are available on every Function object (any JavaScript function).
*/
sayGoodbye('Fred'); // both alerts show
</code></pre>
* @param {Function} fcn The function to sequence
- * @param {Object} scope (optional) The scope of the passed fcn (Defaults to scope of original function or window)
+ * @param {Object} scope (optional) The scope (<code><b>this</b></code> reference) in which the passed function is executed.
+ * <b>If omitted, defaults to the scope in which the original function is called or the browser window.</b>
* @return {Function} The new function
*/
createSequence : function(fcn, scope){
});
-/**
+<div id="cls-String"></div>/**
* @class String
* These functions are available as static methods on the JavaScript String object.
*/