Sha256: 055416f1d533b38a98a4020fbb5e60b9ae6a319e2b359caad14f2c985ad275a5

Contents?: true

Size: 754 Bytes

Versions: 2

Compression:

Stored size: 754 Bytes

Contents

//= require js.cookie
'use strict';

document.addEventListener('DOMContentLoaded', function() {

  var cookiesEu = {
    init: function() {
      var cookiesEuOKButton = document.querySelector('.js-cookies-eu-ok');

      if (cookiesEuOKButton) {
        this.addListener(cookiesEuOKButton);
      }
    },

    addListener: function(target) {
      // Support for IE < 9
      if (target.attachEvent) {
        target.attachEvent('onclick', this.setCookie);
      } else {
        target.addEventListener('click', this.setCookie, false);
      }
    },

    setCookie: function() {
      Cookies.set('cookie_eu_consented', true, { path: '/', expires: 365 });

      document.querySelector('.js-cookies-eu').remove();
    }
  }

  cookiesEu.init();

});

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cookies_eu-1.5.0 app/assets/javascripts/cookies_eu.js
cookies_eu-1.4.0 app/assets/javascripts/cookies_eu.js