(function(){
var idSeed = 0;
var ua = navigator.userAgent.toLowerCase();
var isStrict = document.compatMode == "CSS1Compat",
isOpera = ua.indexOf("opera") > -1,
isSafari = (/webkit|khtml/).test(ua),
isSafari3 = isSafari && ua.indexOf('webkit/5') != -1,
isIE = !isOpera && ua.indexOf("msie") > -1,
isIE7 = !isOpera && ua.indexOf("msie 7") > -1,
isGecko = !isSafari && ua.indexOf("gecko") > -1,
isBorderBox = isIE && !isStrict,
isWindows = (ua.indexOf("windows") != -1 || ua.indexOf("win32") != -1),
isMac = (ua.indexOf("macintosh") != -1 || ua.indexOf("mac os x") != -1),
isAir = (ua.indexOf("adobeair") != -1),
isLinux = (ua.indexOf("linux") != -1),
isSecure = window.location.href.toLowerCase().indexOf("https") === 0;
if(isIE && !isIE7){
try{document.execCommand("BackgroundImageCache", false, true);}catch(e){}
}
Ext_layout.apply(Ext_layout, {
isStrict : isStrict,
isSecure : isSecure,
isReady : false,
emptyFn : function(){},
applyIf : function(o, c){
if(o && c){
for(var p in c){
if(typeof o[p] == "undefined"){ o[p] = c[p]; }
}
}
return o;
},
id : function(el, prefix){
prefix = prefix || "ext-gen";
el = Ext_layout.getDom(el);
var id = prefix + (++idSeed);
return el ? (el.id ? el.id : (el.id = id)) : id;
},
extend : function(){
var io = function(o){
for(var m in o){this[m] = o[m];}
};
var oc = Object.prototype.constructor;
return function(sb, sp, overrides){
if(typeof sp == 'object'){
overrides = sp;
sp = sb;
sb = overrides.constructor != oc ? overrides.constructor : function(){sp.apply(this, arguments);};
}
var F = function(){}, sbp, spp = sp.prototype;
F.prototype = spp;
sbp = sb.prototype = new F();
sbp.constructor=sb;
sb.superclass=spp;
if(spp.constructor == oc){spp.constructor=sp;}
sb.override = function(o){Ext_layout.override(sb, o);};
sbp.override = io;
Ext_layout.override(sb, overrides);
return sb;
};
}(),
override : function(origclass, overrides){
if(overrides){
var p = origclass.prototype;
for(var method in overrides){
p[method] = overrides[method];
}
}
},
namespace : function(){
var a=arguments, o=null, i, j, d, rt;
for (i=0; i<a.length; ++i) {
d=a[i].split(".");
rt = d[0];
eval('if (typeof ' + rt + ' == "undefined"){' + rt + ' = {};} o = ' + rt + ';');
for (j=1; j<d.length; ++j) {
o[d[j]]=o[d[j]] || {};
o=o[d[j]];
}
}
},
each : function(array, fn, scope){
if(typeof array.length == "undefined" || typeof array == "string"){array = [array];}
for(var i = 0, len = array.length; i < len; i++){
if(fn.call(scope || array[i], array[i], i, array) === false){ return i; };
}
},
escapeRe : function(s) {return s.replace(/([.*+?^${}()|[\]\/\\])/g, "\\$1");},
callback : function(cb, scope, args, delay){
if(typeof cb == "function"){
if(delay){
cb.defer(delay, scope, args || []);
}else{
cb.apply(scope, args || []);
}
}
},
getDom : function(el){
if(!el || !document){return null;}
return el.dom ? el.dom : (typeof el == 'string' ? document.getElementById(el) : el);
},
getDoc : function(){return Ext_layout.get(document);},
getBody : function(){return Ext_layout.get(document.body || document.documentElement);},
getCmp : function(id){return Ext_layout.ComponentMgr.get(id);},
destroy : function(){
for(var i = 0, a = arguments, len = a.length; i < len; i++) {
var as = a[i];
if(as){
if(as.dom){
as.removeAllListeners();
as.remove();
continue;
}
if(typeof as.destroy == 'function'){as.destroy();}
}
}
},
removeNode : isIE ? function(){
var d;
return function(n){
if(n){
d = d || document.createElement('div');
d.appendChild(n);
d.innerHTML = '';
}
}
}() : function(n){
if(n && n.parentNode){
n.parentNode.removeChild(n);
}
},
type : function(o){
if(o === undefined || o === null){return false;}
if(o.htmlElement){return 'element';}
var t = typeof o;
if(t == 'object' && o.nodeName) {
switch(o.nodeType) {
case 1: return 'element';
case 3: return (/\S/).test(o.nodeValue) ? 'textnode' : 'whitespace';
}
}
if(t == 'object' || t == 'function') {
switch(o.constructor) {
case Array: return 'array';
case RegExp: return 'regexp';
}
if(typeof o.length == 'number' && typeof o.item == 'function') {
return 'nodelist';
}
}
return t;
},
isEmpty : function(v, allowBlank){return v === null || v === undefined || (!allowBlank ? v === '' : false);},
value : function(v, defaultValue, allowBlank){return Ext_layout.isEmpty(v, allowBlank) ? defaultValue : v;},
isArray : function(v){return v && typeof v.pop == 'function';},
isOpera : isOpera,
isSafari : isSafari,
isSafari3 : isSafari3,
isSafari2 : isSafari && !isSafari3,
isIE : isIE,
isIE6 : isIE && !isIE7,
isIE7 : isIE7,
isGecko : isGecko,
isBorderBox : isBorderBox,
isLinux : isLinux,
isWindows : isWindows,
isMac : isMac,
isAir : isAir
});
Ext_layout.ns = Ext_layout.namespace;
})();这个不是定义个方法闭包,然后直接调用么?没有var的变量不就应该是全局变量么,怎么那些isIE,isOpera之类的我没法用啊?