0
0
mirror of https://github.com/Maks1mS/free-ozon-dpr.git synced 2025-01-15 11:51:04 +03:00
free-ozon-dpr/src/info-popup.js

27 lines
803 B
JavaScript
Raw Normal View History

import Cookies from "js-cookie";
2024-06-09 08:14:56 +03:00
import { el } from "./utils.js";
const HIDE_INFO_POPUP = "hideInfoPopup";
document.addEventListener("DOMContentLoaded", function () {
2024-06-09 08:14:56 +03:00
const infoPopup = document.querySelector(".info-popup");
const noShowCheckbox = document.querySelector('input[name="no-show"]');
const confirmButton = document.querySelector(".info-popup footer button");
const map = el("map");
2024-06-09 08:14:56 +03:00
const hidePopupCookie = Cookies.get(HIDE_INFO_POPUP);
if (!hidePopupCookie) {
infoPopup.style.display = "block";
map.style.display = "none";
}
2024-06-09 08:14:56 +03:00
confirmButton.addEventListener("click", function () {
if (noShowCheckbox.checked) {
Cookies.set(HIDE_INFO_POPUP, "true", { expires: 400 });
}
2024-06-09 08:14:56 +03:00
infoPopup.style.display = "none";
map.style.display = "block";
});
});