vendor/symfony/web-profiler-bundle/Resources/views/Profiler/toolbar_js.html.twig line 1

Open in your IDE?
  1. <div id="sfwdt{{ token }}" class="sf-toolbar sf-display-none"></div>
  2. {{ include('@WebProfiler/Profiler/base_js.html.twig') }}
  3. <style{% if csp_style_nonce %} nonce="{{ csp_style_nonce }}"{% endif %}>
  4.     {{ include('@WebProfiler/Profiler/toolbar.css.twig', { 'position': position, 'floatable': true }) }}
  5. </style>
  6. <script{% if csp_script_nonce %} nonce="{{ csp_script_nonce }}"{% endif %}>/*<![CDATA[*/
  7.     (function () {
  8.         {% if 'top' == position %}
  9.             var sfwdt = document.getElementById('sfwdt{{ token }}');
  10.             document.body.insertBefore(
  11.                 document.body.removeChild(sfwdt),
  12.                 document.body.firstChild
  13.             );
  14.         {% endif %}
  15.         Sfjs.load(
  16.             'sfwdt{{ token }}',
  17.             '{{ path("_wdt", { "token": token }) }}',
  18.             function(xhr, el) {
  19.                 /* Evaluate embedded scripts inside the toolbar */
  20.                 var i, scripts = [].slice.call(el.querySelectorAll('script'));
  21.                 for (i = 0; i < scripts.length; ++i) {
  22.                     eval(scripts[i].firstChild.nodeValue);
  23.                 }
  24.                 el.style.display = -1 !== xhr.responseText.indexOf('sf-toolbarreset') ? 'block' : 'none';
  25.                 if (el.style.display == 'none') {
  26.                     return;
  27.                 }
  28.                 if (Sfjs.getPreference('toolbar/displayState') == 'none') {
  29.                     document.getElementById('sfToolbarMainContent-{{ token }}').style.display = 'none';
  30.                     document.getElementById('sfToolbarClearer-{{ token }}').style.display = 'none';
  31.                     document.getElementById('sfMiniToolbar-{{ token }}').style.display = 'block';
  32.                 } else {
  33.                     document.getElementById('sfToolbarMainContent-{{ token }}').style.display = 'block';
  34.                     document.getElementById('sfToolbarClearer-{{ token }}').style.display = 'block';
  35.                     document.getElementById('sfMiniToolbar-{{ token }}').style.display = 'none';
  36.                 }
  37.                 /* Handle toolbar-info position */
  38.                 var toolbarBlocks = [].slice.call(el.querySelectorAll('.sf-toolbar-block'));
  39.                 for (i = 0; i < toolbarBlocks.length; ++i) {
  40.                     toolbarBlocks[i].onmouseover = function () {
  41.                         var toolbarInfo = this.querySelectorAll('.sf-toolbar-info')[0];
  42.                         var pageWidth = document.body.clientWidth;
  43.                         var elementWidth = toolbarInfo.offsetWidth;
  44.                         var leftValue = (elementWidth + this.offsetLeft) - pageWidth;
  45.                         var rightValue = (elementWidth + (pageWidth - this.offsetLeft)) - pageWidth;
  46.                         /* Reset right and left value, useful on window resize */
  47.                         toolbarInfo.style.right = '';
  48.                         toolbarInfo.style.left = '';
  49.                         if (elementWidth > pageWidth) {
  50.                             toolbarInfo.style.left = 0;
  51.                         }
  52.                         else if (leftValue > 0 && rightValue > 0) {
  53.                             toolbarInfo.style.right = (rightValue * -1) + 'px';
  54.                         } else if (leftValue < 0) {
  55.                             toolbarInfo.style.left = 0;
  56.                         } else {
  57.                             toolbarInfo.style.right = '0px';
  58.                         }
  59.                     };
  60.                 }
  61.                 Sfjs.addEventListener(document.getElementById('sfToolbarHideButton-{{ token }}'), 'click', function (event) {
  62.                     event.preventDefault();
  63.                     var p = this.parentNode;
  64.                     p.style.display = 'none';
  65.                     (p.previousElementSibling || p.previousSibling).style.display = 'none';
  66.                     document.getElementById('sfMiniToolbar-{{ token }}').style.display = 'block';
  67.                     Sfjs.setPreference('toolbar/displayState', 'none');
  68.                 });
  69.                 Sfjs.addEventListener(document.getElementById('sfToolbarMiniToggler-{{ token }}'), 'click', function (event) {
  70.                     event.preventDefault();
  71.                     var elem = this.parentNode;
  72.                     if (elem.style.display == 'none') {
  73.                         document.getElementById('sfToolbarMainContent-{{ token }}').style.display = 'none';
  74.                         document.getElementById('sfToolbarClearer-{{ token }}').style.display = 'none';
  75.                         elem.style.display = 'block';
  76.                     } else {
  77.                         document.getElementById('sfToolbarMainContent-{{ token }}').style.display = 'block';
  78.                         document.getElementById('sfToolbarClearer-{{ token }}').style.display = 'block';
  79.                         elem.style.display = 'none'
  80.                     }
  81.                     Sfjs.setPreference('toolbar/displayState', 'block');
  82.                 });
  83.                 Sfjs.renderAjaxRequests();
  84.                 Sfjs.addEventListener(document.querySelector('.sf-toolbar-block-ajax > .sf-toolbar-icon'), 'click', function (event) {
  85.                     event.preventDefault();
  86.                     Sfjs.toggleClass(this.parentNode, 'hover');
  87.                 });
  88.                 var dumpInfo = document.querySelector('.sf-toolbar-block-dump .sf-toolbar-info');
  89.                 if (null !== dumpInfo) {
  90.                     Sfjs.addEventListener(dumpInfo, 'sfbeforedumpcollapse', function () {
  91.                         dumpInfo.style.minHeight = dumpInfo.getBoundingClientRect().height+'px';
  92.                     });
  93.                     Sfjs.addEventListener(dumpInfo, 'mouseleave', function () {
  94.                         dumpInfo.style.minHeight = '';
  95.                     });
  96.                 }
  97.             },
  98.             function(xhr) {
  99.                 if (xhr.status !== 0) {
  100.                     var sfwdt = document.getElementById('sfwdt{{ token }}');
  101.                     sfwdt.innerHTML = '\
  102.                         <div class="sf-toolbarreset">\
  103.                             <div class="sf-toolbar-icon"><svg width="26" height="28" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 26 28"><path fill="#FFF" d="M13 0a13 13 0 1 0 0 26 13 13 0 1 0 0-26zm7 7.5c-.6 0-1-.3-1-.9 0-.2 0-.4.2-.6l.2-.4c0-.3-.5-.4-.7-.4-2 .1-2.5 2.7-2.9 4.8l-.2 1.1c1.1.2 1.9 0 2.4-.3.6-.4-.2-.8-.1-1.3.1-.3.5-.5.8-.6.5 0 .8.5.8 1 0 .8-1.1 2-3.3 1.9l-.7-.1-.5 2.4c-.4 1.7-.9 4.1-2.6 6.2-1.5 1.8-3.1 2.1-3.8 2.1-1.3 0-2.1-.6-2.2-1.6 0-.9.8-1.4 1.3-1.4.7 0 1.2.5 1.2 1.1 0 .5-.2.6-.4.7-.1.1-.3.2-.3.4 0 .1.1.3.4.3.5 0 .9-.3 1.2-.5 1.3-1 1.7-2.9 2.4-6.2l.1-.8.8-3.5c-.9-.7-1.4-1.5-2.6-1.8-.8-.2-1.3 0-1.7.4-.4.5-.2 1.2.2 1.6l.7.7c.8.9 1.3 1.7 1.1 2.7-.3 1.6-2.1 2.8-4.3 2.1-1.9-.6-2.2-1.9-2-2.7.2-.6.7-.8 1.2-.6.5.2.7.8.6 1.3l-.1.3c-.2.1-.3.3-.3.4-.1.4.4.7.8.8.8.3 1.7-.2 1.9-.9.2-.6-.2-1.1-.4-1.2l-.8-.9c-.4-.4-1.2-1.5-.8-2.8.2-.5.5-1 .9-1.4 1-.7 2-.8 3-.6 1.3.4 1.9 1.2 2.8 1.9.5-1.3 1.1-2.6 2-3.8a5 5 0 0 1 3.3-1.8c1.4.2 2.4.8 2.4 1.7 0 .4-.2 1.2-1 1.2z"/></svg></div>\
  104.                             An error occurred while loading the web debug toolbar. <a href="{{ path("_profiler", { "token": token }) }}">Open the web profiler.</a>\
  105.                         </div>\
  106.                     ';
  107.                     sfwdt.setAttribute('class', 'sf-toolbar sf-error-toolbar');
  108.                 }
  109.             },
  110.             { maxTries: 5 }
  111.         );
  112.     })();
  113. /*]]>*/</script>