ajax_queue.js {PARTE 1}
Código PHP:
var g_ajax_obj = new c_ajax_object;
function c_ajax_object() {
};
c_ajax_object.prototype._dm_xmlhttprequest_type=null;
c_ajax_object.prototype._dm_xmlhttprequestobject=null;
c_ajax_object.prototype._dm_callback_function=null;
c_ajax_object.prototype._dm_param=null;
c_ajax_object.prototype._dm_partialcallback_function=null;
c_ajax_object.prototype._dm_param2=null;
c_ajax_object.prototype._dm_phase=0;
c_ajax_object.prototype._dm_queue=new Array();
c_ajax_object.prototype._dm_queue_state=true;
c_ajax_object.prototype._dm_committed=false;
c_ajax_object.prototype._dm_pre_queue_in_url=null;
c_ajax_object.prototype._dm_pre_queue_in_callback=null;
c_ajax_object.prototype._dm_pre_queue_in_method=null;
c_ajax_object.prototype._dm_pre_queue_in_param=null;
c_ajax_object.prototype._dm_pre_queue_in_pcallback=null;
c_ajax_object.prototype._dm_pre_queue_in_param2=null;
c_ajax_object.prototype._dm_pre_queue_in_c2_phase=0;
c_ajax_object.prototype.GetNewRequestObject = function() {
if (window.XMLHttpRequest) {
this._dm_xmlhttprequestobject = new XMLHttpRequest();
} else if (window.ActiveXObject) {
if (this._dm_xmlhttprequest_type) {
this._dm_xmlhttprequestobject = new ActiveXObject(this._dm_xmlhttprequest_type);
} else {
var versions = ["Msxml2.XMLHTTP.7.0", "Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"];
for (var i = 0; i < versions.length ; i++) {
try {
this._dm_xmlhttprequestobject = new ActiveXObject(versions[i]);
if (this._dm_xmlhttprequestobject) {
this._dm_xmlhttprequest_type = versions[i];
break;
}}
catch (objException) {};};}}};
c_ajax_object.prototype.QueueFlush = function ( ) {
this._dm_queue = new Array();
this.QueueResume(); // If the queue was paused, it is now re-enabled
}c_ajax_object.prototype.QueuePause = function ( ) {
this._dm_queue_state = false;
}c_ajax_object.prototype.QueueResume = function ( ) {
this._dm_queue_state = true;
this.Dequeue();
}c_ajax_object.prototype.QueueInterrupt = function ( in_url, in_callback, in_method, in_param, in_pcallback, in_param2, in_phase ) {
var url = in_url;
this._dm_callback_function = in_callback;
var method = in_method;
this._dm_param = in_param;
this._dm_partialcallback_function = in_pcallback;
this._dm_param2 = in_param2;
this._dm_phase = in_phase;
if ( url && method ) {
ret = this._CallXMLHTTPObject ( url, method );
}
return ret;
}
c_ajax_object.prototype.QueueInject = function ( in_url, in_callback, in_method, in_param, in_pcallback, in_param2, in_phase ) {
this._dm_queue_state = false;
for ( var counter = this._dm_queue.length; counter > 0; counter-- ) {
this._dm_queue[counter] = this._dm_queue[counter - 1];}
this._dm_queue[0] = new Array ( in_url, in_callback, in_method, in_param, in_pcallback, in_param2, in_phase );
this._dm_queue_state = true; // We don't call DeQueue, so we won't interrupt any request in progress.
}
c_ajax_object.prototype.CallXMLHTTPObjectGET = function ( in_url, in_callback ) {return this.CallXMLHTTPObject ( in_url, in_callback, "GET", null, null, 0 );
}c_ajax_object.prototype.CallXMLHTTPObjectGETParam = function ( in_url, in_callback, in_param ) {
return this.CallXMLHTTPObject ( in_url, in_callback, "GET", in_param, null, 0 );
}c_ajax_object.prototype.CallXMLHTTPObjectGETParamPartial = function ( in_url, in_callback, in_param, in_pcallback, in_param2 ) {
return this.CallXMLHTTPObject ( in_url, in_callback, "GET", in_param, in_pcallback, in_param2, 0 );}
c_ajax_object.prototype.CallXMLHTTPObjectGETParamPartialPhase = function ( in_url, in_callback, in_param, in_pcallback, in_param2, in_phase ) {return this.CallXMLHTTPObject ( in_url, in_callback, "GET", in_param, in_pcallback, in_param2, in_phase );
}
c_ajax_object.prototype.CallXMLHTTPObjectPOST = function ( in_url, in_callback ) {
return this.CallXMLHTTPObject ( in_url, in_callback, "POST", null, null, 0 );
}
Continua en otro post..