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

📄 connection-min.js

📁 ext js demo ext学习资料
💻 JS
字号:
/*
 * Ext JS Library 1.1 RC 1
 * Copyright(c) 2006-2007, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://www.extjs.com/license
 */

Ext.data.Connection=function(_1){Ext.apply(this,_1);this.addEvents({"beforerequest":true,"requestcomplete":true,"requestexception":true});Ext.data.Connection.superclass.constructor.call(this);};Ext.extend(Ext.data.Connection,Ext.util.Observable,{timeout:30000,autoAbort:false,request:function(o){if(this.fireEvent("beforerequest",this,o)!==false){var p=o.params;if(typeof p=="function"){p=p.call(o.scope||window,o);}if(typeof p=="object"){p=Ext.urlEncode(o.params);}if(this.extraParams){var _4=Ext.urlEncode(this.extraParams);p=p?(p+"&"+_4):_4;}var _5=o.url||this.url;if(typeof _5=="function"){_5=_5.call(o.scope||window,o);}if(o.form){var _6=Ext.getDom(o.form);_5=_5||_6.action;var _7=_6.getAttribute("enctype");if(o.isUpload||(_7&&_7.toLowerCase()=="multipart/form-data")){return this.doFormUpload(o,p,_5);}var f=Ext.lib.Ajax.serializeForm(_6);p=p?(p+"&"+f):f;}var hs=o.headers;if(this.defaultHeaders){hs=Ext.apply(hs||{},this.defaultHeaders);if(!o.headers){o.headers=hs;}}var cb={success:this.handleResponse,failure:this.handleFailure,scope:this,argument:{options:o},timeout:this.timeout};var _b=o.method||this.method||(p?"POST":"GET");if(typeof o.autoAbort=="boolean"){if(o.autoAbort){this.abort();}}else{if(this.autoAbort!==false){this.abort();}}if((_b=="GET"&&p)||o.xmlData){_5+=(_5.indexOf("?")!=-1?"&":"?")+p;p="";}this.transId=Ext.lib.Ajax.request(_b,_5,cb,p,o);return this.transId;}else{Ext.callback(o.callback,o.scope,[o,null,null]);return null;}},isLoading:function(_c){if(_c){return Ext.lib.Ajax.isCallInProgress(_c);}else{return this.transId?true:false;}},abort:function(_d){if(_d||this.isLoading()){Ext.lib.Ajax.abort(_d||this.transId);}},handleResponse:function(_e){this.transId=false;var _f=_e.argument.options;_e.argument=_f?_f.argument:null;this.fireEvent("requestcomplete",this,_e,_f);Ext.callback(_f.success,_f.scope,[_e,_f]);Ext.callback(_f.callback,_f.scope,[_f,true,_e]);},handleFailure:function(_10,e){this.transId=false;var _12=_10.argument.options;_10.argument=_12?_12.argument:null;this.fireEvent("requestexception",this,_10,_12,e);Ext.callback(_12.failure,_12.scope,[_10,_12]);Ext.callback(_12.callback,_12.scope,[_12,false,_10]);},doFormUpload:function(o,ps,url){var id=Ext.id();var _17=document.createElement("iframe");_17.id=id;_17.name=id;_17.className="x-hidden";if(Ext.isIE){_17.src=Ext.SSL_SECURE_URL;}document.body.appendChild(_17);if(Ext.isIE){document.frames[id].name=id;}var _18=Ext.getDom(o.form);_18.target=id;_18.method="POST";_18.enctype=_18.encoding="multipart/form-data";if(url){_18.action=url;}var _19,hd;if(ps){_19=[];ps=Ext.urlDecode(ps,false);for(var k in ps){if(ps.hasOwnProperty(k)){hd=document.createElement("input");hd.type="hidden";hd.name=k;hd.value=ps[k];_18.appendChild(hd);_19.push(hd);}}}function cb(){var r={responseText:"",responseXML:null};try{var doc;if(Ext.isIE){doc=_17.contentWindow.document;}else{doc=(_17.contentDocument||window.frames[id].document);}if(doc&&doc.body){r.responseText=doc.body.innerHTML;}if(doc&&doc.XMLDocument){r.responseXML=doc.XMLDocument;}else{r.responseXML=doc;}}catch(e){}Ext.EventManager.removeListener(_17,"load",cb,this);this.fireEvent("requestcomplete",this,r,o);Ext.callback(o.success,o.scope,[r,o]);Ext.callback(o.callback,o.scope,[o,true,r]);setTimeout(function(){document.body.removeChild(_17);},100);}Ext.EventManager.on(_17,"load",cb,this);_18.submit();if(_19){for(var i=0,len=_19.length;i<len;i++){_18.removeChild(_19[i]);}}}});Ext.Ajax=new Ext.data.Connection({autoAbort:false,serializeForm:function(_20){return Ext.lib.Ajax.serializeForm(_20);}});

⌨️ 快捷键说明

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