templates/includes/tarteaucitron.js.html.twig line 1

Open in your IDE?
  1. {% if constant("TARTEAUCITRON_ACTIVE") %}
  2. <script type="text/javascript">
  3.     {% if constant("LANGUE") == "fr" %}
  4.         window.tarteaucitronForceLanguage = "fr";
  5.         {% set tarteaucitronlangue="FR" %}
  6.     {% else %}
  7.         window.tarteaucitronForceLanguage = "en";
  8.         {% set tarteaucitronlangue="EN" %}
  9.     {% endif %}
  10.     {% if constant("COOKIE_BOUTON_REFUSER") is defined and constant("COOKIE_BOUTON_REFUSER") is not empty and constant("COOKIE_BOUTON_REFUSER") == "discret" and constant("COOKIE_TYPE") is not empty %}
  11.         {% set alertBigPrivacy_part1=("<a class=\"btnDenyAll\" onclick=\"tarteaucitron.userInterface.respondAll(false, '', true);return false;\" href=\"#\">"~lg_cookie_popup_refuser_discret~"</a>") %}
  12.     {% else %}
  13.         {% set alertBigPrivacy_part1="" %}
  14.     {% endif %}
  15.     {% if constant("COOKIE_TYPE") is not empty and constant("COOKIE_TYPE") in ["top","middle","popup"] %}
  16.             {%  if constant("COOKIE_POPUP_MESSAGE_"~tarteaucitronlangue) %}
  17.                 {% set alertBigPrivacy_part2 = constant("COOKIE_POPUP_MESSAGE_"~tarteaucitronlangue)|e('js')|nl2br %}
  18.             {% else %}
  19.                 {% set alertBigPrivacy_part2="" %}
  20.             {% endif %}
  21.     {% else %}
  22.         {% if constant("COOKIE_BAR_MESSAGE_"~tarteaucitronlangue) %}
  23.             {% set alertBigPrivacy_part2 = constant("COOKIE_BAR_MESSAGE_"~tarteaucitronlangue)|e('js')|nl2br %}
  24.         {% else %}
  25.             {% set alertBigPrivacy_part2="" %}
  26.         {% endif %}
  27.     {% endif %}
  28.     {% if constant("COOKIE_MODAL_PARAM_MESSAGE_"~tarteaucitronlangue) %}
  29.         {% set tac_disclaimer=constant("COOKIE_MODAL_PARAM_MESSAGE_"~tarteaucitronlangue)|e('js')|nl2br %}
  30.     {% else %}
  31.         {% set tac_disclaimer="" %}
  32.     {% endif %}
  33.     var tarteaucitronCustomText = {
  34.         "middleBarHead": "",
  35.         "alertBigPrivacy": "{{ alertBigPrivacy_part1 }} {{ alertBigPrivacy_part2 }}",
  36.         "disclaimer": "{{ tac_disclaimer }}",
  37.         "fallback": "{{ lg_cookie_fallback }}"
  38.         {% if constant("TARTEAUCITRON_SERVICES") is defined %}
  39.             {% for key,value in constant("TARTEAUCITRON_SERVICES") %}
  40.                 {% if value == true and constant('lg_cookie_engage_'~ key) is defined %}
  41.                     ,"engage-{{ key }}": "{{ constant('lg_cookie_engage_'~ key) }}"
  42.                 {% endif %}
  43.             {% endfor %}
  44.         {% endif %}
  45.     };
  46.     tarteaucitron.events = {
  47.         "load": function () {
  48.             var $cookiebar = document.getElementById('tarteaucitronAlertBig');
  49.             if ($cookiebar.style.display == "block") {
  50.                 let cookiebar_height = $cookiebar.offsetHeight;
  51.                 if (cookiebar_height > 0) {
  52.                     document.getElementById('foot_copyrights').style.marginBottom = (cookiebar_height) + 'px';
  53.                 }
  54.             }
  55.         }
  56.     };
  57.     tarteaucitron.init({
  58.         "privacyUrl": "", /* Privacy policy url */
  59.         "hashtag": "#tarteaucitron", /* Open the panel with this hashtag */
  60.         "cookieName": "tarteaucitron", /* Cookie name */
  61.         "orientation": "{% if constant("COOKIE_TYPE") is defined and constant("COOKIE_TYPE") in ["top","middle","bottom","popup"] %}{{ constant("COOKIE_TYPE") }}{% else %}bottom{% endif %}", /* Banner position (top - bottom - middle - popup) */
  62.         "bodyPosition": "bottom",
  63.         "groupServices": false, /* Group services by category */
  64.         "showAlertSmall": false, /* Show the small banner on bottom right */
  65.         "cookieslist": false, /* Show the cookie list */
  66.         "showIcon": false, /* Show cookie icon to manage cookies */
  67.         "adblocker": false, /* Show a Warning if an adblocker is detected */
  68.         "DenyAllCta": {% if constant("COOKIE_BOUTON_REFUSER") is defined and constant("COOKIE_BOUTON_REFUSER") == "discret" and constant("COOKIE_TYPE") is defined and constant("COOKIE_TYPE") in ["top","middle","bottom","popup"] %}false{% elseif constant("COOKIE_BOUTON_REFUSER") is defined and constant("COOKIE_BOUTON_REFUSER") in ["true","false"] %}{{ constant("COOKIE_BOUTON_REFUSER") }}{% else %}true{% endif %}, /* Show the deny all button */
  69.         "AcceptAllCta": true, /* Show the accept all button when highPrivacy on */
  70.         "highPrivacy": true, /* Disable auto consent */
  71.         "handleBrowserDNTRequest": false, /* If Do Not Track == 1, disallow all */
  72.         "removeCredit": true, /* Remove credit link */
  73.         "moreInfoLink": true, /* Show more info link */
  74.         "useExternalCss": false, /* If false, the tarteaucitron.css file will be loaded */
  75.         //"cookieDomain": ".my-multisite-domaine.fr", /* Shared cookie for multisite */
  76.         "readmoreLink": "", /* Change the default readmore link */
  77.         "mandatory": true /* Show a message about mandatory cookies */
  78.     });
  79. </script>
  80. {% endif %}