Advertisement
bongzilla

Untitled

Mar 3rd, 2022
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. <script>
  2. document.addEventListener("DOMContentLoaded", function(e) {
  3. function getCookie(name) {
  4. var matches = document.cookie.match(new RegExp(
  5. "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
  6. ));
  7. return matches ? decodeURIComponent(matches[1]) : undefined;
  8. }
  9.  
  10. function writeCookie() {
  11. var date = new Date;
  12. date.setDate(date.getDate() + 1);
  13. document.cookie = "alertwin=no; path=/; expires=" + date.toUTCString();
  14. }
  15.  
  16. const alertwin = getCookie("alertwin");
  17. const exitPopup = $("#exit-popup");
  18.  
  19. if (alertwin !== "no") {
  20. $(document).mouseleave(function(e){
  21. if (e.clientY < 10) {
  22. var date = new Date;
  23.  
  24. exitPopup.fadeIn("fast");
  25. date.setDate(date.getDate() + 1);
  26. document.cookie = "alertwin=no; path=/; expires=" + date.toUTCString();
  27. }
  28. });
  29. $(document).click(function(e) {
  30. if ((exitPopup.is(":visible")) && ($(e.target).is(exitPopup))) {
  31. exitPopup.remove();
  32. }
  33. });
  34. }
  35. });
  36. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement