Remove book modal

This commit is contained in:
Jeremy Thomas 2018-04-08 19:54:36 +01:00
parent a76c16b387
commit c63b57b58d
2 changed files with 46 additions and 30 deletions

View File

@ -7,23 +7,23 @@ document.addEventListener('DOMContentLoaded', () => {
// 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 (!cookieBookModal) { // if (!cookieBookModal) {
setTimeout(() => { // setTimeout(() => {
openModal('bookModal'); // openModal('bookModal');
}, 5000); // }, 5000);
} // }
if ($bookModalCloseButtons.length > 0) { // if ($bookModalCloseButtons.length > 0) {
$bookModalCloseButtons.forEach($el => { // $bookModalCloseButtons.forEach($el => {
$el.addEventListener('click', event => { // $el.addEventListener('click', event => {
event.stopPropagation(); // event.stopPropagation();
Cookies.set(cookieBookModalName, true, { expires: 30 }); // Cookies.set(cookieBookModalName, true, { expires: 30 });
}); // });
}); // });
} // }
// Meta links // Meta links
@ -117,6 +117,14 @@ document.addEventListener('DOMContentLoaded', () => {
}); });
} }
document.addEventListener('keydown', event => {
const e = event || window.event;
if (e.keyCode === 27) {
closeModals();
closeDropdowns();
}
});
// Clipboard // Clipboard
const $highlights = getAll('.highlight'); const $highlights = getAll('.highlight');

View File

@ -9,23 +9,23 @@ document.addEventListener('DOMContentLoaded', function () {
// Book modal // Book modal
var $bookModal = document.getElementById('bookModal'); // const $bookModal = document.getElementById('bookModal');
var $bookModalCloseButtons = getAll('.bd-book-modal-close'); // const $bookModalCloseButtons = getAll('.bd-book-modal-close');
if (!cookieBookModal) { // if (!cookieBookModal) {
setTimeout(function () { // setTimeout(() => {
openModal('bookModal'); // openModal('bookModal');
}, 5000); // }, 5000);
} // }
if ($bookModalCloseButtons.length > 0) { // if ($bookModalCloseButtons.length > 0) {
$bookModalCloseButtons.forEach(function ($el) { // $bookModalCloseButtons.forEach($el => {
$el.addEventListener('click', function (event) { // $el.addEventListener('click', event => {
event.stopPropagation(); // event.stopPropagation();
Cookies.set(cookieBookModalName, true, { expires: 30 }); // Cookies.set(cookieBookModalName, true, { expires: 30 });
}); // });
}); // });
} // }
// Meta links // Meta links
@ -119,6 +119,14 @@ document.addEventListener('DOMContentLoaded', function () {
}); });
} }
document.addEventListener('keydown', function (event) {
var e = event || window.event;
if (e.keyCode === 27) {
closeModals();
closeDropdowns();
}
});
// Clipboard // Clipboard
var $highlights = getAll('.highlight'); var $highlights = getAll('.highlight');