Ticket #35501: 35501.5.patch
File 35501.5.patch, 3.5 KB (added by , 8 years ago) |
---|
-
src/wp-admin/js/edit-comments.js
288 288 $('.avatar', el).first().clone().prependTo('#undo-' + id + ' .' + action + '-undo-inside'); 289 289 290 290 a.click(function( e ){ 291 292 // Abort undo if there is an unfinished AJAX request involving the same comment. 293 if ( settings.xhrs && undefined !== settings.xhrs['comment-' + id] && 4 !== settings.xhrs['comment-' + id].readyState ) { 294 return false; 295 } 291 296 e.preventDefault(); 292 297 e.stopPropagation(); // ticket #35904 293 298 list.wpList.del(this); -
src/wp-includes/js/wp-lists.js
17 17 dimBefore: null, dimAfter: null 18 18 }, 19 19 20 xhrs: {}, 21 20 22 nonce: function(e,s) { 21 23 var url = wpAjax.unserialize(e.attr('href')); 22 24 return s.nonce || url._ajax_nonce || $('#' + s.element + ' input[name="_ajax_nonce"]').val() || url._wpnonce || $('#' + s.element + ' input[name="_wpnonce"]').val() || 0; … … 160 162 * @return {boolean} 161 163 */ 162 164 ajaxDel: function( e, s ) { 165 166 // Clear all finished AJAX requests from xhrs object. 167 if ( undefined !== wpList.xhrs ) { 168 for ( var key in wpList.xhrs ) { 169 if ( 4 === wpList.xhrs[key].readyState ) { 170 delete wpList.xhrs[key]; 171 } 172 } 173 } 174 163 175 e = $(e); 164 176 s = s || {}; 165 177 var list = this, data = wpList.parseData(e,'delete'), element, res, rres; … … 168 180 169 181 s.element = data[2] || s.element || null; 170 182 183 // Return if there is already an AJAX request in progress involving the same comment. 184 if ( wpList.xhrs && undefined !== wpList.xhrs[s.element] && 4 !== wpList.xhrs[s.element].readyState ) { 185 return false; 186 } 187 171 188 if ( data[3] ) 172 189 s.delColor = '#' + data[3]; 173 190 else … … 225 242 } 226 243 }; 227 244 228 $.ajax( s ); 245 wpList.xhrs = wpList.xhrs || {}; 246 wpList.xhrs[s.element] = $.ajax( s ); 229 247 return false; 230 248 }, 231 249 … … 233 251 if ( $(e).parent().css('display') == 'none' ) // Prevent hidden links from being clicked by hotkeys 234 252 return false; 235 253 254 // Clear all finished AJAX requests from xhrs object. 255 if ( undefined !== wpList.xhrs ) { 256 for ( var key in wpList.xhrs ) { 257 if ( 4 === wpList.xhrs[key].readyState ) { 258 delete wpList.xhrs[key]; 259 } 260 } 261 } 262 236 263 e = $(e); 237 264 s = s || {}; 238 265 … … 243 270 s.element = data[2] || s.element || null; 244 271 s.dimClass = data[3] || s.dimClass || null; 245 272 273 // Return if there is already an AJAX request in progress involving the same comment. 274 if ( wpList.xhrs && undefined !== wpList.xhrs[s.element] && 4 !== wpList.xhrs[s.element].readyState ) { 275 return false; 276 } 277 278 246 279 if ( data[4] ) 247 280 s.dimAddColor = '#' + data[4]; 248 281 else … … 330 363 } 331 364 }; 332 365 333 $.ajax( s ); 366 wpList.xhrs = wpList.xhrs || {}; 367 wpList.xhrs[s.element] = $.ajax( s ); 334 368 return false; 335 369 }, 336 370 … … 487 521 this.each( function() { 488 522 var _this = this; 489 523 490 this.wpList = { settings: $.extend( {}, wpList.settings, { what: wpList.parseData(this,'list')[1] || '' }, settings ) }; 524 this.wpList = { 525 settings: $.extend( {}, wpList.settings, { what: wpList.parseData(this,'list')[1] || '' }, { xhrs: wpList.xhrs }, settings ) 526 }; 491 527 $.each( fs, function(i,f) { _this.wpList[i] = function( e, s ) { return wpList[f].call( _this, e, s ); }; } ); 492 528 } ); 493 529