1
0
Fork 0
mirror of https://github.com/Oreolek/debug-toolbar.git synced 2024-04-28 07:09:18 +03:00

Merge pull request #26 from smgladkovskiy/3.3

Ajax event caching (jQuery v1.8+)
This commit is contained in:
Ivan Brotkin 2013-02-13 05:57:51 -08:00
commit dc96821f2c

View file

@ -93,13 +93,15 @@ if (typeof jQuery != 'undefined') {
// display ajax button in toolbar
$('#toggle-ajax').css({display: 'inline'});
var debugAjax = $('#debug-ajax');
// bind ajax event
$('#debug-ajax').bind("ajaxComplete", function(event, xmlrequest, ajaxOptions){
$(document).ajaxComplete(function(event, xmlrequest, ajaxOptions){
// add a new row to ajax table
$('#debug-ajax table').append(
debugAjax.find('table').append(
'<tr class="even">' +
'<td>' + $('#debug-ajax table tr').size() +'<\/td>' +
'<td>' + debugAjax.find('table tr').size() +'<\/td>' +
'<td>jQuery ' + jQuery.fn.jquery + '<\/td>' +
'<td>' + xmlrequest.statusText + ' (' + xmlrequest.status + ')<\/td>' +
'<td>' + ajaxOptions.url + '<\/td>' +
@ -107,10 +109,10 @@ if (typeof jQuery != 'undefined') {
);
// stripe table
$('#debug-ajax table tbody tr:nth-child(even)').attr('class', 'odd');
debugAjax.find('table tbody tr:nth-child(even)').attr('class', 'odd');
// update count in toolbar
$('#toggle-ajax span').text($('#debug-ajax table tr').size()-1);
$('#toggle-ajax').find('span').text(debugAjax.find('table tr').size()-1);
});
});
@ -119,4 +121,3 @@ if (typeof jQuery != 'undefined') {
if (typeof Prototype != 'undefined') {
}