Вход Регистрация
Файл: silawar.ru/assets/9af383de/jquery.ajaxqueue.js
Строк: 114
<?php
/**
 * Ajax Queue Plugin
 * 
 * Homepage: http://jquery.com/plugins/project/ajaxqueue
 * Documentation: http://docs.jquery.com/AjaxQueue
 */

/**

<script>
$(function(){
    jQuery.ajaxQueue({
        url: "test.php",
        success: function(html){ jQuery("ul").append(html); }
    });
    jQuery.ajaxQueue({
        url: "test.php",
        success: function(html){ jQuery("ul").append(html); }
    });
    jQuery.ajaxSync({
        url: "test.php",
        success: function(html){ jQuery("ul").append("<b>"+html+"</b>"); }
    });
    jQuery.ajaxSync({
        url: "test.php",
        success: function(html){ jQuery("ul").append("<b>"+html+"</b>"); }
    });
});
</script>
<ul style="position: absolute; top: 5px; right: 5px;"></ul>

 */
/*
 * Queued Ajax requests.
 * A new Ajax request won't be started until the previous queued 
 * request has finished.
 */

/*
 * Synced Ajax requests.
 * The Ajax request will happen as soon as you call this method, but
 * the callbacks (success/error/complete) won't fire until all previous
 * synced requests have been completed.
 */


(function($) {
    
    var 
ajax = $.ajax;
    
    var 
pendingRequests = {};
    
    var 
synced = [];
    var 
syncedData = [];
    
    $.
ajax = function(settings) {
        
// create settings for compatibility with ajaxSetup
        
settings jQuery.extend(settingsjQuery.extend({}, jQuery.ajaxSettingssettings));
        
        var 
port settings.port;
        
        switch(
settings.mode) {
        case 
"abort"
            if ( 
pendingRequests[port] ) {
                
pendingRequests[port].abort();
            }
            return 
pendingRequests[port] = ajax.apply(thisarguments);
        case 
"queue"
            var 
_old settings.complete;
            
settings.complete = function(){
                if ( 
_old )
                    
_old.applythisarguments );
                
jQuery([ajax]).dequeue("ajax" port );;
            };
        
            
jQuery([ ajax ]).queue("ajax" port, function(){
                
ajaxsettings );
            });
            return;
        case 
"sync":
            var 
pos synced.length;
    
            
syncedpos ] = {
                
errorsettings.error,
                
successsettings.success,
                
completesettings.complete,
                
donefalse
            
};
        
            
syncedDatapos ] = {
                
error: [],
                
success: [],
                
complete: []
            };
        
            
settings.error = function(){ syncedDatapos ].error arguments; };
            
settings.success = function(){ syncedDatapos ].success arguments; };
            
settings.complete = function(){
                
syncedDatapos ].complete arguments;
                
syncedpos ].done true;
        
                if ( 
pos == || !syncedpos-] )
                    for ( var 
possynced.length && synced[i].donei++ ) {
                        if ( 
synced[i].error synced[i].error.applyjQuerysyncedData[i].error );
                        if ( 
synced[i].success synced[i].success.applyjQuerysyncedData[i].success );
                        if ( 
synced[i].complete synced[i].complete.applyjQuerysyncedData[i].complete );
        
                        
synced[i] = null;
                        
syncedData[i] = null;
                    }
            };
        }
        return 
ajax.apply(thisarguments);
    };
    
})(
jQuery);
?>
Онлайн: 0
Реклама