\r\n \"Peanuts <\/div>\r\n <\/div>\r\n\r\n <\/a>\r\n <\/div>\r\n\r\n","display_after_time_on_page":10,"display_after_inactivity":"","display_after_page_scroll":1,"display_duration":null,"display_frequency":"","hide_close_icon":false,"close_on_click_outside":true,"display_on_exit_intent":false,"size":"large","instance_id":"1"}; if ( !$('style.tsd-overlay-styles').length ) { $(document.body).append(data.styles); } var container = document.createElement('div'); var isOverlayDisplayed = false; container.style.display = 'none'; container.innerHTML = data.overlay_html; $(document.body).append(container); function displayOverlay() { if ( isOverlayDisplayed ) { return; } isOverlayDisplayed = true; $(container).fadeIn(); $(container).find('.close-overlay').on('click', function() { closeOverlay(true); }); $(container).find('a').on('click', function(e) { if ( $(this).attr('href').trim() === '#close-overlay' ) { e.preventDefault(); closeOverlay(true); } }); if ( data.close_on_click_outside ) { $(container).find('.tsd-overlay').on('click', function(e) { if (event.target === this) { closeOverlay(); } }); } var duration = data.display_duration; if ( !isNaN(duration) && typeof duration === 'number' && duration > 0 ) { setTimeout(closeOverlay, duration * 1000); } } function closeOverlay( permanent = false ) { $(container).fadeOut(); if ( permanent ) { var key_prefix = 'tsd_overlay__' + data.instance_id; if ( 'once_per_browser' === data.display_frequency ) { document.cookie = key_prefix + "__displayed_for_browser=yes; path=/; expires=Fri, 31 Dec 9999 23:59:59 GMT"; } else if ( 'once_per_session' === data.display_frequency ) { document.cookie = key_prefix + "__displayed_for_session=yes; path=/"; } } } var afterTimeOnPage = data.display_after_time_on_page; // Display after time on page. if (!isNaN(afterTimeOnPage) && typeof afterTimeOnPage === 'number') { setTimeout(displayOverlay, afterTimeOnPage * 1000); } // Display on exit intent. if ( data.display_on_exit_intent ) { var lastY = null; document.addEventListener("mousemove", function (event) { const topSectionHeight = 80; // Distance from the top of the viewport. if (lastY && event.clientY <= topSectionHeight && event.clientY < lastY) { displayOverlay(); } lastY = event.clientY; }); } // Display on page inactivity. var afterInactivityPeriod = data.display_after_inactivity; if (!isNaN(afterInactivityPeriod) && typeof afterInactivityPeriod === 'number') { let timeoutId; function resetTimeout() { clearTimeout(timeoutId); timeoutId = setTimeout(displayOverlay, afterInactivityPeriod * 1000); } document.addEventListener("click", resetTimeout); document.addEventListener("keydown", resetTimeout); document.addEventListener("scroll", resetTimeout); resetTimeout(); } // Display on page inactivity. var afterPageScroll = data.display_after_page_scroll; if (!isNaN(afterPageScroll) && typeof afterPageScroll === 'number') { var percentage = afterPageScroll; percentage = percentage < 0 ? 0 : percentage; percentage = percentage > 100 ? 100 : percentage; window.addEventListener("scroll", function () { var scrollPosition = window.scrollY === 0 ? 0 : window.scrollY + window.innerHeight; var documentHeight = document.documentElement.scrollHeight; if ((scrollPosition / documentHeight) * 100 >= percentage) { displayOverlay(); } }); } console.log(data); })(window.jQuery); -->