diff --git a/js/bioep.js b/js/bioep.js index 6241207..3dfe2c7 100644 --- a/js/bioep.js +++ b/js/bioep.js @@ -227,6 +227,10 @@ window.bioEp = { // If this is an autocomplete element. if(e.target.tagName.toLowerCase() == "input") return; + + // Firefox bug: When clicking on a select element, clientX/clientY becomes relative to the input. Ignore select elements. + if(e.target.tagName.toLowerCase() == "select") + return; // Get the current viewport width. var vpWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); diff --git a/js/bioep.min.js b/js/bioep.min.js index e40d023..80668f1 100644 --- a/js/bioep.min.js +++ b/js/bioep.min.js @@ -1,10 +1 @@ -window.bioEp={bgEl:{},popupEl:{},closeBtnEl:{},shown:!1,overflowDefault:"visible",transformDefault:"",width:400,height:220,html:"",css:"",fonts:[],delay:5,showOnDelay:!1,cookieExp:30,showOncePerSession:!1,onPopup:null,cookieManager:{create:function(a,b,d,c){var e="";c?e="; expires=0":d&&(c=new Date,c.setTime(c.getTime()+864E5*d),e="; expires="+c.toGMTString());document.cookie=a+"="+b+e+"; path=/"},get:function(a){a+="=";for(var b=document.cookie.split(";"),d=0;d=this.cookieExp){if(this.showOncePerSession&&"true"==this.cookieManager.get("bioep_shown_session"))return!0;this.cookieManager.erase("bioep_shown");return!1}return"true"==this.cookieManager.get("bioep_shown")?!0:!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=Math.max(document.documentElement.clientWidth,window.innerWidth|| -0)-50||50<=a.clientY||a.relatedTarget||a.toElement||bioEp.showPopup())}.bind(this));this.addEvent(this.closeBtnEl,"click",function(){bioEp.hidePopup()});this.addEvent(window,"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;this.showOncePerSession="undefined"===typeof a.showOncePerSession?this.showOncePerSession:a.showOncePerSession;this.onPopup="undefined"===typeof a.onPopup?this.onPopup:a.onPopup},domReady:function(a){"interactive"===document.readyState||"complete"===document.readyState? -a():this.addEvent(document,"DOMContentLoaded",a)},init:function(a){"undefined"!==typeof a&&this.setOptions(a);this.addCSS();this.domReady(function(){bioEp.checkCookie()||(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,showOncePerSession:!1,onPopup:null,cookieManager:{create:function(e,t,o,i){var n="";if(i)n="; expires=0";else if(o){var s=new Date;s.setTime(s.getTime()+24*o*60*60*1e3),n="; expires="+s.toGMTString()}document.cookie=e+"="+t+n+"; path=/"},get:function(e){for(var t=e+"=",o=document.cookie.split(";"),i=0;in-e&&(h.width=n-e,h.height=h.width/d,h.height>s-t&&(h.height=s-t,h.width=h.height*d)),0===h.height&&i>s-t&&(h.height=s-t,h.width=h.height*d);var l=h.width/o;(l<=0||l>1)&&(l=1),""===this.transformDefault&&(this.transformDefault=window.getComputedStyle(this.popupEl,null).getPropertyValue("transform")),this.popupEl.style.transform=this.transformDefault+" scale("+l+")"},addEvent:function(e,t,o){e.addEventListener?e.addEventListener(t,o,!1):e.attachEvent&&e.attachEvent("on"+t,o)},loadEvents:function(){this.addEvent(document,"mouseout",function(e){if("input"!=(e=e||window.event).target.tagName.toLowerCase()&&"select"!=e.target.tagName.toLowerCase()){var t=Math.max(document.documentElement.clientWidth,window.innerWidth||0);if(!(e.clientX>=t-50||e.clientY>=50)){var o=e.relatedTarget||e.toElement;o||console.log(e),console.log(o),bioEp.showPopup()}}}.bind(this)),this.addEvent(this.closeBtnEl,"click",function(){bioEp.hidePopup()}),this.addEvent(window,"resize",function(){bioEp.scalePopup()})},setOptions:function(e){this.width=void 0===e.width?this.width:e.width,this.height=void 0===e.height?this.height:e.height,this.html=void 0===e.html?this.html:e.html,this.css=void 0===e.css?this.css:e.css,this.fonts=void 0===e.fonts?this.fonts:e.fonts,this.delay=void 0===e.delay?this.delay:e.delay,this.showOnDelay=void 0===e.showOnDelay?this.showOnDelay:e.showOnDelay,this.cookieExp=void 0===e.cookieExp?this.cookieExp:e.cookieExp,this.showOncePerSession=void 0===e.showOncePerSession?this.showOncePerSession:e.showOncePerSession,this.onPopup=void 0===e.onPopup?this.onPopup:e.onPopup},domReady:function(e){"interactive"===document.readyState||"complete"===document.readyState?e():this.addEvent(document,"DOMContentLoaded",e)},init:function(e){void 0!==e&&this.setOptions(e),this.addCSS(),this.domReady(function(){bioEp.checkCookie()||(bioEp.addPopup(),setTimeout(function(){bioEp.loadEvents(),bioEp.showOnDelay&&bioEp.showPopup()},1e3*bioEp.delay))})}};