{% extends '@nucleus/partials/particle.html.twig' %}

{% block particle %}
{% assets in 'head' with {priority: 0} %}
<link rel="stylesheet" href="{{ url('gantry-theme://css/cookieconsent.min.css') }}"/>
{% endassets -%}

{% set color = particle.color %}
{% scripts in 'footer' with {priority: 10} %}
<script src="{{ url('gantry-theme://js/cookieconsent.min.js') }}" data-cfasync="false"></script>
<script>
window.addEventListener("load", function() {
  window.cookieconsent.initialise({
    "palette": {
      "popup": {
        "background": "{{color.banner == "" ? "#000000" : color.banner}}",
        "text": "{{color.bannertext == "" ? " #ffffff" : color.bannertext}}"
      },
      "button": {
        {% if particle.layout == 'wire' %}
        "background": "transparent",
        "border": "{{color.buttontext == "" ? "#f1d600" : color.buttontext}}",
        "text": "{{color.buttontext == "" ? "#f1d600" : color.buttontext}}"
        {% else %}
        "background": "{{color.button == "" ? "#f1d600" : color.button}}",
        "text": "{{color.buttontext == "" ? "#333" : color.buttontext}}"
        {% endif %}

      }
    },
    {% if (particle.layout != "default") and (particle.layout != "wire") %}
    "theme": "{{particle.layout}}",
    {% endif %}
    {% if particle.position != "default" %}
    {% if particle.position == "top2" %}
    "position": "top",
    "static": true,
    {% else %}
    "position": "{{particle.position}}",
    {% endif %}
    {% endif %}
    "content": {
      "message": "{{particle.message|e('js')}}",
      {% if particle.dismiss %}"dismiss": "{{particle.dismiss|e('js')}}",{% endif %}
      {% if particle.readmore %}"link": "{{particle.readmore|e('js')}}",{% endif %}
      {% if particle.policy != "" %}
      "href": "{{particle.policy|e('js')}}"
      {% endif %}
    }
  })
});
</script>
{% endscripts %}
{% endblock %}
