mirror of
https://github.com/jgthms/bulma.git
synced 2025-01-09 15:44:25 +00:00
Add cookie expiration date
This commit is contained in:
parent
af5e17a96d
commit
1a4c242fc6
@ -2,14 +2,15 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
|
|
||||||
// Cookies
|
// Cookies
|
||||||
|
|
||||||
const bdCookies = Cookies.getJSON('bulma') || {};
|
const cookieBookModalName = 'bulma_closed_book_modal';
|
||||||
|
const cookieBookModal = Cookies.getJSON(cookieBookModalName) || false;
|
||||||
|
|
||||||
// Book modal
|
// Book modal
|
||||||
|
|
||||||
const $bookModal = document.getElementById('bookModal');
|
const $bookModal = document.getElementById('bookModal');
|
||||||
const $bookModalCloseButtons = getAll('.bd-book-modal-close');
|
const $bookModalCloseButtons = getAll('.bd-book-modal-close');
|
||||||
|
|
||||||
if (!bdCookies['closed_book_modal']) {
|
if (!cookieBookModal) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
openModal('bookModal');
|
openModal('bookModal');
|
||||||
}, 5000);
|
}, 5000);
|
||||||
@ -19,8 +20,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
$bookModalCloseButtons.forEach($el => {
|
$bookModalCloseButtons.forEach($el => {
|
||||||
$el.addEventListener('click', event => {
|
$el.addEventListener('click', event => {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
bdCookies['closed_book_modal'] = true;
|
Cookies.set(cookieBookModalName, true, { expires: 30 });
|
||||||
Cookies.set('bulma', bdCookies);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -4,14 +4,15 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
|
|
||||||
// Cookies
|
// Cookies
|
||||||
|
|
||||||
var bdCookies = Cookies.getJSON('bulma') || {};
|
var cookieBookModalName = 'bulma_closed_book_modal';
|
||||||
|
var cookieBookModal = Cookies.getJSON(cookieBookModalName) || false;
|
||||||
|
|
||||||
// Book modal
|
// Book modal
|
||||||
|
|
||||||
var $bookModal = document.getElementById('bookModal');
|
var $bookModal = document.getElementById('bookModal');
|
||||||
var $bookModalCloseButtons = getAll('.bd-book-modal-close');
|
var $bookModalCloseButtons = getAll('.bd-book-modal-close');
|
||||||
|
|
||||||
if (!bdCookies['closed_book_modal']) {
|
if (!cookieBookModal) {
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
openModal('bookModal');
|
openModal('bookModal');
|
||||||
}, 5000);
|
}, 5000);
|
||||||
@ -21,8 +22,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
$bookModalCloseButtons.forEach(function ($el) {
|
$bookModalCloseButtons.forEach(function ($el) {
|
||||||
$el.addEventListener('click', function (event) {
|
$el.addEventListener('click', function (event) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
bdCookies['closed_book_modal'] = true;
|
Cookies.set(cookieBookModalName, true, { expires: 30 });
|
||||||
Cookies.set('bulma', bdCookies);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user