1(function($) { 2 'use strict'; 3 4 $(function() { 5 const consentBarCookieName = thegem_gdpr_options.consent_bar_cookie_name; 6 7 var $consentBar = $('.gdpr-consent-bar'); 8 9 $('.btn-gdpr-privacy-preferences-close').on('click', function() { 10 $('.gdpr-privacy-preferences').fadeOut(300); 11 }); 12 13 $('.btn-gdpr-preferences, .btn-gdpr-preferences-open').on('click', function(e) { 14 e.preventDefault(); 15 $('.gdpr-privacy-preferences').fadeIn(300); 16 return false; 17 }); 18 19 $('.btn-gdpr-agreement').on('click', function() { 20 if ($consentBar.hasClass('top') && !isShowAdminBar()) { 21 $('html').animate({'margin-top': 0}, 400); 22 } 23 24 var $siteFixedHeader = $('#site-header.fixed'); 25 if (!getCookie(consentBarCookieName) && $siteFixedHeader.length > 0 && $consentBar.hasClass('top')) { 26 $siteFixedHeader.animate({'top': 0}, 300); 27 console.log('hide cookie bar'); 28 } 29 30 $('.gdpr-consent-bar').fadeOut(); 31 setCookie(consentBarCookieName, 1); 32 }); 33 34 $('.gdpr-privacy-preferences').on('click', function() { 35 if ($(event.target).find('.gdpr-privacy-preferences-box').length>0) { 36 $('.gdpr-privacy-preferences').fadeOut(300); 37 } 38 }); 39 40 function initConsentBar() { 41 if ($consentBar.length > 0 && !getCookie(consentBarCookieName)) { 42 if ($consentBar.hasClass('top') && !isShowAdminBar()) { 43 $('html').css({'margin-top': $consentBar.height()+'px'}); 44 } 45 $consentBar.fadeIn(); 46 } 47 } 48 49 function setCookie(name, value, days) { 50 if (days === undefined) { 51 days = 365; 52 } 53 54 var date = new Date(); 55 date.setTime(date.getTime() + (days*24*3600*1000)); 56 57 var options = { 58 path: '/', 59 expires: date 60 }; 61 62 if (options.expires.toUTCString) { 63 options.expires = options.expires.toUTCString(); 64 } 65 66 let updatedCookie = encodeURIComponent(name) + "=" + encodeURIComponent(value); 67 68 for (var optionKey in options) { 69 updatedCookie += "; " + optionKey; 70 var optionValue = options[optionKey]; 71 if (optionValue !== true) { 72 updatedCookie += "=" + optionValue; 73 } 74 } 75 76 document.cookie = updatedCookie; 77 } 78 79 function getCookie(name) { 80 var matches = document.cookie.match(new RegExp( 81 "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)" 82 )); 83 return matches ? decodeURIComponent(matches[1]) : undefined; 84 } 85 86 function isShowAdminBar() { 87 return $('#wpadminbar').length > 0; 88 } 89 90 function fixSiteFixedHeader() { 91 var $siteFixedHeader = $('#site-header.fixed'); 92 if (!getCookie(consentBarCookieName) && $siteFixedHeader.length > 0 && $consentBar.hasClass('top')) { 93 $siteFixedHeader.css({'top': $consentBar.outerHeight()+'px'}); 94 } 95 } 96 97 $(window).on('scroll', function() { 98 fixSiteFixedHeader(); 99 }); 100 101 $(window).on('load', function() { 102 fixSiteFixedHeader(); 103 }); 104 105 $(window).on('resize', function() { 106 fixSiteFixedHeader(); 107 }); 108 109 initConsentBar(); 110 111 }); 112})(jQuery);
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.