init
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
@charset "UTF-8";
|
||||
a.phpdebugbar-restore-btn:after {
|
||||
background: #efefef url("data:image/svg+xml;utf8,<svg fill='var(--debugbar-accent)' width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'><path d='M16.719 14.759 14.22 17.26l-2.37 2.37-.462.466a5.33 5.33 0 0 1-5.047 1.397 3.21 3.21 0 1 1-3.872-3.844 5.32 5.32 0 0 1 1.396-5.08l.179-.18 2.37 2.37-.184.181a1.974 1.974 0 0 0 0 2.789c.771.78 2.022.78 2.787 0l.465-.465 2.367-2.371 2.502-2.506zm.924 6.652a5.32 5.32 0 0 1-5.328-1.318l-.18-.185 2.365-2.369.18.184a1.974 1.974 0 0 0 2.787 0 1.965 1.965 0 0 0-.004-2.781l-.466-.465-2.365-2.37-2.502-2.503 2.37-2.369 2.499 2.505 2.367 2.37.464.464a5.28 5.28 0 0 1 1.411 5.021A3.215 3.215 0 0 1 24 20.775a3.204 3.204 0 0 1-3.209 3.21 3.19 3.19 0 0 1-3.135-2.565zM6.975 9.461l2.508-2.505 2.37-2.369.462-.461A5.3 5.3 0 0 1 17.58 2.79 3.215 3.215 0 0 1 20.759.015a3.211 3.211 0 0 1 .421 6.395 5.31 5.31 0 0 1-1.35 5.234l-.182.184-2.369-2.369.184-.184a1.967 1.967 0 1 0-2.781-2.78l-.462.461-2.37 2.369-2.505 2.502zm-2.653 2.647-.461-.462a5.31 5.31 0 0 1-1.332-5.288A3.22 3.22 0 0 1 .03 3.224C.03 1.454 1.47.015 3.24.015a3.215 3.215 0 0 1 3.17 2.691 5.32 5.32 0 0 1 4.979 1.415l.184.185-2.37 2.37-.183-.181a1.977 1.977 0 0 0-2.785 0 1.977 1.977 0 0 0-.005 2.79l.465.466 2.37 2.369 2.505 2.505-2.367 2.37-2.51-2.505-2.371-2.37z'/></svg>") 5px 4px / 20px 20px no-repeat !important;
|
||||
}
|
||||
|
||||
a.phpdebugbar-tab.phpdebugbar-tab-settings i:before {
|
||||
content: "";
|
||||
font-family: "Font Awesome 6 Free";
|
||||
font-size: 12px;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.phpdebugbar-widgets-timeline .phpdebugbar-widgets-measure:hover {
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
.phpdebugbar[data-theme="dark"] .phpdebugbar-widgets-measure:hover {
|
||||
background-color: #404040;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
@charset "UTF-8";a.phpdebugbar-restore-btn:after{background:#efefef url("data:image/svg+xml;utf8,<svg fill='var(--debugbar-accent)' width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'><path d='M16.719 14.759 14.22 17.26l-2.37 2.37-.462.466a5.33 5.33 0 0 1-5.047 1.397 3.21 3.21 0 1 1-3.872-3.844 5.32 5.32 0 0 1 1.396-5.08l.179-.18 2.37 2.37-.184.181a1.974 1.974 0 0 0 0 2.789c.771.78 2.022.78 2.787 0l.465-.465 2.367-2.371 2.502-2.506zm.924 6.652a5.32 5.32 0 0 1-5.328-1.318l-.18-.185 2.365-2.369.18.184a1.974 1.974 0 0 0 2.787 0 1.965 1.965 0 0 0-.004-2.781l-.466-.465-2.365-2.37-2.502-2.503 2.37-2.369 2.499 2.505 2.367 2.37.464.464a5.28 5.28 0 0 1 1.411 5.021A3.215 3.215 0 0 1 24 20.775a3.204 3.204 0 0 1-3.209 3.21 3.19 3.19 0 0 1-3.135-2.565zM6.975 9.461l2.508-2.505 2.37-2.369.462-.461A5.3 5.3 0 0 1 17.58 2.79 3.215 3.215 0 0 1 20.759.015a3.211 3.211 0 0 1 .421 6.395 5.31 5.31 0 0 1-1.35 5.234l-.182.184-2.369-2.369.184-.184a1.967 1.967 0 1 0-2.781-2.78l-.462.461-2.37 2.369-2.505 2.502zm-2.653 2.647-.461-.462a5.31 5.31 0 0 1-1.332-5.288A3.22 3.22 0 0 1 .03 3.224C.03 1.454 1.47.015 3.24.015a3.215 3.215 0 0 1 3.17 2.691 5.32 5.32 0 0 1 4.979 1.415l.184.185-2.37 2.37-.183-.181a1.977 1.977 0 0 0-2.785 0 1.977 1.977 0 0 0-.005 2.79l.465.466 2.37 2.369 2.505 2.505-2.367 2.37-2.51-2.505-2.371-2.37z'/></svg>") 5px 4px/20px 20px no-repeat!important}a.phpdebugbar-tab.phpdebugbar-tab-settings i:before{content:"";font-family:"Font Awesome 6 Free";font-size:12px;font-weight:900}.phpdebugbar-widgets-timeline .phpdebugbar-widgets-measure:hover{background-color:#eee}.phpdebugbar[data-theme=dark] .phpdebugbar-widgets-measure:hover{background-color:#404040}
|
||||
Binary file not shown.
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
(document => {
|
||||
|
||||
// Selectors used by this script
|
||||
const debugSectionTogglerSelector = '.dbg-header';
|
||||
const toggleTargetAttribute = 'data-debug-toggle';
|
||||
|
||||
/**
|
||||
* Toggle an element by id
|
||||
* @param id
|
||||
*/
|
||||
const toggle = id => {
|
||||
document.getElementById(id).classList.toggle('hidden');
|
||||
};
|
||||
|
||||
/**
|
||||
* Register events
|
||||
*/
|
||||
const registerEvents = () => {
|
||||
document.querySelectorAll(debugSectionTogglerSelector).forEach(toggler => {
|
||||
toggler.addEventListener('click', event => {
|
||||
event.preventDefault();
|
||||
toggle(toggler.getAttribute(toggleTargetAttribute));
|
||||
});
|
||||
});
|
||||
};
|
||||
document.addEventListener('DOMContentLoaded', registerEvents);
|
||||
})(document);
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/(t=>{const g=".dbg-header",n="data-debug-toggle",d=e=>{t.getElementById(e).classList.toggle("hidden")},o=()=>{t.querySelectorAll(g).forEach(e=>{e.addEventListener("click",r=>{r.preventDefault(),d(e.getAttribute(n))})})};t.addEventListener("DOMContentLoaded",o)})(document);
|
||||
Binary file not shown.
@@ -0,0 +1,33 @@
|
||||
@charset "UTF-8";
|
||||
table.phpdebugbar-widgets-info {
|
||||
width: 75%;
|
||||
margin-top: 5px;
|
||||
margin-left: 5px;
|
||||
font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, Courier, monospace;
|
||||
line-height: 1.3em;
|
||||
}
|
||||
|
||||
table.phpdebugbar-widgets-info td {
|
||||
border-bottom: 1px solid silver;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
table.phpdebugbar-widgets-info dt {
|
||||
float: left;
|
||||
clear: left;
|
||||
text-align: left;
|
||||
width: 30%;
|
||||
padding: .25em;
|
||||
}
|
||||
|
||||
table.phpdebugbar-widgets-info dd {
|
||||
float: left;
|
||||
width: 60%;
|
||||
padding: .25em 0;
|
||||
}
|
||||
|
||||
table.phpdebugbar-widgets-info dl:after {
|
||||
clear: both;
|
||||
content: "";
|
||||
display: table;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
(function ($) {
|
||||
|
||||
var csscls = PhpDebugBar.utils.makecsscls('phpdebugbar-widgets-')
|
||||
var InfoWidget = PhpDebugBar.Widgets.InfoWidget = PhpDebugBar.Widget.extend({
|
||||
|
||||
tagName: 'table',
|
||||
|
||||
className: csscls('info'),
|
||||
|
||||
render: function () {
|
||||
this.bindAttr('data', function (data) {
|
||||
this.$el.empty()
|
||||
var tr
|
||||
|
||||
tr = $('<tr />')
|
||||
.append($('<td />').text('Joomla! Version'))
|
||||
.append($('<td />').text(data.joomlaVersion))
|
||||
this.$el.append(tr)
|
||||
|
||||
tr = $('<tr />')
|
||||
.append($('<td />').text('PHP Version'))
|
||||
.append($('<td />').text(data.phpVersion))
|
||||
this.$el.append(tr)
|
||||
|
||||
tr = $('<tr />')
|
||||
.append($('<td />').text('Identity'))
|
||||
.append($('<td />').text(data.identity.type))
|
||||
this.$el.append(tr)
|
||||
|
||||
tr = $('<tr />')
|
||||
.append($('<td />').text('Response'))
|
||||
.append($('<td />').text(data.response.status_code))
|
||||
this.$el.append(tr)
|
||||
|
||||
tr = $('<tr />')
|
||||
.append($('<td />').text('Template'))
|
||||
.append($('<td />').text(data.template.template))
|
||||
this.$el.append(tr)
|
||||
|
||||
tr = $('<tr />')
|
||||
.append($('<td />').text('Database'))
|
||||
.append($('<td />').html(
|
||||
'<dl>'
|
||||
+ '<dt>Server</dt><dd>' + data.database.dbserver + '</dd>'
|
||||
+ '<dt>Version</dt><dd>' + data.database.dbversion + '</dd>'
|
||||
+ '<dt>Collation</dt><dd>' + data.database.dbcollation + '</dd>'
|
||||
+ '<dt>Conn Collation</dt><dd>' + data.database.dbconnectioncollation + '</dd>'
|
||||
+ '</dl>'
|
||||
))
|
||||
this.$el.append(tr)
|
||||
})
|
||||
}
|
||||
})
|
||||
})(PhpDebugBar.$)
|
||||
@@ -0,0 +1 @@
|
||||
@charset "UTF-8";table.phpdebugbar-widgets-info{width:75%;margin-top:5px;margin-left:5px;font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace;line-height:1.3em}table.phpdebugbar-widgets-info td{border-bottom:1px solid silver;padding-right:10px}table.phpdebugbar-widgets-info dt{float:left;clear:left;text-align:left;width:30%;padding:.25em}table.phpdebugbar-widgets-info dd{float:left;width:60%;padding:.25em 0}table.phpdebugbar-widgets-info dl:after{clear:both;content:"";display:table}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
(function(t){var p=PhpDebugBar.utils.makecsscls("phpdebugbar-widgets-"),n=PhpDebugBar.Widgets.InfoWidget=PhpDebugBar.Widget.extend({tagName:"table",className:p("info"),render:function(){this.bindAttr("data",function(d){this.$el.empty();var e;e=t("<tr />").append(t("<td />").text("Joomla! Version")).append(t("<td />").text(d.joomlaVersion)),this.$el.append(e),e=t("<tr />").append(t("<td />").text("PHP Version")).append(t("<td />").text(d.phpVersion)),this.$el.append(e),e=t("<tr />").append(t("<td />").text("Identity")).append(t("<td />").text(d.identity.type)),this.$el.append(e),e=t("<tr />").append(t("<td />").text("Response")).append(t("<td />").text(d.response.status_code)),this.$el.append(e),e=t("<tr />").append(t("<td />").text("Template")).append(t("<td />").text(d.template.template)),this.$el.append(e),e=t("<tr />").append(t("<td />").text("Database")).append(t("<td />").html("<dl><dt>Server</dt><dd>"+d.database.dbserver+"</dd><dt>Version</dt><dd>"+d.database.dbversion+"</dd><dt>Collation</dt><dd>"+d.database.dbcollation+"</dd><dt>Conn Collation</dt><dd>"+d.database.dbconnectioncollation+"</dd></dl>")),this.$el.append(e)})}})})(PhpDebugBar.$);
|
||||
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
@charset "UTF-8";
|
||||
ul.phpdebugbar-widgets-languageErrors {
|
||||
margin-top: 5px;
|
||||
margin-left: 5px;
|
||||
font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, Courier, monospace;
|
||||
line-height: 1.3em;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
(function ($) {
|
||||
|
||||
var csscls = PhpDebugBar.utils.makecsscls('phpdebugbar-widgets-')
|
||||
var languageErrorsWidget = PhpDebugBar.Widgets.languageErrorsWidget = PhpDebugBar.Widget.extend({
|
||||
|
||||
tagName: 'ul',
|
||||
|
||||
className: csscls('languageErrors'),
|
||||
|
||||
render: function () {
|
||||
this.bindAttr('data', function (data) {
|
||||
this.$el.empty()
|
||||
|
||||
for (var file of data.files) {
|
||||
var relPath = file[0].replace(data.jroot, '')
|
||||
var li = $('<li />')
|
||||
if (data.xdebugLink) {
|
||||
var link = $('<a />')
|
||||
.text(relPath + ':' + file[1])
|
||||
.attr(
|
||||
'href',
|
||||
data.xdebugLink
|
||||
.replace('%f', file[0])
|
||||
.replace('%l', file[1])
|
||||
)
|
||||
li.append(link)
|
||||
} else {
|
||||
li.text(relPath + ':' + file[1])
|
||||
}
|
||||
this.$el.append(li)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
})(PhpDebugBar.$)
|
||||
@@ -0,0 +1 @@
|
||||
@charset "UTF-8";ul.phpdebugbar-widgets-languageErrors{margin-top:5px;margin-left:5px;font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace;line-height:1.3em}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
(function(t){var s=PhpDebugBar.utils.makecsscls("phpdebugbar-widgets-"),u=PhpDebugBar.Widgets.languageErrorsWidget=PhpDebugBar.Widget.extend({tagName:"ul",className:s("languageErrors"),render:function(){this.bindAttr("data",function(r){this.$el.empty();for(var e of r.files){var g=e[0].replace(r.jroot,""),a=t("<li />");if(r.xdebugLink){var n=t("<a />").text(g+":"+e[1]).attr("href",r.xdebugLink.replace("%f",e[0]).replace("%l",e[1]));a.append(n)}else a.text(g+":"+e[1]);this.$el.append(a)}})}})})(PhpDebugBar.$);
|
||||
Binary file not shown.
@@ -0,0 +1,22 @@
|
||||
@charset "UTF-8";
|
||||
table.phpdebugbar-widgets-languageFiles {
|
||||
margin-top: 5px;
|
||||
margin-left: 5px;
|
||||
font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, Courier, monospace;
|
||||
line-height: 1.3em;
|
||||
}
|
||||
|
||||
table.phpdebugbar-widgets-languageFiles tr {
|
||||
border-bottom: 1px solid silver;
|
||||
}
|
||||
|
||||
table.phpdebugbar-widgets-languageFiles th {
|
||||
padding: 5px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.phpdebugbar-widgets-languageFiles .alert-success, .phpdebugbar-widgets-languageFiles .alert-warning {
|
||||
color: var(--alert-color);
|
||||
background-color: var(--alert-bg);
|
||||
border-color: var(--alert-border-color);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
(function ($) {
|
||||
|
||||
var csscls = PhpDebugBar.utils.makecsscls('phpdebugbar-widgets-')
|
||||
var languageFilesWidget = PhpDebugBar.Widgets.languageFilesWidget = PhpDebugBar.Widget.extend({
|
||||
|
||||
tagName: 'table',
|
||||
|
||||
className: csscls('languageFiles'),
|
||||
|
||||
render: function () {
|
||||
this.bindAttr('data', function (data) {
|
||||
this.$el.empty()
|
||||
var head = $('<tr />')
|
||||
.append($('<th />').text('Extension'))
|
||||
.append($('<th />').text('File'))
|
||||
this.$el.append(head)
|
||||
for (var extension in data.loaded) {
|
||||
var ul = $('<ul />')
|
||||
for (var file in data.loaded[extension]) {
|
||||
var css = data.loaded[extension][file] ? 'alert-success' : 'alert-warning'
|
||||
var status = data.loaded[extension][file] ? '+' : '-'
|
||||
var relPath = status + ' ' + file.replace(data.jroot, '')
|
||||
var li = $('<li />')
|
||||
.addClass(css)
|
||||
if (data.xdebugLink) {
|
||||
var link = $('<a />')
|
||||
.text(relPath)
|
||||
.attr(
|
||||
'href',
|
||||
data.xdebugLink
|
||||
.replace('%f', file)
|
||||
.replace('%l', '1')
|
||||
)
|
||||
li.append(link)
|
||||
} else {
|
||||
li.text(relPath)
|
||||
}
|
||||
|
||||
li.appendTo(ul)
|
||||
}
|
||||
var tr = $('<tr />')
|
||||
.append($('<td />').text(extension))
|
||||
.append($('<td />').append(ul))
|
||||
this.$el.append(tr)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
})(PhpDebugBar.$)
|
||||
@@ -0,0 +1 @@
|
||||
@charset "UTF-8";table.phpdebugbar-widgets-languageFiles{margin-top:5px;margin-left:5px;font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace;line-height:1.3em}table.phpdebugbar-widgets-languageFiles tr{border-bottom:1px solid silver}table.phpdebugbar-widgets-languageFiles th{padding:5px;font-weight:700}.phpdebugbar-widgets-languageFiles .alert-success,.phpdebugbar-widgets-languageFiles .alert-warning{color:var(--alert-color);background-color:var(--alert-bg);border-color:var(--alert-border-color)}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
(function(e){var l=PhpDebugBar.utils.makecsscls("phpdebugbar-widgets-"),h=PhpDebugBar.Widgets.languageFilesWidget=PhpDebugBar.Widget.extend({tagName:"table",className:l("languageFiles"),render:function(){this.bindAttr("data",function(a){this.$el.empty();var s=e("<tr />").append(e("<th />").text("Extension")).append(e("<th />").text("File"));this.$el.append(s);for(var r in a.loaded){var p=e("<ul />");for(var t in a.loaded[r]){var g=a.loaded[r][t]?"alert-success":"alert-warning",i=a.loaded[r][t]?"+":"-",n=i+" "+t.replace(a.jroot,""),d=e("<li />").addClass(g);if(a.xdebugLink){var u=e("<a />").text(n).attr("href",a.xdebugLink.replace("%f",t).replace("%l","1"));d.append(u)}else d.text(n);d.appendTo(p)}var c=e("<tr />").append(e("<td />").text(r)).append(e("<td />").append(p));this.$el.append(c)}})}})})(PhpDebugBar.$);
|
||||
Binary file not shown.
@@ -0,0 +1,56 @@
|
||||
@charset "UTF-8";
|
||||
table.phpdebugbar-widgets-languageStrings {
|
||||
width: 100%;
|
||||
margin-top: 5px;
|
||||
margin-left: 5px;
|
||||
font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, Courier, monospace;
|
||||
line-height: 1.3em;
|
||||
}
|
||||
|
||||
table.phpdebugbar-widgets-languageStrings th {
|
||||
border-bottom: 1px solid #000;
|
||||
}
|
||||
|
||||
table.phpdebugbar-widgets-languageStrings table.phpdebugbar-widgets-callstack {
|
||||
border-collapse: collapse;
|
||||
border: 1px solid #ddd;
|
||||
width: 100%;
|
||||
margin: 10px;
|
||||
font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, Courier, monospace;
|
||||
display: none;
|
||||
}
|
||||
|
||||
table.phpdebugbar-widgets-languageStrings table.phpdebugbar-widgets-callstack tr.caller {
|
||||
background-color: #fff9b6;
|
||||
}
|
||||
|
||||
table.phpdebugbar-widgets-languageStrings table.phpdebugbar-widgets-callstack tbody tr:hover {
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
table.phpdebugbar-widgets-languageStrings table.phpdebugbar-widgets-callstack th {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.phpdebugbar-widgets-languageStrings span.phpdebugbar-widgets-eye, table.phpdebugbar-widgets-languageStrings span.phpdebugbar-widgets-eye-dash {
|
||||
color: #888;
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
table.phpdebugbar-widgets-languageStrings span.phpdebugbar-widgets-eye-dash {
|
||||
color: #000;
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
table.phpdebugbar-widgets-languageStrings span.phpdebugbar-widgets-eye:before, table.phpdebugbar-widgets-languageStrings span.phpdebugbar-widgets-eye-dash:before {
|
||||
margin-right: 4px;
|
||||
font-family: "Font Awesome 6 Free";
|
||||
}
|
||||
|
||||
table.phpdebugbar-widgets-languageStrings span.phpdebugbar-widgets-eye:before {
|
||||
content: "";
|
||||
}
|
||||
|
||||
table.phpdebugbar-widgets-languageStrings span.phpdebugbar-widgets-eye-dash:before {
|
||||
content: "";
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
(function ($) {
|
||||
|
||||
var csscls = PhpDebugBar.utils.makecsscls('phpdebugbar-widgets-')
|
||||
var languageStringsWidget = PhpDebugBar.Widgets.languageStringsWidget = PhpDebugBar.Widget.extend({
|
||||
|
||||
tagName: 'table',
|
||||
|
||||
className: csscls('languageStrings'),
|
||||
|
||||
render: function () {
|
||||
this.bindAttr('data', function (data) {
|
||||
this.$el.empty()
|
||||
for (var orphan in data.orphans) {
|
||||
var tr = $('<tr />')
|
||||
$('<th valign="top" style="width:10%" />').text(orphan).appendTo(tr)
|
||||
var td = $('<th />').appendTo(tr)
|
||||
|
||||
var ul = $('<ul />').appendTo(td)
|
||||
|
||||
var tableStack
|
||||
|
||||
for (var oc in data.orphans[orphan]) {
|
||||
var occurence = data.orphans[orphan][oc]
|
||||
var relPath = occurence['caller'].replace(data.jroot, '')
|
||||
|
||||
var li = $('<li />')
|
||||
|
||||
if (data.xdebugLink) {
|
||||
var parts = occurence['caller'].split(':')
|
||||
var link = $('<a />')
|
||||
.text(relPath)
|
||||
.attr(
|
||||
'href',
|
||||
data.xdebugLink
|
||||
.replace('%f', parts[0])
|
||||
.replace('%l', parts[1])
|
||||
)
|
||||
li.append(link)
|
||||
} else {
|
||||
li.text(relPath)
|
||||
}
|
||||
|
||||
if (occurence['trace'] && !$.isEmptyObject(occurence['trace'])) {
|
||||
$('<span title="Call Stack" />')
|
||||
.text('Stack')
|
||||
.addClass(csscls('eye'))
|
||||
.css('cursor', 'pointer')
|
||||
.on('click', function (e) {
|
||||
var btn = $(e.target)
|
||||
var table = btn.next()
|
||||
if (table.is(':visible')) {
|
||||
table.hide()
|
||||
btn.addClass(csscls('eye'))
|
||||
btn.removeClass(csscls('eye-dash'))
|
||||
} else {
|
||||
table.show()
|
||||
btn.addClass(csscls('eye-dash'))
|
||||
btn.removeClass(csscls('eye'))
|
||||
}
|
||||
})
|
||||
.appendTo(li)
|
||||
|
||||
tableStack = $('<table><thead><tr><th colspan="3">Call Stack</th></tr></thead></table>')
|
||||
.addClass(csscls('callstack'))
|
||||
.appendTo(li)
|
||||
|
||||
for (var i in occurence['trace']) {
|
||||
var entry = occurence['trace'][i]
|
||||
var location = entry[3] ? entry[3].replace(data.jroot, '') + ':' + entry[4] : ''
|
||||
var caller = entry[2].replace(data.jroot, '')
|
||||
var cssClass = entry[1] ? 'caller' : ''
|
||||
if (location && data.xdebugLink) {
|
||||
location = '<a href="' + data.xdebugLink.replace('%f', entry[3]).replace('%l', entry[4]) + '">' + location + '</a>'
|
||||
}
|
||||
tableStack.append('<tr class="' + cssClass + '"><th>' + entry[0] + '</th><td>' + caller + '</td><td>' + location + '</td></tr>')
|
||||
}
|
||||
}
|
||||
|
||||
li.appendTo(ul)
|
||||
}
|
||||
|
||||
this.$el.append(tr)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
})(PhpDebugBar.$)
|
||||
@@ -0,0 +1 @@
|
||||
@charset "UTF-8";table.phpdebugbar-widgets-languageStrings{width:100%;margin-top:5px;margin-left:5px;font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace;line-height:1.3em}table.phpdebugbar-widgets-languageStrings th{border-bottom:1px solid #000}table.phpdebugbar-widgets-languageStrings table.phpdebugbar-widgets-callstack{border-collapse:collapse;border:1px solid #ddd;width:100%;margin:10px;font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace;display:none}table.phpdebugbar-widgets-languageStrings table.phpdebugbar-widgets-callstack tr.caller{background-color:#fff9b6}table.phpdebugbar-widgets-languageStrings table.phpdebugbar-widgets-callstack tbody tr:hover{background-color:#eee}table.phpdebugbar-widgets-languageStrings table.phpdebugbar-widgets-callstack th{font-weight:700}table.phpdebugbar-widgets-languageStrings span.phpdebugbar-widgets-eye,table.phpdebugbar-widgets-languageStrings span.phpdebugbar-widgets-eye-dash{color:#888;margin-left:8px}table.phpdebugbar-widgets-languageStrings span.phpdebugbar-widgets-eye-dash{color:#000;background-color:#eee}table.phpdebugbar-widgets-languageStrings span.phpdebugbar-widgets-eye:before,table.phpdebugbar-widgets-languageStrings span.phpdebugbar-widgets-eye-dash:before{margin-right:4px;font-family:"Font Awesome 6 Free"}table.phpdebugbar-widgets-languageStrings span.phpdebugbar-widgets-eye:before{content:""}table.phpdebugbar-widgets-languageStrings span.phpdebugbar-widgets-eye-dash:before{content:""}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
(function(e){var r=PhpDebugBar.utils.makecsscls("phpdebugbar-widgets-"),T=PhpDebugBar.Widgets.languageStringsWidget=PhpDebugBar.Widget.extend({tagName:"table",className:r("languageStrings"),render:function(){this.bindAttr("data",function(a){this.$el.empty();for(var d in a.orphans){var g=e("<tr />");e('<th valign="top" style="width:10%" />').text(d).appendTo(g);var o=e("<th />").appendTo(g),c=e("<ul />").appendTo(o),v;for(var f in a.orphans[d]){var s=a.orphans[d][f],h=s.caller.replace(a.jroot,""),l=e("<li />");if(a.xdebugLink){var b=s.caller.split(":"),u=e("<a />").text(h).attr("href",a.xdebugLink.replace("%f",b[0]).replace("%l",b[1]));l.append(u)}else l.text(h);if(s.trace&&!e.isEmptyObject(s.trace)){e('<span title="Call Stack" />').text("Stack").addClass(r("eye")).css("cursor","pointer").on("click",function(m){var p=e(m.target),n=p.next();n.is(":visible")?(n.hide(),p.addClass(r("eye")),p.removeClass(r("eye-dash"))):(n.show(),p.addClass(r("eye-dash")),p.removeClass(r("eye")))}).appendTo(l),v=e('<table><thead><tr><th colspan="3">Call Stack</th></tr></thead></table>').addClass(r("callstack")).appendTo(l);for(var x in s.trace){var t=s.trace[x],i=t[3]?t[3].replace(a.jroot,"")+":"+t[4]:"",k=t[2].replace(a.jroot,""),C=t[1]?"caller":"";i&&a.xdebugLink&&(i='<a href="'+a.xdebugLink.replace("%f",t[3]).replace("%l",t[4])+'">'+i+"</a>"),v.append('<tr class="'+C+'"><th>'+t[0]+"</th><td>"+k+"</td><td>"+i+"</td></tr>")}}l.appendTo(c)}this.$el.append(g)}})}})})(PhpDebugBar.$);
|
||||
Binary file not shown.
@@ -0,0 +1,171 @@
|
||||
@charset "UTF-8";
|
||||
div.phpdebugbar-widgets-sqlqueries .phpdebugbar-widgets-status {
|
||||
color: #555;
|
||||
background: #fafafa;
|
||||
border-bottom: 1px solid #ddd;
|
||||
padding: 6px;
|
||||
font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, Courier, monospace;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-sqlqueries li.phpdebugbar-widgets-list-item.phpdebugbar-widgets-error {
|
||||
color: red;
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-database, div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-duration, div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-memory, div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-row-count, div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-copy-clipboard, div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-eye, div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-eye-dash, div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-stmt-id {
|
||||
float: right;
|
||||
color: #888;
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-sqlqueries a.phpdebugbar-widgets-editor-link {
|
||||
float: right;
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-sqlqueries div.phpdebugbar-widgets-status span.phpdebugbar-widgets-database, div.phpdebugbar-widgets-sqlqueries div.phpdebugbar-widgets-status span.phpdebugbar-widgets-duration, div.phpdebugbar-widgets-sqlqueries div.phpdebugbar-widgets-status span.phpdebugbar-widgets-memory, div.phpdebugbar-widgets-sqlqueries div.phpdebugbar-widgets-status span.phpdebugbar-widgets-row-count, div.phpdebugbar-widgets-sqlqueries div.phpdebugbar-widgets-status span.phpdebugbar-widgets-copy-clipboard, div.phpdebugbar-widgets-sqlqueries div.phpdebugbar-widgets-status span.phpdebugbar-widgets-eye, div.phpdebugbar-widgets-sqlqueries div.phpdebugbar-widgets-status span.phpdebugbar-widgets-eye-dash, div.phpdebugbar-widgets-sqlqueries div.phpdebugbar-widgets-status span.phpdebugbar-widgets-stmt-id {
|
||||
color: #555;
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-database:before, div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-duration:before, div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-memory:before, div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-row-count:before, div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-copy-clipboard:before, div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-eye:before, div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-eye-dash:before, div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-stmt-id:before, div.phpdebugbar-widgets-sqlqueries a.phpdebugbar-widgets-editor-link:before {
|
||||
margin-right: 4px;
|
||||
font-family: "Font Awesome 6 Free";
|
||||
font-size: 12px;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-database:before {
|
||||
content: "";
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-duration:before {
|
||||
content: "";
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-memory:before {
|
||||
content: "";
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-row-count:before {
|
||||
content: "";
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-stmt-id:before {
|
||||
content: "";
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-copy-clipboard:before {
|
||||
content: "";
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-eye:before {
|
||||
content: "";
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-eye-dash:before {
|
||||
content: "";
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-sqlqueries a.phpdebugbar-widgets-editor-link:before {
|
||||
content: "";
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-eye-dash {
|
||||
background-color: #eee;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-sqlqueries table.phpdebugbar-widgets-params {
|
||||
border-collapse: collapse;
|
||||
border: 1px solid #ddd;
|
||||
width: 70%;
|
||||
margin: 10px 0;
|
||||
font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, Courier, monospace;
|
||||
display: none;
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-sqlqueries table.phpdebugbar-widgets-params td, div.phpdebugbar-widgets-sqlqueries table.phpdebugbar-widgets-explain td {
|
||||
border: 1px solid #ddd;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-sqlqueries table.phpdebugbar-widgets-params .phpdebugbar-widgets-name {
|
||||
width: 20%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-sqlqueries table.phpdebugbar-widgets-callstack, div.phpdebugbar-widgets-sqlqueries table.phpdebugbar-widgets-explain {
|
||||
border-collapse: collapse;
|
||||
border: 1px solid #ddd;
|
||||
width: 100%;
|
||||
margin: 10px 0;
|
||||
font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, Courier, monospace;
|
||||
display: none;
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-sqlqueries table.phpdebugbar-widgets-callstack tr.caller {
|
||||
background-color: #fff9b6;
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-sqlqueries table.phpdebugbar-widgets-callstack tbody tr:hover {
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-sqlqueries table.phpdebugbar-widgets-callstack th, div.phpdebugbar-widgets-sqlqueries table.phpdebugbar-widgets-explain th, div.phpdebugbar-widgets-sqlqueries table.phpdebugbar-widgets-params th {
|
||||
padding: 3px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-sqlqueries li.phpdebugbar-widgets-list-item {
|
||||
border-bottom: 1px solid #00f;
|
||||
padding: 10px 6px;
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-sqlqueries li.phpdebugbar-widgets-list-item span.phpdebugbar-widgets-error {
|
||||
font-weight: bold;
|
||||
display: block;
|
||||
}
|
||||
|
||||
code.phpdebugbar-widgets-sql {
|
||||
word-wrap: break-word;
|
||||
overflow-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-sqlqueries li.phpdebugbar-widgets-list-item.phpdebugbar-widgets-sql-duplicate {
|
||||
background-color: #edeff0;
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-sqlqueries li.phpdebugbar-widgets-list-item.phpdebugbar-widgets-sql-duplicate:hover {
|
||||
background-color: #ffc;
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-sqlqueries div.phpdebugbar-widgets-toolbar {
|
||||
z-index: 1;
|
||||
background: #fff;
|
||||
width: 100%;
|
||||
display: none;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-sqlqueries div.phpdebugbar-widgets-toolbar a.phpdebugbar-widgets-filter {
|
||||
float: right;
|
||||
color: #fff;
|
||||
background: #7cacd5;
|
||||
border-radius: 4px;
|
||||
margin: 0 2px;
|
||||
padding: 2px 4px;
|
||||
font-size: 12px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-sqlqueries div.phpdebugbar-widgets-toolbar a.phpdebugbar-widgets-filter.phpdebugbar-widgets-excluded {
|
||||
color: #888;
|
||||
background: #eee;
|
||||
}
|
||||
|
||||
div.phpdebugbar[data-theme="dark"] div.phpdebugbar-widgets-sqlqueries li.phpdebugbar-widgets-list-item.phpdebugbar-widgets-sql-duplicate {
|
||||
background-color: #473e00;
|
||||
}
|
||||
@@ -0,0 +1,348 @@
|
||||
(function ($) {
|
||||
|
||||
var csscls = PhpDebugBar.utils.makecsscls('phpdebugbar-widgets-')
|
||||
|
||||
/**
|
||||
* Widget for the displaying sql queries
|
||||
*
|
||||
* Options:
|
||||
* - data
|
||||
*/
|
||||
var SQLQueriesWidget = PhpDebugBar.Widgets.SQLQueriesWidget = PhpDebugBar.Widget.extend({
|
||||
|
||||
className: csscls('sqlqueries'),
|
||||
|
||||
onFilterClick: function (el) {
|
||||
$(el).toggleClass(csscls('excluded'))
|
||||
|
||||
var excludedLabels = []
|
||||
this.$toolbar.find(csscls('.filter') + csscls('.excluded')).each(function () {
|
||||
excludedLabels.push(this.rel)
|
||||
})
|
||||
|
||||
this.$list.$el.find('li[connection=' + $(el).attr('rel') + ']').toggle()
|
||||
|
||||
this.set('exclude', excludedLabels)
|
||||
},
|
||||
onFilterDupesClick: function (el) {
|
||||
$(el).toggleClass(csscls('excluded'))
|
||||
|
||||
var excludedLabels = []
|
||||
this.$toolbar.find(csscls('.filter') + csscls('.excluded')).each(function () {
|
||||
excludedLabels.push(this.rel)
|
||||
})
|
||||
|
||||
this.$list.$el.find('li[dupeindex=' + $(el).attr('rel') + ']').toggle()
|
||||
|
||||
this.set('exclude', excludedLabels)
|
||||
},
|
||||
onCopyToClipboard: function (el) {
|
||||
var code = $(el).parent('li').find('code').get(0)
|
||||
var copy = function () {
|
||||
try {
|
||||
document.execCommand('copy')
|
||||
alert('Query copied to the clipboard')
|
||||
} catch (err) {
|
||||
console.log('Oops, unable to copy')
|
||||
}
|
||||
}
|
||||
var select = function (node) {
|
||||
if (document.selection) {
|
||||
var range = document.body.createTextRange()
|
||||
range.moveToElementText(node)
|
||||
range.select()
|
||||
} else if (window.getSelection) {
|
||||
var range = document.createRange()
|
||||
range.selectNodeContents(node)
|
||||
window.getSelection().removeAllRanges()
|
||||
window.getSelection().addRange(range)
|
||||
}
|
||||
copy()
|
||||
window.getSelection().removeAllRanges()
|
||||
}
|
||||
select(code)
|
||||
},
|
||||
render: function () {
|
||||
this.$status = $('<div />').addClass(csscls('status')).appendTo(this.$el)
|
||||
|
||||
this.$toolbar = $('<div></div>').addClass(csscls('toolbar')).appendTo(this.$el)
|
||||
|
||||
var filters = [], self = this
|
||||
|
||||
this.$list = new PhpDebugBar.Widgets.ListWidget({
|
||||
itemRenderer: function (li, stmt) {
|
||||
$('<code />').addClass(csscls('sql')).html(PhpDebugBar.Widgets.highlight(stmt.sql, 'sql')).appendTo(li)
|
||||
if (stmt.duration_str) {
|
||||
$('<span title="Duration" />').addClass(csscls('duration')).text(stmt.duration_str).appendTo(li)
|
||||
}
|
||||
if (stmt.memory_str) {
|
||||
$('<span title="Memory usage" />').addClass(csscls('memory')).text(stmt.memory_str).appendTo(li)
|
||||
}
|
||||
if (typeof(stmt.row_count) != 'undefined') {
|
||||
$('<span title="Row count" />').addClass(csscls('row-count')).text(stmt.row_count).appendTo(li)
|
||||
}
|
||||
if (typeof(stmt.stmt_id) != 'undefined' && stmt.stmt_id) {
|
||||
$('<span title="Prepared statement ID" />').addClass(csscls('stmt-id')).text(stmt.stmt_id).appendTo(li)
|
||||
}
|
||||
if (stmt.connection) {
|
||||
$('<span title="Connection" />').addClass(csscls('database')).text(stmt.connection).appendTo(li)
|
||||
li.attr('connection', stmt.connection)
|
||||
if ($.inArray(stmt.connection, filters) == -1) {
|
||||
filters.push(stmt.connection)
|
||||
$('<a />')
|
||||
.addClass(csscls('filter'))
|
||||
.text(stmt.connection)
|
||||
.attr('rel', stmt.connection)
|
||||
.on('click', function () {
|
||||
self.onFilterClick(this)
|
||||
})
|
||||
.appendTo(self.$toolbar)
|
||||
if (filters.length > 1) {
|
||||
self.$toolbar.show()
|
||||
self.$list.$el.css('margin-bottom', '20px')
|
||||
}
|
||||
}
|
||||
}
|
||||
if (typeof(stmt.is_success) != 'undefined' && !stmt.is_success) {
|
||||
li.addClass(csscls('error'))
|
||||
li.append($('<span />').addClass(csscls('error')).text('[' + stmt.error_code + '] ' + stmt.error_message))
|
||||
}
|
||||
|
||||
var tableParams;
|
||||
|
||||
function showTableParams() {
|
||||
if (tableParams) {
|
||||
tableParams.show();
|
||||
return;
|
||||
}
|
||||
|
||||
// Render table
|
||||
tableParams = $('<table>').addClass(csscls('params')).appendTo(li);
|
||||
tableParams.append('<tr><th colspan="3">Query Parameters</th></tr>');
|
||||
tableParams.append('<tr><td>ID</td><td>Value</td><td>Data Type</td></tr>');
|
||||
|
||||
var pRow;
|
||||
for (var key in stmt.params) {
|
||||
pRow = stmt.params[key];
|
||||
tableParams.append('<tr><td>' + key + '</td><td>' + pRow.value + '</td><td>'
|
||||
+ pRow.dataType + '</td></tr>');
|
||||
}
|
||||
|
||||
tableParams.show();
|
||||
}
|
||||
|
||||
if (stmt.params && !$.isEmptyObject(stmt.params)) {
|
||||
var btnParams = $('<span title="Params" />')
|
||||
.text('Params')
|
||||
.addClass(csscls('eye'))
|
||||
.css('cursor', 'pointer')
|
||||
.on('click', function () {
|
||||
if (tableParams && tableParams.is(':visible')) {
|
||||
tableParams.hide()
|
||||
btnParams.addClass(csscls('eye'))
|
||||
btnParams.removeClass(csscls('eye-dash'))
|
||||
} else {
|
||||
showTableParams();
|
||||
btnParams.addClass(csscls('eye-dash'))
|
||||
btnParams.removeClass(csscls('eye'))
|
||||
}
|
||||
})
|
||||
.appendTo(li)
|
||||
}
|
||||
|
||||
var tableExplain;
|
||||
|
||||
function showTableExplain() {
|
||||
if (tableExplain) {
|
||||
tableExplain.show();
|
||||
return;
|
||||
}
|
||||
|
||||
// Render table
|
||||
tableExplain = $('<table>').addClass(csscls('explain')).appendTo(li);
|
||||
tableExplain.append('<tr><th>' + stmt.explain_col.join('</th><th>') + '</th></tr>');
|
||||
|
||||
var i, entry, cols;
|
||||
for (i in stmt.explain) {
|
||||
cols = []
|
||||
entry = stmt.explain[i];
|
||||
|
||||
stmt.explain_col.forEach(function (key){
|
||||
cols.push(entry[key]);
|
||||
});
|
||||
|
||||
tableExplain.append('<tr><td>' + cols.join('</td><td>') + '</td></tr>');
|
||||
}
|
||||
|
||||
tableExplain.show();
|
||||
}
|
||||
|
||||
if (stmt.explain && !$.isEmptyObject(stmt.explain)) {
|
||||
var btnExplain = $('<span title="Explain" />')
|
||||
.text('Explain')
|
||||
.addClass(csscls('eye'))
|
||||
.css('cursor', 'pointer')
|
||||
.on('click', function () {
|
||||
if (tableExplain && tableExplain.is(':visible')) {
|
||||
tableExplain.hide()
|
||||
btnExplain.addClass(csscls('eye'))
|
||||
btnExplain.removeClass(csscls('eye-dash'))
|
||||
} else {
|
||||
showTableExplain();
|
||||
btnExplain.addClass(csscls('eye-dash'))
|
||||
btnExplain.removeClass(csscls('eye'))
|
||||
}
|
||||
})
|
||||
.appendTo(li)
|
||||
}
|
||||
|
||||
var tableStack;
|
||||
|
||||
function showTableStack() {
|
||||
if (tableStack) {
|
||||
tableStack.show();
|
||||
return;
|
||||
}
|
||||
|
||||
// Render table
|
||||
tableStack = $('<table><tr><th colspan="3">Call Stack</th></tr></table>')
|
||||
.addClass(csscls('callstack')).appendTo(li);
|
||||
|
||||
var i, entry, location, caller, cssClass;
|
||||
for (i in stmt.callstack) {
|
||||
entry = stmt.callstack[i]
|
||||
location = entry[3] ? entry[3].replace(self.root_path, '') + ':' + entry[4] : ''
|
||||
caller = entry[2].replace(self.root_path, '')
|
||||
cssClass = entry[1] ? 'caller' : ''
|
||||
|
||||
if (location && self.xdebug_link) {
|
||||
location = '<a href="' + self.xdebug_link.replace('%f', entry[3]).replace('%l', entry[4]) + '">' + location + '</a>'
|
||||
}
|
||||
tableStack.append('<tr class="' + cssClass + '"><th>' + entry[0] + '</th><td>' + caller + '</td><td>' + location + '</td></tr>')
|
||||
}
|
||||
|
||||
tableStack.show();
|
||||
}
|
||||
|
||||
if (stmt.callstack && !$.isEmptyObject(stmt.callstack)) {
|
||||
var btnStack = $('<span title="Call Stack" />')
|
||||
.text('Stack')
|
||||
.addClass(csscls('eye'))
|
||||
.css('cursor', 'pointer')
|
||||
.on('click', function () {
|
||||
if (tableStack && tableStack.is(':visible')) {
|
||||
tableStack.hide()
|
||||
btnStack.addClass(csscls('eye'))
|
||||
btnStack.removeClass(csscls('eye-dash'))
|
||||
} else {
|
||||
showTableStack();
|
||||
btnStack.addClass(csscls('eye-dash'))
|
||||
btnStack.removeClass(csscls('eye'))
|
||||
}
|
||||
})
|
||||
.appendTo(li)
|
||||
}
|
||||
|
||||
if (typeof(stmt.caller) != 'undefined' && stmt.caller) {
|
||||
var caller = stmt.caller.replace(self.root_path, '')
|
||||
if (self.xdebug_link) {
|
||||
var parts = stmt.caller.split(':')
|
||||
$('<a />')
|
||||
.text(caller)
|
||||
.addClass(csscls('editor-link'))
|
||||
.attr('href', self.xdebug_link.replace('%f', parts[0]).replace('%l', parts[1]))
|
||||
.appendTo(li)
|
||||
} else {
|
||||
$('<span title="Caller" />')
|
||||
.text(caller)
|
||||
.addClass(csscls('stmt-id'))
|
||||
.appendTo(li)
|
||||
}
|
||||
}
|
||||
|
||||
$('<span title="Copy to clipboard" />')
|
||||
.text('Copy')
|
||||
.addClass(csscls('copy-clipboard'))
|
||||
.css('cursor', 'pointer')
|
||||
.on('click', function (event) {
|
||||
self.onCopyToClipboard(this)
|
||||
event.stopPropagation()
|
||||
})
|
||||
.appendTo(li)
|
||||
|
||||
li.attr('dupeindex', 'dupe-0')
|
||||
}
|
||||
})
|
||||
this.$list.$el.appendTo(this.$el)
|
||||
|
||||
this.bindAttr('data', function (data) {
|
||||
// the collector maybe is empty
|
||||
if (data.length <= 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
this.root_path = data.root_path
|
||||
this.xdebug_link = data.xdebug_link
|
||||
this.$list.set('data', data.statements)
|
||||
this.$status.empty()
|
||||
|
||||
// Search for duplicate statements.
|
||||
for (var sql = {}, unique = 0, duplicate = 0, i = 0; i < data.statements.length; i++) {
|
||||
var stmt = data.statements[i].sql
|
||||
if (data.statements[i].params && !$.isEmptyObject(data.statements[i].params)) {
|
||||
stmt += ' {' + $.param(data.statements[i].params, false) + '}'
|
||||
}
|
||||
sql[stmt] = sql[stmt] || {keys: []}
|
||||
sql[stmt].keys.push(i)
|
||||
}
|
||||
// Add classes to all duplicate SQL statements.
|
||||
var cnt = 0
|
||||
for (var stmt in sql) {
|
||||
if (sql[stmt].keys.length > 1) {
|
||||
duplicate += sql[stmt].keys.length
|
||||
cnt++
|
||||
for (var i = 0; i < sql[stmt].keys.length; i++) {
|
||||
this.$list.$el.find('.' + csscls('list-item')).eq(sql[stmt].keys[i])
|
||||
.addClass(csscls('sql-duplicate'))
|
||||
.attr('dupeindex', 'dupe-' + cnt)
|
||||
}
|
||||
} else {
|
||||
unique++
|
||||
}
|
||||
}
|
||||
|
||||
if (duplicate) {
|
||||
for (i = 0; i <= cnt; i++) {
|
||||
$('<a />')
|
||||
.addClass(csscls('filter'))
|
||||
.text(i ? 'Duplicates ' + i : 'Uniques')
|
||||
.attr('rel', 'dupe-' + i)
|
||||
.on('click', function () {
|
||||
self.onFilterDupesClick(this)
|
||||
})
|
||||
.appendTo(self.$toolbar)
|
||||
}
|
||||
self.$toolbar.show()
|
||||
self.$list.$el.css('margin-bottom', '20px')
|
||||
}
|
||||
|
||||
var t = $('<span />').text(data.nb_statements + ' statements were executed').appendTo(this.$status)
|
||||
if (data.nb_failed_statements) {
|
||||
t.append(', ' + data.nb_failed_statements + ' of which failed')
|
||||
}
|
||||
if (duplicate) {
|
||||
t.append(', ' + duplicate + ' of which were duplicates')
|
||||
t.append(', ' + unique + ' unique')
|
||||
}
|
||||
if (data.accumulated_duration_str) {
|
||||
this.$status.append($('<span title="Accumulated duration" />').addClass(csscls('duration')).text(data.accumulated_duration_str))
|
||||
}
|
||||
if (data.memory_usage_str) {
|
||||
this.$status.append($('<span title="Memory usage" />').addClass(csscls('memory')).text(data.memory_usage_str))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
})(PhpDebugBar.$)
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Reference in New Issue
Block a user