Skip to content

Commit

Permalink
v3.0.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
pryley committed Feb 4, 2023
1 parent 21fe883 commit 3cfeff7
Show file tree
Hide file tree
Showing 21 changed files with 537 additions and 408 deletions.
530 changes: 280 additions & 250 deletions +/main.css

Large diffs are not rendered by default.

69 changes: 69 additions & 0 deletions +/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,13 @@ document.addEventListener('DOMContentLoaded', () => {
Blackbar.switchPanel( Blackbar.open );
});

blackbarEl.querySelectorAll('.glbb-row-toggle').forEach(el => {
el.addEventListener('click', ev => {
const row = ev.currentTarget.closest('tr');
row.classList.toggle('glbb-row-collapsed')
})
})

if( debugFilter && debugMinTime ) {
debugFilter.addEventListener( 'keyup', onKeyup );
debugFilter.value = Blackbar.readCookie( 'glbb_query_filter' );
Expand All @@ -163,4 +170,66 @@ document.addEventListener('DOMContentLoaded', () => {
if( Blackbar.readCookie( 'glbb-toggle' ) === 'on' ) {
debugToggle.click();
}


const actionsCallback = blackbarEl.querySelector('#glbb_actions_callback');
const actionsMinTime = blackbarEl.querySelector('#glbb_actions_min_time');
const onActionsKeyup = (ev) => {
let time = parseFloat(actionsMinTime.value);
let qtime = 0;
blackbarEl.querySelectorAll('#glbb-actions [data-total]').forEach(el => {
let minTimeFilter = parseFloat(el.dataset.total);
let timeResult = time > 0 && minTimeFilter < time;
let parentEl = el.closest('tr');
if (timeResult) {
parentEl.classList.add('glbb-row-hidden');
} else {
parentEl.classList.remove('glbb-row-hidden');
qtime += minTimeFilter;
}
});
Blackbar.createCookie('glbb_actions_min_time', blackbarEl.querySelector( '#glbb_actions_min_time').value);
let query = actionsCallback.value;
let qnum = 0;
blackbarEl.querySelectorAll('#glbb-actions td li').forEach(li => {
let queryFilter = li.textContent.indexOf(query);
let queryResult = query.length > 0 && queryFilter === -1;
let parentRow = li.closest('tr').previousElementSibling;
if (queryResult) {
li.style.display = 'none';
} else {
li.style.display = '';
qnum++;
}
});
blackbarEl.querySelectorAll('#glbb-actions td ol').forEach(ol => {
let children = [].slice.call(ol.children).filter(el => 'none' !== getComputedStyle(el).display);
let parentEl = ol.closest('tr').previousElementSibling;
if (0 === children.length) {
parentEl.classList.add('glbb-row-hidden');
} else {
parentEl.classList.remove('glbb-row-hidden');
}
})
if (query.length > 0) {
blackbarEl.querySelectorAll('#glbb-actions tbody th div:not(.glbb-row-toggle)').forEach(el => {
el.style.opacity = .5;
})
} else {
blackbarEl.querySelectorAll('#glbb-actions tbody th div:not(.glbb-row-toggle)').forEach(el => {
el.style.opacity = 1;
})
}
Blackbar.createCookie('glbb_actions_callback', query);

// blackbarEl.querySelector( '.glbb-queries-count' ).textContent = qnum;
// blackbarEl.querySelector( '.glbb-queries-time' ).textContent = qtime.toFixed(2);
};

if (actionsCallback && actionsMinTime) {
actionsMinTime.addEventListener('keyup', onActionsKeyup);
actionsMinTime.value = Blackbar.readCookie('glbb_actions_min_time');
actionsCallback.addEventListener('keyup', onActionsKeyup);
actionsCallback.value = Blackbar.readCookie( 'glbb_actions_callback');
}
});
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Black Bar is an unobtrusive Debug Bar for WordPress developers that attaches its
- Debug both the front-end and admin area
- Displays any PHP errors that occur when loading a page
- Displays executed MySQL queries and the time it took to execute each query
- Displays the 50 slowest action and filter hooks
- Displays the loaded template files of the active theme
- Inspect global variables (COOKIE, GET, POST, SERVER, SESSION)
- Use the Profiler for measuring performance of your plugins and themes
Expand Down
2 changes: 1 addition & 1 deletion assets/main.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/main.js

Large diffs are not rendered by default.

Binary file modified languages/blackbar-en_US.mo
Binary file not shown.
20 changes: 16 additions & 4 deletions languages/blackbar-en_US.po
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,23 @@ msgstr "Toggle"
msgid "Close"
msgstr "Close"

#: plugin/Modules/Actions.php:88
#: plugin/Modules/Actions.php:108
msgid "Hooks"
msgstr "Hooks"

#: plugin/Modules/Actions.php:92, plugin/Modules/Profiler.php:103, plugin/Modules/Queries.php:73
#: plugin/Modules/Actions.php:114, plugin/Modules/Profiler.php:101, plugin/Modules/Queries.php:73
msgid "ms"
msgstr "ms"

#: plugin/Modules/Console.php:78
msgid "Console"
msgstr "Console"

#: plugin/Modules/Globals.php:79
#: plugin/Modules/Globals.php:77
msgid "Globals"
msgstr "Globals"

#: plugin/Modules/Profiler.php:100
#: plugin/Modules/Profiler.php:98
msgid "Profiler"
msgstr "Profiler"

Expand All @@ -58,6 +58,18 @@ msgstr "queries"
msgid "Templates"
msgstr "Templates"

#: views/panels/actions.php:13
msgid "Find Callbacks Containing"
msgstr "Find Callbacks Containing"

#: views/panels/actions.php:14
msgid "Minimum Total Time"
msgstr "Minimum Total Time"

#: views/panels/actions.php:7
msgid "Please deactivate the Debug Bar Slow Actions plugin."
msgstr "Please deactivate the Debug Bar Slow Actions plugin."

#: views/panels/console.php:7, views/panels/profiler.php:7
msgid "No entries found."
msgstr "No entries found."
Expand Down
20 changes: 16 additions & 4 deletions languages/blackbar.pot
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,23 @@ msgstr ""
msgid "Close"
msgstr ""

#: plugin/Modules/Actions.php:88
#: plugin/Modules/Actions.php:108
msgid "Hooks"
msgstr ""

#: plugin/Modules/Actions.php:92, plugin/Modules/Profiler.php:103, plugin/Modules/Queries.php:73
#: plugin/Modules/Actions.php:114, plugin/Modules/Profiler.php:101, plugin/Modules/Queries.php:73
msgid "ms"
msgstr ""

#: plugin/Modules/Console.php:78
msgid "Console"
msgstr ""

#: plugin/Modules/Globals.php:79
#: plugin/Modules/Globals.php:77
msgid "Globals"
msgstr ""

#: plugin/Modules/Profiler.php:100
#: plugin/Modules/Profiler.php:98
msgid "Profiler"
msgstr ""

Expand All @@ -91,6 +91,18 @@ msgstr ""
msgid "Templates"
msgstr ""

#: views/panels/actions.php:13
msgid "Find Callbacks Containing"
msgstr ""

#: views/panels/actions.php:14
msgid "Minimum Total Time"
msgstr ""

#: views/panels/actions.php:7
msgid "Please deactivate the Debug Bar Slow Actions plugin."
msgstr ""

#: views/panels/console.php:7, views/panels/profiler.php:7
msgid "No entries found."
msgstr ""
Expand Down
Loading

0 comments on commit 3cfeff7

Please sign in to comment.