Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- document.addEventListener("DOMContentLoaded", function(e) {
- function getCookie(name) {
- var matches = document.cookie.match(new RegExp(
- "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
- ));
- return matches ? decodeURIComponent(matches[1]) : undefined;
- }
- function writeCookie() {
- var date = new Date;
- date.setDate(date.getDate() + 1);
- document.cookie = "alertwin=no; path=/; expires=" + date.toUTCString();
- }
- const alertwin = getCookie("alertwin");
- const exitPopup = $("#exit-popup");
- if (alertwin !== "no") {
- $(document).mouseleave(function(e){
- if (e.clientY < 10) {
- var date = new Date;
- exitPopup.fadeIn("fast");
- date.setDate(date.getDate() + 1);
- document.cookie = "alertwin=no; path=/; expires=" + date.toUTCString();
- }
- });
- $(document).click(function(e) {
- if ((exitPopup.is(":visible")) && ($(e.target).is(exitPopup))) {
- exitPopup.remove();
- }
- });
- }
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement