// POPUP/POPUNDER ------------------------------------------------------------ var keys = {37: 1, 38: 1, 39: 1, 40: 1}; function preventDefault(e) { e = e || window.event; if (e.preventDefault) e.preventDefault(); e.returnValue = false; } function preventDefaultForScrollKeys(e) { if (keys[e.keyCode]) { preventDefault(e); return false; } } function disableScroll() { if (window.addEventListener) // older FF window.addEventListener('DOMMouseScroll', preventDefault, false); window.onwheel = preventDefault; // modern standard window.onmousewheel = document.onmousewheel = preventDefault; // older browsers, IE window.ontouchmove = preventDefault; // mobile document.onkeydown = preventDefaultForScrollKeys; jQuery("html").css("overflow", "hidden"); jQuery("body").css("overflow", "hidden"); } function enableScroll() { if (window.removeEventListener) window.removeEventListener('DOMMouseScroll', preventDefault, false); window.onmousewheel = document.onmousewheel = null; window.onwheel = null; window.ontouchmove = null; document.onkeydown = null; jQuery("html").css("overflow", "auto"); } require(['jquery','jquery_cookie'] , function ($) { $(document).ready(function(){ console.log('here is inside the magento JS'); console.log('popup script load...'); function getCookie(k) { var v = document.cookie.match('(^|;) ?' + k + '=([^;]*)(;|$)'); return v ? v[2] : null } if (jQuery.cookie('popupshowed') == "true") { enableScroll(); console.log('popup ALREADY shown DO NOT SHOW..'); } else { //alert("showing popup"); console.log('popup SHOWED...'); jQuery('#disablingDiv').show(); jQuery('#disablingDivback').show(); disableScroll(); } var customCookie = jQuery.cookie("private_content_version"); console.log("COOKIE (private_content_version): " + customCookie); jQuery('#nav').append(''); if (getCookie('popupshowed')) { jQuery('#disablingDiv').hide(); jQuery('#disablingDivback').hide(); jQuery.cookie('OKPOPUP', 'true'); } function PopMeUP() { var params = [ 'height=' + screen.height, 'width=' + screen.width, 'toolbar=0', 'scrollbars=' + '1', 'location=' + '0', 'statusbar=' + '0', 'menubar=' + '0', // 'resizable=' + '0' , 'resizable=' + '1' ].join(','); var pageurl = window.location.href; var popup = window.open(pageurl, 'popup_window_PopMeUp', params); popup.moveTo(0, 0); location.href = "https://www.sicurezza.pro/offerta_slider/offerta_slider.php"; } jQuery('#disablingDiv').click(function() { jQuery('#disablingDiv').hide(); jQuery('#disablingDivback').hide(); jQuery.cookie('popupshowed', 'true'); enableScroll(); PopMeUP(); }); // ANTIBACK ------------------------------------------------------------ var ShowAntiBack = true; if (ShowAntiBack == true && jQuery.cookie('cs_in') == null) { jQuery.cookie('cs_in', 'true', { path: '/' }); (function(window,undefined){ // Establish Variables var oldurl = window.location.href; history.pushState({state:1,rand:Math.random()}, "", oldurl); history.pushState({state:2,rand:Math.random()}, "", oldurl); history.pushState({state:3,rand:Math.random()}, "", oldurl); history.pushState({state:4,rand:Math.random()}, "", oldurl); history.pushState({state:5,rand:Math.random()}, "", oldurl); history.pushState({state:6,rand:Math.random()}, "", oldurl); history.pushState({state:7,rand:Math.random()}, "", oldurl); history.pushState({state:8,rand:Math.random()}, "", oldurl); history.pushState({state:9,rand:Math.random()}, "", oldurl); history.pushState({state:10,rand:Math.random()}, "", oldurl); history.pushState({state:11,rand:Math.random()}, "", oldurl); })(window); } // ANTIBACK ------------------------------------------------------------ }) }); // POPUP/POPUNDER ------------------------------------------------------------