{% set parametre = ParametreSite() %}
{% set cookies = Cookies() %}
{% if cookies.cookies == '1' %}
<script type="text/javascript" src="https://www.termsfeed.com/public/cookie-consent/4.0.0/cookie-consent.js" charset="UTF-8" defer></script>
<script type="text/javascript" charset="UTF-8">
document.addEventListener('DOMContentLoaded', function () {
cookieconsent.run({"notice_banner_type":"simple","consent_type":"explicit","palette":"light","language":"{{ app.request.locale }}","page_load_consent_levels":["strictly-necessary"],"notice_banner_reject_button_hide":false,"preferences_center_close_button_hide":false,"website_name":"{{parametre.titre|default('')}}"});
});
</script>
{% else %}
<script src="{{asset('tarteaucitron_js/tarteaucitron.js')}}"></script>
<script type="text/javascript">
tarteaucitron.init({
"privacyUrl": "{{cookies.privacypolicylink|default('cookies')}}", /* Privacy policy url */
"hashtag": "#tarteaucitron", /* Open the panel with this hashtag */
"cookieName": "tartaucitron", /* Cookie name */
"orientation": "{{cookies.postion|default('bottom')}}", /* Banner position (top - bottom) */
"showAlertSmall": {% if app.request.attributes.get('_route_params')['slug'] is defined and app.request.attributes.get('_route_params')['slug'] == 'cookies' %}true{% else %}false{% endif %}, /* Show the small banner on bottom right */
"cookieslist": true, /* Show the cookie list */
"adblocker": false, /* Show a Warning if an adblocker is detected */
"AcceptAllCta" : true, /* Show the accept all button when highPrivacy on */
"highPrivacy": false, /* Disable auto consent */
"handleBrowserDNTRequest": false, /* If Do Not Track == 1, accept all */
"removeCredit": false, /* Remove credit link */
"moreInfoLink": false, /* Show more info link */
"privacyUrlLabel": "{{cookies.labelprivacypolicylink|default('En savoir plus')}}",
"privacyOKLabel": "{{cookies.labelclosebutton|default('OK, tout accepter')}}",
"privacyPersonalizeLabel": "{{cookies.labelcustomlink|default('Personnaliser')}}",
"texte": "{{cookies.message|default('')}}",
"font_color": "{{cookies.colorokbutton|default('#839273')}}",
"fond_color": "{{cookies.backgroundcolor|default('#333333')}}",
"lien_color": "{{cookies.colorcookielink|default('#333333')}}"
//"cookieDomain": ".my-multisite-domaine.fr" /* Shared cookie for subdomain website */
});
</script>
{% if cookies.googletypekit and cookies.googletypekitid is not empty %}
<script type="text/javascript">
tarteaucitron.user.typekitId = '{{cookies.googletypekitid}}';
(tarteaucitron.job = tarteaucitron.job || []).push('typekit');
</script>
{% endif %}
{% if cookies.googletagmanager and cookies.codegoogletagmanager is not empty %}
<script type="text/javascript">
tarteaucitron.user.googletagmanagerId = 'GTM-{{cookies.codegoogletagmanager}}';
(tarteaucitron.job = tarteaucitron.job || []).push('googletagmanager');
</script>
{% endif %}
{% if cookies.googlemaps and cookies.googlemapskey is not empty %}
<script type="text/javascript">
tarteaucitron.user.googlemapsKey = '{{cookies.googlemapskey}}';
(tarteaucitron.job = tarteaucitron.job || []).push('googlemaps');
</script>
{% endif %}
{% if cookies.googleanalytics and cookies.googleanalyticsid is not empty %}
<script type="text/javascript">
tarteaucitron.user.analyticsUa = 'UA-{{cookies.googleanalyticsid}}';
tarteaucitron.user.analyticsMore = function () { /* optionnal ga.push() */ };
tarteaucitron.user.analyticsUaCreate = { /* optionnal create configuration */ };
tarteaucitron.user.analyticsAnonymizeIp = true;
tarteaucitron.user.analyticsPageView = { /* optionnal pageview configuration */ };
tarteaucitron.user.analyticsMore = function () { /* optionnal ga.push() */ };
(tarteaucitron.job = tarteaucitron.job || []).push('analytics');
</script>
{% endif %}
{% if cookies.googleadwords and cookies.codegoogleadwords is not empty %}
<script type="text/javascript">
(tarteaucitron.job = tarteaucitron.job || []).push('googleadwordsconversion');
</script>
{{cookies.codegoogleadwords|raw}}
{% endif %}
{% if cookies.youtube %}
<script type="text/javascript">
(tarteaucitron.job = tarteaucitron.job || []).push('youtube');
</script>
{% endif %}
{% if cookies.facebooklikebox %}
<script type="text/javascript">
(tarteaucitron.job = tarteaucitron.job || []).push('facebooklikebox');
</script>
{% endif %}
{% if cookies.facebook %}
<script type="text/javascript">
(tarteaucitron.job = tarteaucitron.job || []).push('facebook');
</script>
{% endif %}
{% if cookies.linkedin %}
<script type="text/javascript">
(tarteaucitron.job = tarteaucitron.job || []).push('linkedin');
</script>
{% endif %}
{% if cookies.twitter %}
<script type="text/javascript">
(tarteaucitron.job = tarteaucitron.job || []).push('twitter');
</script>
{% endif %}
{% if cookies.twittercards %}
<script type="text/javascript">
(tarteaucitron.job = tarteaucitron.job || []).push('twitterembed');
</script>
{% endif %}
{% if cookies.twittertimeline %}
<script type="text/javascript">
(tarteaucitron.job = tarteaucitron.job || []).push('twittertimeline');
</script>
{% endif %}
{% if cookies.googlerecaptcha != null and parametre != null and parametre.clekey != null %}
<script>
tarteaucitron.user.key = "{{parametre.clekey}}";
(tarteaucitron.job = tarteaucitron.job || []).push('recaptcha3');
</script>
{% endif %}
<script>
var checkCookieRecaptcha = (tarteaucitron.cookie.read().indexOf('recaptcha3=true') >= 0);
var forms = document.querySelectorAll('form');
if(checkCookieRecaptcha){
forms.forEach((form)=> {
$(form).find('[type="submit"]').removeAttr('disabled' ).css({'cursor': '', 'opacity': ''});
});
}else{
forms.forEach((form)=> {
$(form).find('[type="submit"]').attr('disabled', 'disabled').css({'cursor': 'not-allowed', 'opacity': 0.4});
$('<div class="alert-danger alert-cookie-recaptcha">Merci d\'accepter les cookies pour pouvoir envoyer votre message</div>').show().insertBefore($(form).find('[type="submit"]'));
});
}
</script>
{% endif %}