⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ext-base.js

📁 ext-2.3.0
💻 JS
📖 第 1 页 / 共 3 页
字号:
this.locked=false;return true;},purgeElement:function(el,recurse,eventName){var elListeners=this.getListeners(el,eventName);if(elListeners){for(var i=0,len=elListeners.length;i<len;++i){var l=elListeners[i];this.removeListener(el,l.type,l.fn);}}if(recurse&&el&&el.childNodes){for(i=0,len=el.childNodes.length;i<len;++i){this.purgeElement(el.childNodes[i],recurse,eventName);}}},getListeners:function(el,eventName){var results=[],searchLists;if(!eventName){searchLists=[listeners,unloadListeners];}else if(eventName=="unload"){searchLists=[unloadListeners];}else{searchLists=[listeners];}for(var j=0;j<searchLists.length;++j){var searchList=searchLists[j];if(searchList&&searchList.length>0){for(var i=0,len=searchList.length;i<len;++i){var l=searchList[i];if(l&&l[this.EL]===el&&(!eventName||eventName===l[this.TYPE])){results.push({type:l[this.TYPE],fn:l[this.FN],obj:l[this.OBJ],adjust:l[this.ADJ_SCOPE],index:i});}}}}return(results.length)?results:null;},_unload:function(e){var EU=Ext.lib.Event,i,j,l,len,index;for(i=0,len=unloadListeners.length;i<len;++i){l=unloadListeners[i];if(l){var scope=window;if(l[EU.ADJ_SCOPE]){if(l[EU.ADJ_SCOPE]===true){scope=l[EU.OBJ];}else{scope=l[EU.ADJ_SCOPE];}}l[EU.FN].call(scope,EU.getEvent(e),l[EU.OBJ]);unloadListeners[i]=null;l=null;scope=null;}}unloadListeners=null;if(listeners&&listeners.length>0){j=listeners.length;while(j){index=j-1;l=listeners[index];if(l){EU.removeListener(l[EU.EL],l[EU.TYPE],l[EU.FN],index);}j=j-1;}l=null;EU.clearCache();}EU.doRemove(window,"unload",EU._unload);},getScroll:function(){var dd=document.documentElement,db=document.body;if(dd&&(dd.scrollTop||dd.scrollLeft)){return[dd.scrollTop,dd.scrollLeft];}else if(db){return[db.scrollTop,db.scrollLeft];}else{return[0,0];}},doAdd:function(){if(window.addEventListener){return function(el,eventName,fn,capture){el.addEventListener(eventName,fn,(capture));};}else if(window.attachEvent){return function(el,eventName,fn,capture){el.attachEvent("on"+eventName,fn);};}else{return function(){};}}(),doRemove:function(){if(window.removeEventListener){return function(el,eventName,fn,capture){el.removeEventListener(eventName,fn,(capture));};}else if(window.detachEvent){return function(el,eventName,fn){el.detachEvent("on"+eventName,fn);};}else{return function(){};}}()};}();var E=Ext.lib.Event;E.on=E.addListener;E.un=E.removeListener;if(document&&document.body){E._load();}else{E.doAdd(window,"load",E._load);}E.doAdd(window,"unload",E._unload);E._tryPreloadAttach();Ext.lib.Ajax={request:function(method,uri,cb,data,options){if(options){var hs=options.headers;if(hs){for(var h in hs){if(hs.hasOwnProperty(h)){this.initHeader(h,hs[h],false);}}}if(options.xmlData){if(!hs||!hs['Content-Type']){this.initHeader('Content-Type','text/xml',false);}method=(method?method:(options.method?options.method:'POST'));data=options.xmlData;}else if(options.jsonData){if(!hs||!hs['Content-Type']){this.initHeader('Content-Type','application/json',false);}method=(method?method:(options.method?options.method:'POST'));data=typeof options.jsonData=='object'?Ext.encode(options.jsonData):options.jsonData;}}return this.asyncRequest(method,uri,cb,data);},serializeForm:function(form){if(typeof form=='string'){form=(document.getElementById(form)||document.forms[form]);}var el,name,val,disabled,data='',hasSubmit=false;for(var i=0;i<form.elements.length;i++){el=form.elements[i];disabled=form.elements[i].disabled;name=form.elements[i].name;val=form.elements[i].value;if(!disabled&&name){switch(el.type){case'select-one':case'select-multiple':for(var j=0;j<el.options.length;j++){if(el.options[j].selected){var opt=el.options[j],sel=(opt.hasAttribute?opt.hasAttribute('value'):opt.getAttributeNode('value').specified)?opt.value:opt.text;data+=encodeURIComponent(name)+'='+encodeURIComponent(sel)+'&';}}break;case'radio':case'checkbox':if(el.checked){data+=encodeURIComponent(name)+'='+encodeURIComponent(val)+'&';}break;case'file':case undefined:case'reset':case'button':break;case'submit':if(hasSubmit==false){data+=encodeURIComponent(name)+'='+encodeURIComponent(val)+'&';hasSubmit=true;}break;default:data+=encodeURIComponent(name)+'='+encodeURIComponent(val)+'&';break;}}}data=data.substr(0,data.length-1);return data;},headers:{},hasHeaders:false,useDefaultHeader:true,defaultPostHeader:'application/x-www-form-urlencoded; charset=UTF-8',useDefaultXhrHeader:true,defaultXhrHeader:'XMLHttpRequest',hasDefaultHeaders:true,defaultHeaders:{},poll:{},timeout:{},pollInterval:50,transactionId:0,setProgId:function(id){this.activeX.unshift(id);},setDefaultPostHeader:function(b){this.useDefaultHeader=b;},setDefaultXhrHeader:function(b){this.useDefaultXhrHeader=b;},setPollingInterval:function(i){if(typeof i=='number'&&isFinite(i)){this.pollInterval=i;}},createXhrObject:function(transactionId){var obj,http;try{http=new XMLHttpRequest();obj={conn:http,tId:transactionId};}catch(e){for(var i=0;i<this.activeX.length;++i){try{http=new ActiveXObject(this.activeX[i]);obj={conn:http,tId:transactionId};break;}catch(e){}}}finally{return obj;}},getConnectionObject:function(){var o;var tId=this.transactionId;try{o=this.createXhrObject(tId);if(o){this.transactionId++;}}catch(e){}finally{return o;}},asyncRequest:function(method,uri,callback,postData){var o=this.getConnectionObject();if(!o){return null;}else{o.conn.open(method,uri,true);if(this.useDefaultXhrHeader){if(!this.defaultHeaders['X-Requested-With']){this.initHeader('X-Requested-With',this.defaultXhrHeader,true);}}if(postData&&this.useDefaultHeader&&(!this.hasHeaders||!this.headers['Content-Type'])){this.initHeader('Content-Type',this.defaultPostHeader);}if(this.hasDefaultHeaders||this.hasHeaders){this.setHeader(o);}this.handleReadyState(o,callback);o.conn.send(postData||null);return o;}},handleReadyState:function(o,callback){var oConn=this;if(callback&&callback.timeout){this.timeout[o.tId]=window.setTimeout(function(){oConn.abort(o,callback,true);},callback.timeout);}this.poll[o.tId]=window.setInterval(function(){if(o.conn&&o.conn.readyState==4){window.clearInterval(oConn.poll[o.tId]);delete oConn.poll[o.tId];if(callback&&callback.timeout){window.clearTimeout(oConn.timeout[o.tId]);delete oConn.timeout[o.tId];}oConn.handleTransactionResponse(o,callback);}},this.pollInterval);},handleTransactionResponse:function(o,callback,isAbort){if(!callback){this.releaseObject(o);return;}var httpStatus,responseObject;try{if(o.conn.status!==undefined&&o.conn.status!=0){httpStatus=o.conn.status;}else{httpStatus=13030;}}catch(e){httpStatus=13030;}if((httpStatus>=200&&httpStatus<300)||(Ext.isIE&&httpStatus==1223)){responseObject=this.createResponseObject(o,callback.argument);if(callback.success){if(!callback.scope){callback.success(responseObject);}else{callback.success.apply(callback.scope,[responseObject]);}}}else{switch(httpStatus){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:responseObject=this.createExceptionObject(o.tId,callback.argument,(isAbort?isAbort:false));if(callback.failure){if(!callback.scope){callback.failure(responseObject);}else{callback.failure.apply(callback.scope,[responseObject]);}}break;default:responseObject=this.createResponseObject(o,callback.argument);if(callback.failure){if(!callback.scope){callback.failure(responseObject);}else{callback.failure.apply(callback.scope,[responseObject]);}}}}this.releaseObject(o);responseObject=null;},createResponseObject:function(o,callbackArg){var obj={};var headerObj={};try{var headerStr=o.conn.getAllResponseHeaders();var header=headerStr.split('\n');for(var i=0;i<header.length;i++){var delimitPos=header[i].indexOf(':');if(delimitPos!=-1){headerObj[header[i].substring(0,delimitPos)]=header[i].substring(delimitPos+2);}}}catch(e){}obj.tId=o.tId;obj.status=o.conn.status;obj.statusText=o.conn.statusText;obj.getResponseHeader=function(header){return headerObj[header];};obj.getAllResponseHeaders=function(){return headerStr};obj.responseText=o.conn.responseText;obj.responseXML=o.conn.responseXML;if(typeof callbackArg!==undefined){obj.argument=callbackArg;}return obj;},createExceptionObject:function(tId,callbackArg,isAbort){var COMM_CODE=0;var COMM_ERROR='communication failure';var ABORT_CODE=-1;var ABORT_ERROR='transaction aborted';var obj={};obj.tId=tId;if(isAbort){obj.status=ABORT_CODE;obj.statusText=ABORT_ERROR;}else{obj.status=COMM_CODE;obj.statusText=COMM_ERROR;}if(callbackArg){obj.argument=callbackArg;}return obj;},initHeader:function(label,value,isDefault){var headerObj=(isDefault)?this.defaultHeaders:this.headers;if(headerObj[label]===undefined){headerObj[label]=value;}else{headerObj[label]=value+","+headerObj[label];}if(isDefault){this.hasDefaultHeaders=true;}else{this.hasHeaders=true;}},setHeader:function(o){if(this.hasDefaultHeaders){for(var prop in this.defaultHeaders){if(this.defaultHeaders.hasOwnProperty(prop)){o.conn.setRequestHeader(prop,this.defaultHeaders[prop]);}}}if(this.hasHeaders){for(var prop in this.headers){if(this.headers.hasOwnProperty(prop)){o.conn.setRequestHeader(prop,this.headers[prop]);}}this.headers={};this.hasHeaders=false;}},resetDefaultHeaders:function(){delete this.defaultHeaders;this.defaultHeaders={};this.hasDefaultHeaders=false;},abort:function(o,callback,isTimeout){if(this.isCallInProgress(o)){o.conn.abort();window.clearInterval(this.poll[o.tId]);delete this.poll[o.tId];if(isTimeout){delete this.timeout[o.tId];}this.handleTransactionResponse(o,callback,true);return true;}else{return false;}},isCallInProgress:function(o){if(o.conn){return o.conn.readyState!=4&&o.conn.readyState!=0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -