var/cache/dev/twig/0b/0b327f918971237f5a75f9058d75e28d6fde133999b3dcda5dd2a0f0b9bb58d6.php line 33

Open in your IDE?
  1. <?php
  2. use Twig\Environment;
  3. use Twig\Error\LoaderError;
  4. use Twig\Error\RuntimeError;
  5. use Twig\Extension\SandboxExtension;
  6. use Twig\Markup;
  7. use Twig\Sandbox\SecurityError;
  8. use Twig\Sandbox\SecurityNotAllowedTagError;
  9. use Twig\Sandbox\SecurityNotAllowedFilterError;
  10. use Twig\Sandbox\SecurityNotAllowedFunctionError;
  11. use Twig\Source;
  12. use Twig\Template;
  13. /* TwigBundle::base_js.html.twig */
  14. class __TwigTemplate_29af52aeaa7b7b2b5eb88265b9171447ea810312877f8ba3b31fc0ccb88f5962 extends \Twig\Template
  15. {
  16.     private $source;
  17.     private $macros = [];
  18.     public function __construct(Environment $env)
  19.     {
  20.         parent::__construct($env);
  21.         $this->source $this->getSourceContext();
  22.         $this->parent false;
  23.         $this->blocks = [
  24.         ];
  25.     }
  26.     protected function doDisplay(array $context, array $blocks = [])
  27.     {
  28.         $macros $this->macros;
  29.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  30.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->enter($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template""TwigBundle::base_js.html.twig"));
  31.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  32.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template""TwigBundle::base_js.html.twig"));
  33.         // line 1
  34.         $__internal_compile_0 = (("The template \"" $this->getTemplateName()) . "\" is deprecated since Symfony 4.4, will be removed in 5.0.");
  35.         @trigger_error($__internal_compile_0." (\"TwigBundle::base_js.html.twig\" at line 1)."E_USER_DEPRECATED);
  36.         // line 4
  37.         echo "<script";
  38.         if ((array_key_exists("csp_script_nonce"$context) && (isset($context["csp_script_nonce"]) || array_key_exists("csp_script_nonce"$context) ? $context["csp_script_nonce"] : (function () { throw new RuntimeError('Variable "csp_script_nonce" does not exist.'4$this->source); })()))) {
  39.             echo " nonce=\"";
  40.             echo twig_escape_filter($this->env, (isset($context["csp_script_nonce"]) || array_key_exists("csp_script_nonce"$context) ? $context["csp_script_nonce"] : (function () { throw new RuntimeError('Variable "csp_script_nonce" does not exist.'4$this->source); })()), "html"nulltrue);
  41.             echo "\"";
  42.         }
  43.         echo ">/*<![CDATA[*/
  44.     ";
  45.         // line 8
  46.         echo "
  47.     Sfjs = (function() {
  48.         \"use strict\";
  49.         if ('classList' in document.documentElement) {
  50.             var hasClass = function (el, cssClass) { return el.classList.contains(cssClass); };
  51.             var removeClass = function(el, cssClass) { el.classList.remove(cssClass); };
  52.             var addClass = function(el, cssClass) { el.classList.add(cssClass); };
  53.             var toggleClass = function(el, cssClass) { el.classList.toggle(cssClass); };
  54.         } else {
  55.             var hasClass = function (el, cssClass) { return el.className.match(new RegExp('\\\\b' + cssClass + '\\\\b')); };
  56.             var removeClass = function(el, cssClass) { el.className = el.className.replace(new RegExp('\\\\b' + cssClass + '\\\\b'), ' '); };
  57.             var addClass = function(el, cssClass) { if (!hasClass(el, cssClass)) { el.className += \" \" + cssClass; } };
  58.             var toggleClass = function(el, cssClass) { hasClass(el, cssClass) ? removeClass(el, cssClass) : addClass(el, cssClass); };
  59.         }
  60.         var addEventListener;
  61.         var el = document.createElement('div');
  62.         if (!('addEventListener' in el)) {
  63.             addEventListener = function (element, eventName, callback) {
  64.                 element.attachEvent('on' + eventName, callback);
  65.             };
  66.         } else {
  67.             addEventListener = function (element, eventName, callback) {
  68.                 element.addEventListener(eventName, callback, false);
  69.             };
  70.         }
  71.         return {
  72.             addEventListener: addEventListener,
  73.             createTabs: function() {
  74.                 var tabGroups = document.querySelectorAll('.sf-tabs:not([data-processed=true])');
  75.                 /* create the tab navigation for each group of tabs */
  76.                 for (var i = 0; i < tabGroups.length; i++) {
  77.                     var tabs = tabGroups[i].querySelectorAll(':scope > .tab');
  78.                     var tabNavigation = document.createElement('ul');
  79.                     tabNavigation.className = 'tab-navigation';
  80.                     var selectedTabId = 'tab-' + i + '-0'; /* select the first tab by default */
  81.                     for (var j = 0; j < tabs.length; j++) {
  82.                         var tabId = 'tab-' + i + '-' + j;
  83.                         var tabTitle = tabs[j].querySelector('.tab-title').innerHTML;
  84.                         var tabNavigationItem = document.createElement('li');
  85.                         tabNavigationItem.setAttribute('data-tab-id', tabId);
  86.                         if (hasClass(tabs[j], 'active')) { selectedTabId = tabId; }
  87.                         if (hasClass(tabs[j], 'disabled')) { addClass(tabNavigationItem, 'disabled'); }
  88.                         tabNavigationItem.innerHTML = tabTitle;
  89.                         tabNavigation.appendChild(tabNavigationItem);
  90.                         var tabContent = tabs[j].querySelector('.tab-content');
  91.                         tabContent.parentElement.setAttribute('id', tabId);
  92.                     }
  93.                     tabGroups[i].insertBefore(tabNavigation, tabGroups[i].firstChild);
  94.                     addClass(document.querySelector('[data-tab-id=\"' + selectedTabId + '\"]'), 'active');
  95.                 }
  96.                 /* display the active tab and add the 'click' event listeners */
  97.                 for (i = 0; i < tabGroups.length; i++) {
  98.                     tabNavigation = tabGroups[i].querySelectorAll(':scope >.tab-navigation li');
  99.                     for (j = 0; j < tabNavigation.length; j++) {
  100.                         tabId = tabNavigation[j].getAttribute('data-tab-id');
  101.                         document.getElementById(tabId).querySelector('.tab-title').className = 'hidden';
  102.                         if (hasClass(tabNavigation[j], 'active')) {
  103.                             document.getElementById(tabId).className = 'block';
  104.                         } else {
  105.                             document.getElementById(tabId).className = 'hidden';
  106.                         }
  107.                         tabNavigation[j].addEventListener('click', function(e) {
  108.                             var activeTab = e.target || e.srcElement;
  109.                             /* needed because when the tab contains HTML contents, user can click */
  110.                             /* on any of those elements instead of their parent '<li>' element */
  111.                             while (activeTab.tagName.toLowerCase() !== 'li') {
  112.                                 activeTab = activeTab.parentNode;
  113.                             }
  114.                             /* get the full list of tabs through the parent of the active tab element */
  115.                             var tabNavigation = activeTab.parentNode.children;
  116.                             for (var k = 0; k < tabNavigation.length; k++) {
  117.                                 var tabId = tabNavigation[k].getAttribute('data-tab-id');
  118.                                 document.getElementById(tabId).className = 'hidden';
  119.                                 removeClass(tabNavigation[k], 'active');
  120.                             }
  121.                             addClass(activeTab, 'active');
  122.                             var activeTabId = activeTab.getAttribute('data-tab-id');
  123.                             document.getElementById(activeTabId).className = 'block';
  124.                         });
  125.                     }
  126.                     tabGroups[i].setAttribute('data-processed', 'true');
  127.                 }
  128.             },
  129.             createToggles: function() {
  130.                 var toggles = document.querySelectorAll('.sf-toggle:not([data-processed=true])');
  131.                 for (var i = 0; i < toggles.length; i++) {
  132.                     var elementSelector = toggles[i].getAttribute('data-toggle-selector');
  133.                     var element = document.querySelector(elementSelector);
  134.                     addClass(element, 'sf-toggle-content');
  135.                     if (toggles[i].hasAttribute('data-toggle-initial') && toggles[i].getAttribute('data-toggle-initial') == 'display') {
  136.                         addClass(toggles[i], 'sf-toggle-on');
  137.                         addClass(element, 'sf-toggle-visible');
  138.                     } else {
  139.                         addClass(toggles[i], 'sf-toggle-off');
  140.                         addClass(element, 'sf-toggle-hidden');
  141.                     }
  142.                     addEventListener(toggles[i], 'click', function(e) {
  143.                         e.preventDefault();
  144.                         if ('' !== window.getSelection().toString()) {
  145.                             /* Don't do anything on text selection */
  146.                             return;
  147.                         }
  148.                         var toggle = e.target || e.srcElement;
  149.                         /* needed because when the toggle contains HTML contents, user can click */
  150.                         /* on any of those elements instead of their parent '.sf-toggle' element */
  151.                         while (!hasClass(toggle, 'sf-toggle')) {
  152.                             toggle = toggle.parentNode;
  153.                         }
  154.                         var element = document.querySelector(toggle.getAttribute('data-toggle-selector'));
  155.                         toggleClass(toggle, 'sf-toggle-on');
  156.                         toggleClass(toggle, 'sf-toggle-off');
  157.                         toggleClass(element, 'sf-toggle-hidden');
  158.                         toggleClass(element, 'sf-toggle-visible');
  159.                         /* the toggle doesn't change its contents when clicking on it */
  160.                         if (!toggle.hasAttribute('data-toggle-alt-content')) {
  161.                             return;
  162.                         }
  163.                         if (!toggle.hasAttribute('data-toggle-original-content')) {
  164.                             toggle.setAttribute('data-toggle-original-content', toggle.innerHTML);
  165.                         }
  166.                         var currentContent = toggle.innerHTML;
  167.                         var originalContent = toggle.getAttribute('data-toggle-original-content');
  168.                         var altContent = toggle.getAttribute('data-toggle-alt-content');
  169.                         toggle.innerHTML = currentContent !== altContent ? altContent : originalContent;
  170.                     });
  171.                     /* Prevents from disallowing clicks on links inside toggles */
  172.                     var toggleLinks = toggles[i].querySelectorAll('a');
  173.                     for (var j = 0; j < toggleLinks.length; j++) {
  174.                         addEventListener(toggleLinks[j], 'click', function(e) {
  175.                             e.stopPropagation();
  176.                         });
  177.                     }
  178.                     toggles[i].setAttribute('data-processed', 'true');
  179.                 }
  180.             },
  181.             createFilters: function() {
  182.                 document.querySelectorAll('[data-filters] [data-filter]').forEach(function (filter) {
  183.                     var filters = filter.closest('[data-filters]'),
  184.                         type = 'choice',
  185.                         name = filter.dataset.filter,
  186.                         ucName = name.charAt(0).toUpperCase()+name.slice(1),
  187.                         list = document.createElement('ul'),
  188.                         values = filters.dataset['filter'+ucName] || filters.querySelectorAll('[data-filter-'+name+']'),
  189.                         labels = {},
  190.                         defaults = null,
  191.                         indexed = {},
  192.                         processed = {};
  193.                     if (typeof values === 'string') {
  194.                         type = 'level';
  195.                         labels = values.split(',');
  196.                         values = values.toLowerCase().split(',');
  197.                         defaults = values.length - 1;
  198.                     }
  199.                     addClass(list, 'filter-list');
  200.                     addClass(list, 'filter-list-'+type);
  201.                     values.forEach(function (value, i) {
  202.                         if (value instanceof HTMLElement) {
  203.                             value = value.dataset['filter'+ucName];
  204.                         }
  205.                         if (value in processed) {
  206.                             return;
  207.                         }
  208.                         var option = document.createElement('li'),
  209.                             label = i in labels ? labels[i] : value,
  210.                             active = false,
  211.                             matches;
  212.                         if ('' === label) {
  213.                             option.innerHTML = '<em>(none)</em>';
  214.                         } else {
  215.                             option.innerText = label;
  216.                         }
  217.                         option.dataset.filter = value;
  218.                         option.setAttribute('title', 1 === (matches = filters.querySelectorAll('[data-filter-'+name+'=\"'+value+'\"]').length) ? 'Matches 1 row' : 'Matches '+matches+' rows');
  219.                         indexed[value] = i;
  220.                         list.appendChild(option);
  221.                         addEventListener(option, 'click', function () {
  222.                             if ('choice' === type) {
  223.                                 filters.querySelectorAll('[data-filter-'+name+']').forEach(function (row) {
  224.                                     if (option.dataset.filter === row.dataset['filter'+ucName]) {
  225.                                         toggleClass(row, 'filter-hidden-'+name);
  226.                                     }
  227.                                 });
  228.                                 toggleClass(option, 'active');
  229.                             } else if ('level' === type) {
  230.                                 if (i === this.parentNode.querySelectorAll('.active').length - 1) {
  231.                                     return;
  232.                                 }
  233.                                 this.parentNode.querySelectorAll('li').forEach(function (currentOption, j) {
  234.                                     if (j <= i) {
  235.                                         addClass(currentOption, 'active');
  236.                                         if (i === j) {
  237.                                             addClass(currentOption, 'last-active');
  238.                                         } else {
  239.                                             removeClass(currentOption, 'last-active');
  240.                                         }
  241.                                     } else {
  242.                                         removeClass(currentOption, 'active');
  243.                                         removeClass(currentOption, 'last-active');
  244.                                     }
  245.                                 });
  246.                                 filters.querySelectorAll('[data-filter-'+name+']').forEach(function (row) {
  247.                                     if (i < indexed[row.dataset['filter'+ucName]]) {
  248.                                         addClass(row, 'filter-hidden-'+name);
  249.                                     } else {
  250.                                         removeClass(row, 'filter-hidden-'+name);
  251.                                     }
  252.                                 });
  253.                             }
  254.                         });
  255.                         if ('choice' === type) {
  256.                             active = null === defaults || 0 <= defaults.indexOf(value);
  257.                         } else if ('level' === type) {
  258.                             active = i <= defaults;
  259.                             if (active && i === defaults) {
  260.                                 addClass(option, 'last-active');
  261.                             }
  262.                         }
  263.                         if (active) {
  264.                             addClass(option, 'active');
  265.                         } else {
  266.                             filters.querySelectorAll('[data-filter-'+name+'=\"'+value+'\"]').forEach(function (row) {
  267.                                 toggleClass(row, 'filter-hidden-'+name);
  268.                             });
  269.                         }
  270.                         processed[value] = true;
  271.                     });
  272.                     if (1 < list.childNodes.length) {
  273.                         filter.appendChild(list);
  274.                         filter.dataset.filtered = '';
  275.                     }
  276.                 });
  277.             }
  278.         };
  279.     })();
  280.     Sfjs.addEventListener(document, 'DOMContentLoaded', function() {
  281.         Sfjs.createTabs();
  282.         Sfjs.createToggles();
  283.         Sfjs.createFilters();
  284.     });
  285. /*]]>*/</script>
  286. ";
  287.         
  288.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->leave($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof);
  289.         
  290.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);
  291.     }
  292.     public function getTemplateName()
  293.     {
  294.         return "TwigBundle::base_js.html.twig";
  295.     }
  296.     public function isTraitable()
  297.     {
  298.         return false;
  299.     }
  300.     public function getDebugInfo()
  301.     {
  302.         return array (  55 => 8,  46 => 4,  43 => 1,);
  303.     }
  304.     public function getSourceContext()
  305.     {
  306.         return new Source("{% deprecated 'The template \"' ~ _self ~'\" is deprecated since Symfony 4.4, will be removed in 5.0.' %}
  307. {# This file is based on WebProfilerBundle/Resources/views/Profiler/base_js.html.twig.
  308.    If you make any change in this file, verify the same change is needed in the other file. #}
  309. <script{% if csp_script_nonce is defined and csp_script_nonce %} nonce=\"{{ csp_script_nonce }}\"{% endif %}>/*<![CDATA[*/
  310.     {# Caution: the contents of this file are processed by Twig before loading
  311.                 them as JavaScript source code. Always use '/*' comments instead
  312.                 of '//' comments to avoid impossible-to-debug side-effects #}
  313.     Sfjs = (function() {
  314.         \"use strict\";
  315.         if ('classList' in document.documentElement) {
  316.             var hasClass = function (el, cssClass) { return el.classList.contains(cssClass); };
  317.             var removeClass = function(el, cssClass) { el.classList.remove(cssClass); };
  318.             var addClass = function(el, cssClass) { el.classList.add(cssClass); };
  319.             var toggleClass = function(el, cssClass) { el.classList.toggle(cssClass); };
  320.         } else {
  321.             var hasClass = function (el, cssClass) { return el.className.match(new RegExp('\\\\b' + cssClass + '\\\\b')); };
  322.             var removeClass = function(el, cssClass) { el.className = el.className.replace(new RegExp('\\\\b' + cssClass + '\\\\b'), ' '); };
  323.             var addClass = function(el, cssClass) { if (!hasClass(el, cssClass)) { el.className += \" \" + cssClass; } };
  324.             var toggleClass = function(el, cssClass) { hasClass(el, cssClass) ? removeClass(el, cssClass) : addClass(el, cssClass); };
  325.         }
  326.         var addEventListener;
  327.         var el = document.createElement('div');
  328.         if (!('addEventListener' in el)) {
  329.             addEventListener = function (element, eventName, callback) {
  330.                 element.attachEvent('on' + eventName, callback);
  331.             };
  332.         } else {
  333.             addEventListener = function (element, eventName, callback) {
  334.                 element.addEventListener(eventName, callback, false);
  335.             };
  336.         }
  337.         return {
  338.             addEventListener: addEventListener,
  339.             createTabs: function() {
  340.                 var tabGroups = document.querySelectorAll('.sf-tabs:not([data-processed=true])');
  341.                 /* create the tab navigation for each group of tabs */
  342.                 for (var i = 0; i < tabGroups.length; i++) {
  343.                     var tabs = tabGroups[i].querySelectorAll(':scope > .tab');
  344.                     var tabNavigation = document.createElement('ul');
  345.                     tabNavigation.className = 'tab-navigation';
  346.                     var selectedTabId = 'tab-' + i + '-0'; /* select the first tab by default */
  347.                     for (var j = 0; j < tabs.length; j++) {
  348.                         var tabId = 'tab-' + i + '-' + j;
  349.                         var tabTitle = tabs[j].querySelector('.tab-title').innerHTML;
  350.                         var tabNavigationItem = document.createElement('li');
  351.                         tabNavigationItem.setAttribute('data-tab-id', tabId);
  352.                         if (hasClass(tabs[j], 'active')) { selectedTabId = tabId; }
  353.                         if (hasClass(tabs[j], 'disabled')) { addClass(tabNavigationItem, 'disabled'); }
  354.                         tabNavigationItem.innerHTML = tabTitle;
  355.                         tabNavigation.appendChild(tabNavigationItem);
  356.                         var tabContent = tabs[j].querySelector('.tab-content');
  357.                         tabContent.parentElement.setAttribute('id', tabId);
  358.                     }
  359.                     tabGroups[i].insertBefore(tabNavigation, tabGroups[i].firstChild);
  360.                     addClass(document.querySelector('[data-tab-id=\"' + selectedTabId + '\"]'), 'active');
  361.                 }
  362.                 /* display the active tab and add the 'click' event listeners */
  363.                 for (i = 0; i < tabGroups.length; i++) {
  364.                     tabNavigation = tabGroups[i].querySelectorAll(':scope >.tab-navigation li');
  365.                     for (j = 0; j < tabNavigation.length; j++) {
  366.                         tabId = tabNavigation[j].getAttribute('data-tab-id');
  367.                         document.getElementById(tabId).querySelector('.tab-title').className = 'hidden';
  368.                         if (hasClass(tabNavigation[j], 'active')) {
  369.                             document.getElementById(tabId).className = 'block';
  370.                         } else {
  371.                             document.getElementById(tabId).className = 'hidden';
  372.                         }
  373.                         tabNavigation[j].addEventListener('click', function(e) {
  374.                             var activeTab = e.target || e.srcElement;
  375.                             /* needed because when the tab contains HTML contents, user can click */
  376.                             /* on any of those elements instead of their parent '<li>' element */
  377.                             while (activeTab.tagName.toLowerCase() !== 'li') {
  378.                                 activeTab = activeTab.parentNode;
  379.                             }
  380.                             /* get the full list of tabs through the parent of the active tab element */
  381.                             var tabNavigation = activeTab.parentNode.children;
  382.                             for (var k = 0; k < tabNavigation.length; k++) {
  383.                                 var tabId = tabNavigation[k].getAttribute('data-tab-id');
  384.                                 document.getElementById(tabId).className = 'hidden';
  385.                                 removeClass(tabNavigation[k], 'active');
  386.                             }
  387.                             addClass(activeTab, 'active');
  388.                             var activeTabId = activeTab.getAttribute('data-tab-id');
  389.                             document.getElementById(activeTabId).className = 'block';
  390.                         });
  391.                     }
  392.                     tabGroups[i].setAttribute('data-processed', 'true');
  393.                 }
  394.             },
  395.             createToggles: function() {
  396.                 var toggles = document.querySelectorAll('.sf-toggle:not([data-processed=true])');
  397.                 for (var i = 0; i < toggles.length; i++) {
  398.                     var elementSelector = toggles[i].getAttribute('data-toggle-selector');
  399.                     var element = document.querySelector(elementSelector);
  400.                     addClass(element, 'sf-toggle-content');
  401.                     if (toggles[i].hasAttribute('data-toggle-initial') && toggles[i].getAttribute('data-toggle-initial') == 'display') {
  402.                         addClass(toggles[i], 'sf-toggle-on');
  403.                         addClass(element, 'sf-toggle-visible');
  404.                     } else {
  405.                         addClass(toggles[i], 'sf-toggle-off');
  406.                         addClass(element, 'sf-toggle-hidden');
  407.                     }
  408.                     addEventListener(toggles[i], 'click', function(e) {
  409.                         e.preventDefault();
  410.                         if ('' !== window.getSelection().toString()) {
  411.                             /* Don't do anything on text selection */
  412.                             return;
  413.                         }
  414.                         var toggle = e.target || e.srcElement;
  415.                         /* needed because when the toggle contains HTML contents, user can click */
  416.                         /* on any of those elements instead of their parent '.sf-toggle' element */
  417.                         while (!hasClass(toggle, 'sf-toggle')) {
  418.                             toggle = toggle.parentNode;
  419.                         }
  420.                         var element = document.querySelector(toggle.getAttribute('data-toggle-selector'));
  421.                         toggleClass(toggle, 'sf-toggle-on');
  422.                         toggleClass(toggle, 'sf-toggle-off');
  423.                         toggleClass(element, 'sf-toggle-hidden');
  424.                         toggleClass(element, 'sf-toggle-visible');
  425.                         /* the toggle doesn't change its contents when clicking on it */
  426.                         if (!toggle.hasAttribute('data-toggle-alt-content')) {
  427.                             return;
  428.                         }
  429.                         if (!toggle.hasAttribute('data-toggle-original-content')) {
  430.                             toggle.setAttribute('data-toggle-original-content', toggle.innerHTML);
  431.                         }
  432.                         var currentContent = toggle.innerHTML;
  433.                         var originalContent = toggle.getAttribute('data-toggle-original-content');
  434.                         var altContent = toggle.getAttribute('data-toggle-alt-content');
  435.                         toggle.innerHTML = currentContent !== altContent ? altContent : originalContent;
  436.                     });
  437.                     /* Prevents from disallowing clicks on links inside toggles */
  438.                     var toggleLinks = toggles[i].querySelectorAll('a');
  439.                     for (var j = 0; j < toggleLinks.length; j++) {
  440.                         addEventListener(toggleLinks[j], 'click', function(e) {
  441.                             e.stopPropagation();
  442.                         });
  443.                     }
  444.                     toggles[i].setAttribute('data-processed', 'true');
  445.                 }
  446.             },
  447.             createFilters: function() {
  448.                 document.querySelectorAll('[data-filters] [data-filter]').forEach(function (filter) {
  449.                     var filters = filter.closest('[data-filters]'),
  450.                         type = 'choice',
  451.                         name = filter.dataset.filter,
  452.                         ucName = name.charAt(0).toUpperCase()+name.slice(1),
  453.                         list = document.createElement('ul'),
  454.                         values = filters.dataset['filter'+ucName] || filters.querySelectorAll('[data-filter-'+name+']'),
  455.                         labels = {},
  456.                         defaults = null,
  457.                         indexed = {},
  458.                         processed = {};
  459.                     if (typeof values === 'string') {
  460.                         type = 'level';
  461.                         labels = values.split(',');
  462.                         values = values.toLowerCase().split(',');
  463.                         defaults = values.length - 1;
  464.                     }
  465.                     addClass(list, 'filter-list');
  466.                     addClass(list, 'filter-list-'+type);
  467.                     values.forEach(function (value, i) {
  468.                         if (value instanceof HTMLElement) {
  469.                             value = value.dataset['filter'+ucName];
  470.                         }
  471.                         if (value in processed) {
  472.                             return;
  473.                         }
  474.                         var option = document.createElement('li'),
  475.                             label = i in labels ? labels[i] : value,
  476.                             active = false,
  477.                             matches;
  478.                         if ('' === label) {
  479.                             option.innerHTML = '<em>(none)</em>';
  480.                         } else {
  481.                             option.innerText = label;
  482.                         }
  483.                         option.dataset.filter = value;
  484.                         option.setAttribute('title', 1 === (matches = filters.querySelectorAll('[data-filter-'+name+'=\"'+value+'\"]').length) ? 'Matches 1 row' : 'Matches '+matches+' rows');
  485.                         indexed[value] = i;
  486.                         list.appendChild(option);
  487.                         addEventListener(option, 'click', function () {
  488.                             if ('choice' === type) {
  489.                                 filters.querySelectorAll('[data-filter-'+name+']').forEach(function (row) {
  490.                                     if (option.dataset.filter === row.dataset['filter'+ucName]) {
  491.                                         toggleClass(row, 'filter-hidden-'+name);
  492.                                     }
  493.                                 });
  494.                                 toggleClass(option, 'active');
  495.                             } else if ('level' === type) {
  496.                                 if (i === this.parentNode.querySelectorAll('.active').length - 1) {
  497.                                     return;
  498.                                 }
  499.                                 this.parentNode.querySelectorAll('li').forEach(function (currentOption, j) {
  500.                                     if (j <= i) {
  501.                                         addClass(currentOption, 'active');
  502.                                         if (i === j) {
  503.                                             addClass(currentOption, 'last-active');
  504.                                         } else {
  505.                                             removeClass(currentOption, 'last-active');
  506.                                         }
  507.                                     } else {
  508.                                         removeClass(currentOption, 'active');
  509.                                         removeClass(currentOption, 'last-active');
  510.                                     }
  511.                                 });
  512.                                 filters.querySelectorAll('[data-filter-'+name+']').forEach(function (row) {
  513.                                     if (i < indexed[row.dataset['filter'+ucName]]) {
  514.                                         addClass(row, 'filter-hidden-'+name);
  515.                                     } else {
  516.                                         removeClass(row, 'filter-hidden-'+name);
  517.                                     }
  518.                                 });
  519.                             }
  520.                         });
  521.                         if ('choice' === type) {
  522.                             active = null === defaults || 0 <= defaults.indexOf(value);
  523.                         } else if ('level' === type) {
  524.                             active = i <= defaults;
  525.                             if (active && i === defaults) {
  526.                                 addClass(option, 'last-active');
  527.                             }
  528.                         }
  529.                         if (active) {
  530.                             addClass(option, 'active');
  531.                         } else {
  532.                             filters.querySelectorAll('[data-filter-'+name+'=\"'+value+'\"]').forEach(function (row) {
  533.                                 toggleClass(row, 'filter-hidden-'+name);
  534.                             });
  535.                         }
  536.                         processed[value] = true;
  537.                     });
  538.                     if (1 < list.childNodes.length) {
  539.                         filter.appendChild(list);
  540.                         filter.dataset.filtered = '';
  541.                     }
  542.                 });
  543.             }
  544.         };
  545.     })();
  546.     Sfjs.addEventListener(document, 'DOMContentLoaded', function() {
  547.         Sfjs.createTabs();
  548.         Sfjs.createToggles();
  549.         Sfjs.createFilters();
  550.     });
  551. /*]]>*/</script>
  552. ""TwigBundle::base_js.html.twig""/mnt/sdc/www/softnauts.com/softnauts-back/vendor/symfony/twig-bundle/Resources/views/base_js.html.twig");
  553.     }
  554. }