Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion lib/html/includes.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,25 @@ var _MiniProfiler = (function() {
return tempElement.children[0];
};

var collapseResults = function collapseResults() {
if (expandedResults && totalsControl && container) {
// Hide all individual results except totals
toArray(
container.querySelectorAll(".profiler-result")
).forEach(function(el) {
if (el !== totalsControl) {
el.style.display = "none";
}
});

// Show totals control again
totalsControl.style.display = "block";

// Reset expanded state
expandedResults = false;
}
};

var buttonShow = function buttonShow(json) {
var result = renderTemplate(json);
totalTime += parseFloat(json.duration_milliseconds, 10);
Expand Down Expand Up @@ -518,7 +537,13 @@ var _MiniProfiler = (function() {
}
);

var isEscPress = e.type == "keyup" && e.which == 27;

if (!popup.length) {
// Handle ESC when no popups are open but results are expanded
if (isEscPress && expandedResults) {
collapseResults();
}
return;
}

Expand All @@ -528,7 +553,6 @@ var _MiniProfiler = (function() {
".profiler-queries"
),
bg = document.querySelector(".profiler-queries-bg"),
isEscPress = e.type == "keyup" && e.which == 27,
hidePopup = false,
hideQueries = false;

Expand Down
2 changes: 1 addition & 1 deletion lib/mini_profiler/asset_version.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true
module Rack
class MiniProfiler
ASSET_VERSION = 'e0bcc9ce0ae3bb5d6b736b6f282f601f'
ASSET_VERSION = '1592fcee961471b6d33bb772925ef913'
end
end