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