<!-- Cookie Consent -->
<%page expression_filter="h"/>
<%! from django.utils.translation import ugettext as _ %>
<%namespace name='static' file='../static_content.html'/>
 
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.1/cookieconsent.min.css" />
<script src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.1/cookieconsent.min.js"></script>

<script>
window.addEventListener("load", function(){
  window.cookieconsent.initialise({

    window: '<div dir="${static.dir_rtl()}" role="dialog" tabindex="-1" id="cookiepopup" aria-label="cookieconsent" class="cc-window {{classes}}"><!--googleoff: all-->{{children}}<!--googleon: all--></div>',

    palette:{
      popup: {background: "#323538", text: "#ffffff"},
      button: {background: "#005379", text: "#ffffff"},
    },
    "content": {
      "message": "${_('This website uses cookies to ensure you get the best experience on our website.')}",
      "dismiss": "${_('Got it!')}",
      "link": "${_('Learn more')}",
    },
    theme: "classic",
    "elements": {
        "dismiss": '<a aria-label="dismiss cookie message" id="dismiss" role=button tabindex="2" class="cc-btn cc-dismiss:focus">{{dismiss}}</a>',
    },
    "position": "bottom",
    "static": "true"
  },
  function(popup){

    $(".cc-window").on('keydown', function(event) {
      if (event.keyCode == 27 ){
        popup.close();
      } 
    });

    $("#dismiss").on('keydown', function(event) {
      if (event.keyCode == 13 || event.keyCode == 32 ) {
        popup.onButtonClick(event);
      }
    });  
  });
});
</script>
