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; } $(function () { const $wagtailspace = $( '' + ' ' + '
' + ' Wagtail Space
13 – 15 March 2019 Arnhem, The Netherlands' + '
' + ' ×' + '
' ); if (!hasCookie('wagtailspaceClosed', 'true') && new Date() < new Date(2019, 2, 15)) { $('.wy-nav-content').prepend($wagtailspace); $wagtailspace.find('.close').click(function (e) { e.preventDefault(); setCookie('wagtailspaceClosed', 'true', 30); $wagtailspace.detach(); }); } });