github.com/darmach/terratest@v0.34.8-0.20210517103231-80931f95e3ff/docs/assets/js/cookie.js (about)

     1  ---
     2  ---
     3  /**
     4   * Cookie notice
     5   * @author AKOS
     6   *
     7   * This cookie script must load AFTER the Intercom code above to detect the global "Intercom" variable
     8   * and render the cookie notice right after Intercom's script is injected into the <body>. This will ensure
     9   * that our cookie notice renders ABOVE the Intercom bubble to avoid conflicts with z-index.
    10   */
    11  
    12  (function ($) { "use strict";
    13    var cookieInnerHtml = '<div><p>By using this website you agree to our <a href="{{ site.baseurl }}/cookie-policy/">cookie policy</a></p><button id="cookieModalClose" class="btn btn-primary btn-sm">OK</button></div>';
    14  
    15    var initCookie = function () {
    16  
    17      // Don't create cookie notice if already acknowledged
    18      if (getCookiebyName('GruntyCookie')) {
    19        return;
    20      }
    21  
    22      // Create the cookie modal
    23      var $cookieModal = $('<div />');
    24      $cookieModal.attr('id', 'gruntyCookie');
    25      $cookieModal.css('z-index', '2147483647');
    26      $cookieModal.html(cookieInnerHtml);
    27  
    28      $(document).on('click', '#cookieModalClose', function () {
    29        setCookie('GruntyCookie', '1', 365);
    30        $cookieModal.hide();
    31      });
    32  
    33      $('body').append($cookieModal);
    34    };
    35  
    36    initCookie();
    37  
    38  })(window.jQuery);