fix formatting and set Ext.USE_NATIVE_JSON to true

This commit is contained in:
Damien Churchill 2010-01-23 15:35:44 +00:00
parent 031f75a2bb
commit a3d98029f9
1 changed files with 37 additions and 27 deletions

View File

@ -40,42 +40,52 @@ Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
(function() { (function() {
/* Add some helper functions to Ext */ /* Add some helper functions to Ext */
Ext.apply(Function.prototype, { Ext.apply(Function.prototype, {
bind: function(scope) { bind: function(scope) {
var self = this; var self = this;
return function() { return function() {
return self.apply(scope, arguments); return self.apply(scope, arguments);
} }
} }
}); });
Ext.apply(Ext, { Ext.apply(Ext, {
escapeHTML: function(text) { escapeHTML: function(text) {
text = String(text).replace('<', '&lt;').replace('>', '&gt;'); text = String(text).replace('<', '&lt;').replace('>', '&gt;');
return text.replace('&', '&amp;'); return text.replace('&', '&amp;');
}, },
isObjectEmpty: function(obj) { isObjectEmpty: function(obj) {
for(var i in obj) { return false; } for(var i in obj) { return false; }
return true; return true;
}, },
keys: function(obj) { keys: function(obj) {
var keys = []; var keys = [];
for (i in obj) if (obj.hasOwnProperty(i)) for (var i in obj) if (obj.hasOwnProperty(i))
{ {
keys.push(i); keys.push(i);
} }
return keys; return keys;
}, },
splat: function(obj) { values: function(obj) {
var type = Ext.type(obj); var values = [];
return (type) ? ((type != 'array') ? [obj] : obj) : []; for (var i in obj) {
} if (obj.hasOwnProperty(i)) {
values.push(obj[i]);
}
}
return values;
},
splat: function(obj) {
var type = Ext.type(obj);
return (type) ? ((type != 'array') ? [obj] : obj) : [];
}
}); });
Ext.getKeys = Ext.keys; Ext.getKeys = Ext.keys;
Ext.BLANK_IMAGE_URL = '/images/s.gif'; Ext.BLANK_IMAGE_URL = '/images/s.gif';
Ext.USE_NATIVE_JSON = true;
})(); })();
(function() { (function() {