Guest User

Untitled

a guest
Jan 26th, 2011
285
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if( jQuery.ajaxPrefilter ) {
  2.     jQuery.ajaxPrefilter(function( options, _, xhr ) {
  3.         var port = settings.port;
  4.         if( settings.mode === "abort" ) {
  5.             if ( pendingRequests[port] ) {
  6.                pendingRequests[port].abort();
  7.             }
  8.                 pendingRequests[port] = xhr;
  9.         }
  10.     });
  11. } else {
  12.     (function($) {
  13.         var ajax = $.ajax;
  14.         var pendingRequests = {};
  15.         $.ajax = function(settings) {
  16.             // create settings for compatibility with ajaxSetup
  17.             settings = $.extend(settings, $.extend({}, $.ajaxSettings, settings));
  18.             var port = settings.port;
  19.             if (settings.mode == "abort") {
  20.                 if ( pendingRequests[port] ) {
  21.                     pendingRequests[port].abort();
  22.                 }
  23.                 return (pendingRequests[port] = ajax.apply(this, arguments));
  24.             }
  25.             return ajax.apply(this, arguments);
  26.         };
  27.     })(jQuery);
  28. }
RAW Paste Data