File tree Expand file tree Collapse file tree 2 files changed +26
-5
lines changed
src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler Expand file tree Collapse file tree 2 files changed +26
-5
lines changed Original file line number Diff line number Diff line change 4
4
<meta charset =" {{ _charset }}" />
5
5
<meta name =" robots" content =" noindex,nofollow" />
6
6
<meta name =" viewport" content =" width=device-width,initial-scale=1" />
7
+ <meta name =" view-transition" content =" same-origin" >
7
8
<title >{% block title %}Symfony Profiler{% endblock %}</title >
8
9
9
10
{% set request_collector = profile is defined ? profile .collectors .request | default (null ) : null %}
Original file line number Diff line number Diff line change 5
5
them as JavaScript source code. Always use '/*' comments instead
6
6
of '//' comments to avoid impossible-to-debug side-effects #}
7
7
<script {% if csp_script_nonce is defined and csp_script_nonce %} nonce =" {{ csp_script_nonce }}" {% endif %}>
8
- window .addEventListener (' DOMContentLoaded' , () => {
8
+ document .addEventListener (' DOMContentLoaded' , () => {
9
9
new SymfonyProfiler ();
10
10
});
11
11
12
12
class SymfonyProfiler {
13
13
constructor () {
14
+ this .#reorderMainMenuItems ();
14
15
this .#createTabs ();
15
- this .#createTableSearchFields ();
16
- this .#createToggles ();
17
- this .#createCopyToClipboard ();
18
- this .#convertDateTimesToUserTimezone ();
16
+
17
+ setTimeout (() => {
18
+ this .#createTableSearchFields ();
19
+ this .#createToggles ();
20
+ this .#createCopyToClipboard ();
21
+ this .#convertDateTimesToUserTimezone ();
22
+ }, 0 );
23
+ }
24
+
25
+ #reorderMainMenuItems () {
26
+ /* reorder the main menu items to always display first the non-disabled items */
27
+ const mainMenuElement = document .querySelector (' #menu-profiler' );
28
+ const mainMenuItems = mainMenuElement .querySelectorAll (' li' );
29
+ const firstDisabledMenuItem = mainMenuElement .querySelector (' li a > span.disabled' )? .parentNode ? .parentNode ;
30
+ if (! firstDisabledMenuItem) {
31
+ return ;
32
+ }
33
+ mainMenuItems .forEach (menuItem => {
34
+ const isDisabled = menuItem .querySelector (' a > span.disabled' );
35
+ if (! isDisabled) {
36
+ mainMenuElement .insertBefore (menuItem, firstDisabledMenuItem);
37
+ }
38
+ });
19
39
}
20
40
21
41
#createTabs () {
You can’t perform that action at this time.
0 commit comments