<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    {% if title %}
        <title>{{ title }}</title>
    {% endif %}
    {% if reloadUrl %}
        <meta http-equiv="refresh" content="0; url={{ reloadUrl }}&amp;nonce={{ nonce }}" />
    {% endif %}

    {% if stylesheets.external|length > 0 %}
        {% for style in stylesheets.external %}
            <link href="{{ style|raw }}" rel="stylesheet" type="text/css">
        {% endfor %}
    {% endif %}
    {% if stylesheets.inline|length > 0 %}
        <style>
            {% for style in stylesheets.inline %}
            {{ style|raw }}
            {% endfor %}
        </style>
    {% endif %}
</head>
<body>
{% if dntFound %}
    {{ 'CoreAdminHome_OptOutDntFound'|translate }}
{% elseif reloadUrl %}
    {# empty #}
{% else %}
    {# if only showing confirmation (because we're in a new window), we only display the success message if JS is disabled.
     # otherwise we try to close the window immediately.
     #}
    {% if showConfirmOnly %}
    <p>{{ 'CoreAdminHome_OptingYouOut'|translate }}</p>
    <script>window.close();</script>
    <noscript>
    {% endif %}

    {% if not trackVisits %}
        <p>
        {{ 'CoreAdminHome_OptOutComplete'|translate }}

        {{ 'CoreAdminHome_OptOutCompleteBis'|translate }}
        </p>
    {% else %}
        <p>{{ 'CoreAdminHome_YouMayOptOut2'|translate }} {{ 'CoreAdminHome_YouMayOptOut3'|translate }}</p>
    {% endif %}

    {% if showConfirmOnly %}</noscript>{% endif %}

    {% if not showConfirmOnly %}
    <form method="post" action="?{{ queryParameters|url_encode|raw }}" target="_blank">
        <input type="hidden" name="nonce" value="{{ nonce }}" />
        <input type="hidden" name="fuzz" value="{{ "now"|date }}" />
        <input onclick="submitForm(event, this.form);" type="checkbox" id="trackVisits" name="trackVisits" {% if trackVisits %}checked="checked"{% endif %} />
        <label for="trackVisits"><strong>
        {% if trackVisits %}
            {{ 'CoreAdminHome_YouAreNotOptedOut'|translate }} {{ 'CoreAdminHome_UncheckToOptOut'|translate }}
        {% else %}
            {{ 'CoreAdminHome_YouAreOptedOut'|translate }} {{ 'CoreAdminHome_CheckToOptIn'|translate }}
        {% endif %}
        </strong></label>
        <noscript>
            <button type="submit">{{ 'General_Save'|translate }}</button>
        </noscript>
    </form>
    {% endif %}
{% endif %}

{% if javascripts.external|length > 0 %}
    {% for script in javascripts.external %}
        <script type="text/javascript" src="{{ script|raw }}"></script>
    {% endfor %}
{% endif %}
{% if javascripts.inline|length > 0 %}
    <script>
        {% for script in javascripts.inline %}
        {{ script|raw }}
        {% endfor %}
    </script>
{% endif %}
</body>
</html>
