function setCookie(name, value, days) { const date = new Date(); date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000); document.cookie = encodeURIComponent(name) + '=' + encodeURIComponent(value) + '; expires=' + date.toGMTString(); } function hasCookie(name, value) { return document.cookie.split('; ').indexOf(name + '=' + value) >= 0; } $(() => { const $wagtailspace = $(`
`); if ( !hasCookie('wagtailSpaceNLClosed', 'true') && new Date() < new Date(2022, 5, 18) // Month is 0-based, so subtract one from the real month number! ) { $('main').prepend($wagtailspace); $wagtailspace.find('.wagtailspace-close').click(() => { setCookie('wagtailSpaceNLClosed', 'true', 30); $wagtailspace.detach(); }); } });