1
0
mirror of https://github.com/maximebf/php-debugbar.git synced 2025-01-16 21:08:34 +01:00

Get rid of inline styles in widgets.js resulting in csp errors (#564)

This commit is contained in:
Yannik Sembritzki 2023-09-19 17:37:25 +02:00 committed by GitHub
parent aafb756575
commit ab33d08b02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -263,3 +263,9 @@ div.phpdebugbar-widgets-exceptions a.phpdebugbar-widgets-editor-link:before {
content: "\f08e";
margin-left: 4px;
}
ul.phpdebugbar-widgets-timeline table.phpdebugbar-widgets-params {
display: table;
border: 0;
width: 99%;
}

View File

@ -514,15 +514,16 @@ if (typeof(PhpDebugBar) == 'undefined') {
});
// build table and add
var aggregateTable = $('<table style="display: table; border: 0; width: 99%"></table>').addClass(csscls('params'));
var aggregateTable = $('<table></table>').addClass(csscls('params'));
$.each(aggregate, function(i, aggregate) {
width = Math.min((aggregate.data.duration * 100 / data.duration).toFixed(2), 100);
aggregateTable.append('<tr><td class="' + csscls('name') + '">' + aggregate.data.count + ' x ' + aggregate.label + ' (' + width + '%)</td><td class="' + csscls('value') + '">' +
'<div class="' + csscls('measure') +'">' +
'<span class="' + csscls('value') + '" style="width:' + width + '%"></span>' +
'<span class="' + csscls('value') + '"></span>' +
'<span class="' + csscls('label') + '">' + formatDuration(aggregate.data.duration) + (aggregate.data.memory ? '/' + formatBytes(aggregate.data.memory) : '') + '</span>' +
'</div></td></tr>');
aggregateTable.find('span.' + csscls('value') + ':last').css({width: width + "%" });
});
this.$el.append('<li/>').find('li:last').append(aggregateTable);