Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 

40 righe
943 B

  1. // const $ = require('jquery');
  2. const ihk = require('../ihk');
  3. const Cookies = require('js-cookie');
  4. ihk.CookieConsent = function(banner) {
  5. const t = this;
  6. banner.addClass('initiated');
  7. if (Cookies.get('ihk_cookieconsent', {domain: window.location.host})) {
  8. ihk.cookies = JSON.parse(Cookies.get('ihk_cookieconsent'));
  9. }
  10. else {
  11. ihk.cookies = {
  12. okclicked: false
  13. };
  14. }
  15. if (!ihk.cookies.okclicked) {
  16. setTimeout(function () {
  17. banner.addClass('show');
  18. }, 500)
  19. }
  20. banner.find('.btn').on('click', function (e) {
  21. e.preventDefault();
  22. ihk.cookies.okclicked = true;
  23. Cookies.set('ihk_cookieconsent', JSON.stringify(ihk.cookies), {domain: window.location.host, expires: 365});
  24. banner.removeClass('show');
  25. })
  26. }
  27. global.$('body').on('ihk-init dynamic-component-loaded', function () {
  28. $('.cookieconsent:not(.initiated)').each(function(i) {
  29. new ihk.CookieConsent($(this));
  30. });
  31. })