diff --git a/js/bioep.js b/js/bioep.js index 23d9d3c..f97332c 100644 --- a/js/bioep.js +++ b/js/bioep.js @@ -196,12 +196,10 @@ window.bioEp = { // Event listener initialisation for all browsers addEvent: function (obj, event, callback) { - if (obj.addEventListener) { + if(obj.addEventListener) obj.addEventListener(event, callback, false); - } - else if (obj.attachEvent) { + else if(obj.attachEvent) obj.attachEvent("on" + event, callback); - } }, // Load event listeners for the popup @@ -210,10 +208,10 @@ window.bioEp = { this.addEvent(document, "mouseout", function(e) { e = e ? e : window.event; var from = e.relatedTarget || e.toElement; + // Reliable, works on mouse exiting window and user switching active program - if (!from || from.nodeName == "HTML") { + if(!from || from.nodeName === "HTML") bioEp.showPopup(); - } }); // Handle the popup close button diff --git a/js/bioep.min.js b/js/bioep.min.js index 2ccd4c5..b48d567 100644 --- a/js/bioep.min.js +++ b/js/bioep.min.js @@ -1,9 +1,9 @@ -window.bioEp={bgEl:{},popupEl:{},closeBtnEl:{},shown:!1,overflowDefault:"visible",transformDefault:"",width:400,height:220,html:"",css:"",fonts:[],delay:5,showOnDelay:!1,cookieExp:30,cookieManager:{create:function(a,c,d){var b="";d&&(b=new Date,b.setTime(b.getTime()+864E5*d),b="; expires="+b.toGMTString());document.cookie=a+"="+c+b+"; path=/"},get:function(a){a+="=";for(var c=document.cookie.split(";"),d=0;d=this.cookieExp)return this.cookieManager.erase("bioep_shown"),!1;if("true"==this.cookieManager.get("bioep_shown"))return!0;this.cookieManager.create("bioep_shown","true",this.cookieExp);return!1},addCSS:function(){for(var a=0;ad-40&&(e=d-40,f=e/g,f>b-40&&(f=b-40,e=f*g));0===f&&c>b-40&&(e=(b-40)*g);a=e/a;if(0>=a||1 -a.pageY-(window.pageYOffset||document.documentElement.scrollTop)&&bioEp.showPopup()});this.closeBtnEl.addEventListener("click",function(){bioEp.hidePopup()});window.addEventListener("resize",function(){bioEp.scalePopup()})},setOptions:function(a){this.width="undefined"===typeof a.width?this.width:a.width;this.height="undefined"===typeof a.height?this.height:a.height;this.html="undefined"===typeof a.html?this.html:a.html;this.css="undefined"===typeof a.css?this.css:a.css;this.fonts="undefined"===typeof a.fonts? -this.fonts:a.fonts;this.delay="undefined"===typeof a.delay?this.delay:a.delay;this.showOnDelay="undefined"===typeof a.showOnDelay?this.showOnDelay:a.showOnDelay;this.cookieExp="undefined"===typeof a.cookieExp?this.cookieExp:a.cookieExp},domReady:function(a){"interactive"===document.readyState||"complete"===document.readyState?a():document.addEventListener("DOMContentLoaded",a)},init:function(a){this.domReady(function(){"undefined"!==typeof a&&bioEp.setOptions(a);bioEp.checkCookie()||(bioEp.addCSS(), -bioEp.addPopup(),setTimeout(function(){bioEp.loadEvents();bioEp.showOnDelay&&bioEp.showPopup()},1E3*bioEp.delay))})}}; \ No newline at end of file +window.bioEp={bgEl:{},popupEl:{},closeBtnEl:{},shown:!1,overflowDefault:"visible",transformDefault:"",width:400,height:220,html:"",css:"",fonts:[],delay:5,showOnDelay:!1,cookieExp:30,cookieManager:{create:function(a,b,d){var c="";d&&(c=new Date,c.setTime(c.getTime()+864E5*d),c="; expires="+c.toGMTString());document.cookie=a+"="+b+c+"; path=/"},get:function(a){a+="=";for(var b=document.cookie.split(";"),d=0;d=this.cookieExp)return this.cookieManager.erase("bioep_shown"),!1;if("true"==this.cookieManager.get("bioep_shown"))return!0;this.cookieManager.create("bioep_shown","true",this.cookieExp);return!1},addCSS:function(){for(var a=0;ad-40&&(e=d-40,f=e/g,f>c-40&&(f=c-40,e=f*g));0===f&&b>c-40&&(e=(c-40)*g);a=e/a;if(0>=a||1