Changeset 360 for wp-slimstat-ex

Show
Ignore:
Timestamp:
07/05/08 14:39:08 (6 months ago)
Author:
082net
Message:

## wp-slimstat-ex ##

Abort previous request before new AJAX request.

Location:
wp-slimstat-ex/trunk/js
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • wp-slimstat-ex/trunk/js/ajax-slimstat-jquery.js

    r319 r360  
    125125        request:function() { 
    126126//              var self = this; 
    127                 jQuery.ajax({ 
     127                if (SlimLoading.doing_ajax) 
     128                        SlimLoading.doing_ajax.abort(); 
     129                SlimLoading.doing_ajax = jQuery.ajax({ 
     130                        async : true, 
    128131                        type : 'GET', 
    129132                        processData: false, 
     
    131134                        data: SlimLoading.par, 
    132135                        error: function(){ 
     136                        }, 
     137                        complete : function(){ 
     138                                SlimLoading.doing_ajax = null; 
    133139                        }, 
    134140                        cache: true, 
  • wp-slimstat-ex/trunk/js/ajax-slimstat-proto.js

    r319 r360  
    11/* Ajax-SlimStat */ 
    22var SlimStat = { 
     3        doing_ajax: null, 
    34        cnt: "^_^", 
    45        filter:function(){ 
     
    6364SlimLoading.prototype = { 
    6465        initialize: function(hash){ 
     66                if (SlimStat.doing_ajax) 
     67                        SlimStat.doing_ajax.transport.abort(); 
    6568                this.hash = hash; 
    6669                var pars = hash.split(SlimStat.cnt); 
     
    107110        request: function(){ 
    108111                this.tid.fader.options.onComplete = this.reset.bind(this); 
    109                 new Ajax.Updater(this.tid.id, this.url, {method: 'get', parameters: this.par, onComplete: this.after.bind(this) }); 
     112                SlimStat.doing_ajax = new Ajax.Updater(this.tid.id, this.url, {method: 'get', parameters: this.par, onComplete: this.after.bind(this) }); 
    110113        }, 
    111114        reset: function(){ 
     
    127130        after: function(){ 
    128131                this.loading.style.display = 'none'; 
     132                SlimStat.doing_ajax = null; 
    129133                this.tid.fader.custom(0.4, 0.99); 
    130134        }