1
0
mirror of https://github.com/maximebf/php-debugbar.git synced 2025-07-24 02:01:30 +02:00

Merge branch 'master' into feat-dataset-tab

This commit is contained in:
Barry vd. Heuvel
2024-03-20 14:12:08 +01:00
8 changed files with 587 additions and 20 deletions

View File

@@ -72,9 +72,9 @@ class JavascriptRenderer
protected $ajaxHandlerBindToFetch = false;
protected $ajaxHandlerBindToJquery = true;
protected $ajaxHandlerBindToJquery = false;
protected $ajaxHandlerBindToXHR = false;
protected $ajaxHandlerBindToXHR = true;
protected $ajaxHandlerAutoShow = true;
@@ -509,6 +509,7 @@ class JavascriptRenderer
* Sets whether to call bindToJquery() on the ajax handler
*
* @param boolean $bind
* @deprecated use setBindAjaxHandlerToXHR
*/
public function setBindAjaxHandlerToJquery($bind = true)
{
@@ -520,6 +521,7 @@ class JavascriptRenderer
* Checks whether bindToJquery() will be called on the ajax handler
*
* @return boolean
* @deprecated use isAjaxHandlerBoundToXHR
*/
public function isAjaxHandlerBoundToJquery()
{

View File

@@ -451,8 +451,8 @@ if (typeof(PhpDebugBar) == 'undefined') {
resize: function() {
var contentSize = this.respCSSSize;
if (this.respCSSSize == 0) {
this.$header.find("> div > *:visible").each(function () {
contentSize += $(this).outerWidth();
this.$header.find("> *:visible").each(function () {
contentSize += $(this).outerWidth(true);
});
}
@@ -1026,6 +1026,7 @@ if (typeof(PhpDebugBar) == 'undefined') {
self.getControl(key).set('data', d);
}
});
self.resize();
},
/**
@@ -1227,10 +1228,7 @@ if (typeof(PhpDebugBar) == 'undefined') {
},
/**
* Attaches an event listener to jQuery.ajaxComplete()
*
* @this {AjaxHandler}
* @param {jQuery} jq Optional
* @deprecated use bindToXHR instead
*/
bindToJquery: function(jq) {
var self = this;

View File

@@ -188,13 +188,19 @@ if (typeof(PhpDebugBar) == 'undefined') {
},
ajax: function(data, callback) {
$.ajax({
dataType: 'json',
url: this.get('url'),
data: data,
success: callback,
ignoreDebugBarAjaxHandler: true
});
var url = this.get('url');
if (data) {
url = url + '?' + new URLSearchParams(data);
}
fetch(url, {
method: "GET",
headers: {
"Accept": "application/json",
},
})
.then((data) => data.json())
.then(callback);
}
});

File diff suppressed because one or more lines are too long

View File

@@ -606,7 +606,7 @@ if (typeof(PhpDebugBar) == 'undefined') {
if (e.xdebug_link) {
if (e.xdebug_link.ajax) {
$('<a title="' + e.xdebug_link.url + '"></a>').on('click', function () {
$.ajax(e.xdebug_link.url);
fetch(e.xdebug_link.url);
}).addClass(csscls('editor-link')).appendTo(header);
} else {
$('<a href="' + e.xdebug_link.url + '"></a>').addClass(csscls('editor-link')).appendTo(header);

View File

@@ -130,7 +130,7 @@
var header = $('<span title="Filename" />').addClass(csscls('filename')).text(stmt.xdebug_link.filename + ( stmt.xdebug_link.line ? "#" + stmt.xdebug_link.line : ''));
if (stmt.xdebug_link.ajax) {
$('<a title="' + stmt.xdebug_link.url + '"></a>').on('click', function () {
$.ajax(stmt.xdebug_link.url);
fetch(stmt.xdebug_link.url);
}).addClass(csscls('editor-link')).appendTo(header);
} else {
$('<a href="' + stmt.xdebug_link.url + '"></a>').addClass(csscls('editor-link')).appendTo(header);

View File

@@ -23,7 +23,7 @@
if (tpl.xdebug_link) {
if (tpl.xdebug_link.ajax) {
$('<a title="' + tpl.xdebug_link.url + '"></a>').on('click', function () {
$.ajax(tpl.xdebug_link.url);
fetch(tpl.xdebug_link.url);
}).addClass(csscls('editor-link')).appendTo(header);
} else {
$('<a href="' + tpl.xdebug_link.url + '"></a>').addClass(csscls('editor-link')).appendTo(header);

View File

@@ -9,5 +9,5 @@ phpdebugbar.setDataMap({
});
phpdebugbar.restoreState();
phpdebugbar.ajaxHandler = new PhpDebugBar.AjaxHandler(phpdebugbar, undefined, true);
if (jQuery) phpdebugbar.ajaxHandler.bindToJquery(jQuery);
phpdebugbar.ajaxHandler.bindToXHR();
phpdebugbar.addDataSet(