ctEmailModal[1].js

/* |!| Uglify |!| : Date 25-09-2018 /
!function(){var a=function(a){var b=a.gtmParams||{},c=a.cookieParams||{},d=a.actionParams||use”,and:e.and||”and”,endterms:e.endterms||”private policy”,placeholder:e.placeholder||”Enter Your Email”,signme:e.signme||”Sign me up >”,brandColor:e.brandColor||”#F9AE39″,termslink:e.termslink||”http://www.purch.com/terms-of-use/”,policylink:e.policylink||”http://www.purch.com/privacy-policy/”},this.init()};a.prototype={createCookie:function(a,b,c){c||(c=1095);var d=new Date;d.setTime(d.getTime()+24
c6060*1e3),document.cookie=a+”=”+b+”; expires=”+d.toGMTString()+”; path=/”},readCookie:function(a){var b=document.cookie;if(b.length>0){var c=b.indexOf(a+”=”);if(-1!==c){c=c+a.length+1;var d=b.indexOf(“;”,c);return-1===d&&(d=b.length),!0}}return!1},trackingGtm:function(a){var b=window.gtmDataLayer||window.dataLayer||[];b.push({event:this.gtmTracking.event,action:a||”pop-up”,location:this.gtmTracking.location})},submit_by_id:function(a){this.submitCondition(a)!==!1&&this.submitCondition(a),this.trackingGtm(this.gtmTracking.submit);var b=this.actionConf.onSubmitRedirect,c=document.forms.emailForm,d=this;if(void 0!==c.email.value&&””!==c.email.value){document.getElementById(“form-submit”).style.display=”none”,document.getElementById(“form-spinner”).style.display=””;var e=”email=”+c.email.value+”&nlPlacement=”+c.nlPlacement.value,f=new XMLHttpRequest;f.onreadystatechange=function(){4===this.readyState&&200===this.status&&(d.createCookie(d.cookieConf.name,d.cookieConf.value),document.getElementById(“ec-popup-modal”).setAttribute(“style”,”display:none”),b===!0&&(window.document.location.href=document.getElementById(“redirectUrl”).value),document.getElementById(“form-spinner”).style.display=”none”,document.getElementById(“form-submit”).style.display=””)},f.open(“POST”,c.action,!0),f.timeout=6e3,f.ontimeout=function(){document.getElementById(“ec-popup-modal”).setAttribute(“style”,”display:none”),b===!0&&(window.document.location.href=document.getElementById(“redirectUrl”).value),document.getElementById(“form-spinner”).style.display=”none”,document.getElementById(“form-submit”).style.display=””},f.setRequestHeader(“Content-type”,”application/x-www-form-urlencoded”),f.send(e)}else a.preventDefault(),document.getElementById(“form-spinner”).style.display=”none”},close_email:function(){var a=(document.forms.emailForm,document.getElementById(“ec-popup-modal”));a.setAttribute(“style”,”display:none”),document.body.style.overflow=””,this.trackingGtm(this.gtmTracking.close),this.actionConf.onCloseRedirect===!0&&(window.document.location.href=document.getElementById(“redirectUrl”).value)},closeModal:function(a){document.forms.emailForm;a===!0&&document.addEventListener(“click”,function(a){“ec-popup-modal”===a.target.id&&(document.getElementById(“ec-popup-modal”).setAttribute(“style”,”display:none”),window.document.location.href=document.getElementById(“redirectUrl”).value)})},init:function(){this.modalDisplay(),this.firstAction(this.actionConf.firstActionEnabled),this.secondAction(this.actionConf.secondActionEnabled),this.closeModal(this.actionConf.closeModalOnClick)},openModal:function(){document.getElementById(“ec-popup-modal”).setAttribute(“style”,”display:block”),this.createCookie(this.cookieConf.name,this.cookieConf.value,this.cookieConf.days),this.trackingGtm(this.gtmTracking.display)},modalDisplay:function(){var a=this,b=document.createElement(“div”);b.id=”ec-popup-modal”,b.setAttribute(“class”,”ec-popup-modal”),b.setAttribute(“style”,”display:none”);var c=window.location.href,d=”.ec-popup-modal {position: fixed; width: 100%; height: 100%; z-index: 2147483648; background-color: rgba(0,0,0,.6); top: 0; left: 0; } .ec-popup-modal-content {width: 600px; background-color: #fff; position: absolute; top: 150px; left: 50%; margin-left: -300px; text-align: center; border-top:7px solid “+a.textModal.brandColor+’; } .ec-popup-modal-content .top-text {background-color: white; color: black; font-family: “Open Sans”,Arial,sans-serif; } .ec-popup-modal-content .top-text h3 {font-size:16px; } .ec-popup-modal-content .top-text h2 {font-size:24px; font-weight:bold; } .ec-popup-modal-content .email-submit {padding: 10px 30px; background: ‘+a.textModal.brandColor+”; color:white; border: none; font-size: 16px; margin-top: 15px; } .ec-popup-modal-content .close-btn {position: absolute; right: 0; padding: 5px 7px; color: #777; font-size: 150%; cursor:pointer; } .close-btn:hover {color: #808080; } .ec-popup-modal-content #email {margin: 15px 0 0; padding: 5px; font-family: Arial, sans-serif; font-size: 16px; width: 80%; } .ec-popup-modal-content .modal-fineprint {font-size: 12px; margin-bottom: 15px; margin-top: 35px; color: #767676 } .ec-popup-modal-content .modal-fineprint a {text-decoration:underline; } @media screen and (max-width:414px){.ec-popup-modal-content{width: 300px;margin-left: -150px;}.ec-popup-modal-content #email {margin: 10px auto;text-align: center;}}”,e=document.createElement(“style”);e.type=”text/css”,e.innerHTML=d,document.querySelector(“head”).appendChild(e);var f=’

‘+a.textModal.upperText+’

‘+a.textModal.lowerText+’


“;b.innerHTML=f,document.body.appendChild(b);var g=document.querySelectorAll(“.ec-popup-modal-content”),h=g[0].childNodes[0],i=document.getElementById(“ec-popup-privacypolicy”),j=document.getElementById(“ec-popup-termsofuse”);h.addEventListener(“click”,function(b){a.close_email()}),i.addEventListener(“click”,function(b){a.trackingGtm(a.gtmTracking.privacyPolicy)}),j.addEventListener(“click”,function(b){a.trackingGtm(a.gtmTracking.termsOfUse)}),document.querySelectorAll(“.email-submit”)[0].addEventListener(“click”,function(b){b.preventDefault(),a.submit_by_id(b)})},firstAction:function(a){var b=this;return a!==!0?null:void document.addEventListener(b.actionConf.onFirstEventListener,function(a){b.customCondition.call(b,a)},!0)},secondAction:function(a){var b=this;return a!==!0?null:void document.addEventListener(b.actionConf.onSecondEventListener,function(a){b.customEndCondition.call(b,a)},!0)}},window.Purch=window.Purch||{},window.Purch.ctEmailModal=a}();