1
0
mirror of https://github.com/maximebf/php-debugbar.git synced 2025-07-25 10:41:55 +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 $ajaxHandlerBindToFetch = false;
protected $ajaxHandlerBindToJquery = true; protected $ajaxHandlerBindToJquery = false;
protected $ajaxHandlerBindToXHR = false; protected $ajaxHandlerBindToXHR = true;
protected $ajaxHandlerAutoShow = true; protected $ajaxHandlerAutoShow = true;
@@ -509,6 +509,7 @@ class JavascriptRenderer
* Sets whether to call bindToJquery() on the ajax handler * Sets whether to call bindToJquery() on the ajax handler
* *
* @param boolean $bind * @param boolean $bind
* @deprecated use setBindAjaxHandlerToXHR
*/ */
public function setBindAjaxHandlerToJquery($bind = true) public function setBindAjaxHandlerToJquery($bind = true)
{ {
@@ -520,6 +521,7 @@ class JavascriptRenderer
* Checks whether bindToJquery() will be called on the ajax handler * Checks whether bindToJquery() will be called on the ajax handler
* *
* @return boolean * @return boolean
* @deprecated use isAjaxHandlerBoundToXHR
*/ */
public function isAjaxHandlerBoundToJquery() public function isAjaxHandlerBoundToJquery()
{ {

View File

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

View File

@@ -188,13 +188,19 @@ if (typeof(PhpDebugBar) == 'undefined') {
}, },
ajax: function(data, callback) { ajax: function(data, callback) {
$.ajax({ var url = this.get('url');
dataType: 'json', if (data) {
url: this.get('url'), url = url + '?' + new URLSearchParams(data);
data: data, }
success: callback,
ignoreDebugBarAjaxHandler: true 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) {
if (e.xdebug_link.ajax) { if (e.xdebug_link.ajax) {
$('<a title="' + e.xdebug_link.url + '"></a>').on('click', function () { $('<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); }).addClass(csscls('editor-link')).appendTo(header);
} else { } else {
$('<a href="' + e.xdebug_link.url + '"></a>').addClass(csscls('editor-link')).appendTo(header); $('<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 : '')); 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) { if (stmt.xdebug_link.ajax) {
$('<a title="' + stmt.xdebug_link.url + '"></a>').on('click', function () { $('<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); }).addClass(csscls('editor-link')).appendTo(header);
} else { } else {
$('<a href="' + stmt.xdebug_link.url + '"></a>').addClass(csscls('editor-link')).appendTo(header); $('<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) {
if (tpl.xdebug_link.ajax) { if (tpl.xdebug_link.ajax) {
$('<a title="' + tpl.xdebug_link.url + '"></a>').on('click', function () { $('<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); }).addClass(csscls('editor-link')).appendTo(header);
} else { } else {
$('<a href="' + tpl.xdebug_link.url + '"></a>').addClass(csscls('editor-link')).appendTo(header); $('<a href="' + tpl.xdebug_link.url + '"></a>').addClass(csscls('editor-link')).appendTo(header);

View File

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