1jQuery(function ($) { 2 3 const is_cookie_policy_accepted = get_cookie('cookie-policy'); 4 const day = 60 * 60 * 24; 5 6 if (is_cookie_policy_accepted) { 7 return; 8 } 9 10 show_cookie_notification(); 11 on_accept_cookie_policy(); 12 13 function show_cookie_notification() { 14 $('.cookie__notification').addClass('cookie__notification-visible'); 15 } 16 17 function on_accept_cookie_policy() { 18 $('.cookie__notification-confirm').on('click', function () { 19 process_cookie(); 20 hide_cookie_notification(); 21 }); 22 } 23 24 function hide_cookie_notification() { 25 $('.cookie__notification').removeClass('cookie__notification-visible'); 26 } 27 28 function get_cookie(name) { 29 const matches = document.cookie.match(new RegExp( 30 '(?:^|; )' + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + '=([^;]*)' 31 )); 32 33 return matches ? decodeURIComponent(matches[1]) : undefined; 34 } 35 36 function process_cookie() { 37 const domain_reverse = location.hostname.split('.').reverse(); 38 const global_domain = '.' + domain_reverse[1] + '.' + domain_reverse[0]; 39 40 set_cookie('cookie-policy', '1', { 41 expires: day, 42 domain: global_domain, 43 path: '/' 44 }); 45 } 46 47 function set_cookie(name, value, options) { 48 options = options || {}; 49 let expires = options.expires; 50 51 if (typeof expires === 'number' && expires) { 52 let date = new Date(); 53 54 date.setTime(date.getTime() + expires * 365000); 55 expires = options.expires = date; 56 } 57 if (expires && expires.toUTCString) { 58 options.expires = expires.toUTCString(); 59 } 60 61 value = encodeURIComponent(value); 62 63 let updated_cookie = name + '=' + value; 64 65 for (let prop_name in options) { 66 let prop_value = options[prop_name]; 67 68 updated_cookie += '; ' + prop_name; 69 70 if (prop_value !== true) { 71 updated_cookie += '=' + prop_value; 72 } 73 } 74 75 document.cookie = updated_cookie; 76 } 77 78});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.