| 1 |
function _extends(){return(_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n,o=arguments[t];for(n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e}).apply(this,arguments)}function _inheritsLoose(e,t){e.prototype=Object.create(t.prototype),(e.prototype.constructor=e).__proto__=t}function _createForOfIteratorHelperLoose(e,t){var n;if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator])return(n=e[Symbol.iterator]()).next.bind(n);if(Array.isArray(e)||(n=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}!function(c,a){"use strict";var e={onIdle:function(e){var t,n=["mousedown","mousemove","keypress","scroll","touchstart","click"];function o(){clearTimeout(t),t=setTimeout(i,e.time)}function i(){e.callback(),n.forEach(function(e){a.removeEventListener(e,o)})}this.start=function(){o(),c.addEventListener("load",o),n.forEach(function(e){a.addEventListener(e,o)})},this.bind=function(){this.start()}},onAdBlockDetect:function(e){function t(){n||!function(){var e=a.createElement("div");e.id="ad-detector",e.className="adsbygoogle",a.body.appendChild(e);var t="none"===getComputedStyle(e,null).display;return e.remove(),t}()||(n=!0,e.callback())}var n=!1;return this.bind=function(){t(),c.onload=t,c.onload=setTimeout(t,1e3)},this},onHover:function(e){function t(){o=setTimeout(function(){e.callback()},e.delay)}function n(){clearTimeout(o)}var o,i=a.querySelectorAll(e.selector);if(i.length)return this.bind=function(){i.forEach(function(e){e.addEventListener("mouseover",t),e.addEventListener("mouseout",n)})},this.unbind=function(){i.forEach(function(e){e.removeEventListener("mouseover",t),e.removeEventListener("mouseout",n)})},this},onExit:function(t){var e=this;t=FireBox.extend({sensitivity:20,aggressive:!1,timer:2e3,delay:0,callback:null},t);function n(e){e.relatedTarget||e.toElement||e.clientY>t.sensitivity||(i=setTimeout(r,t.delay))}function o(){i&&(clearTimeout(i),i=null)}var i=null,r=function(){t.callback(),t.aggressive||e.unbind()};return this.bind=function(){setTimeout(function(){a.addEventListener("mouseout",n),a.addEventListener("mouseenter",o)},t.timer)},this.unbind=function(){a.removeEventListener("mouseout",n),a.removeEventListener("mouseenter",o)},this},onScrollDepth:function(i){var e,t=this;i=FireBox.extend({scroll_depth:"percentage",scroll_depth_value:80,scroll_dir:"down",callback:null,once:!0},i);function n(){var e,t,n,o="percentage"==i.scroll_depth?(o=a.documentElement,e=a.body,n="scrollHeight",(o[t="scrollTop"]||e[t])/((o[n]||e[n])-o.clientHeight)*100):c.scrollY;return"up"==r()?o<=i.scroll_depth_value:o>=i.scroll_depth_value}function o(){var e=r()==i.scroll_dir;n()&&e&&"function"==typeof i.callback&&(i.callback(),i.once&&t.unbind()),s=a.body.getBoundingClientRect().top}var r=function(){var e=a.body.getBoundingClientRect().top;return s<e?"up":"down"},s=0;return this.bind=function(){e=FireBox.throttle(o,10),o(),c.addEventListener("scroll",e)},this.unbind=function(){c.removeEventListener("scroll",e)},this},onClick:function(t){t=FireBox.extend({selector:null,callback:null},t);var e=a.querySelectorAll(t.selector);if(e.length){var n=function(e){t.prevent_default&&e.preventDefault(),t.callback(e)};return this.bind=function(){e.forEach(function(e){e.addEventListener("click",n)})},this.unbind=function(){e.forEach(function(e){e.removeEventListener("click",n)})},this}},onPageReady:function(e){return this.bind=function(){e.callback()},this},onPageLoad:function(e){return this.bind=function(){c.addEventListener("load",function(){e.callback()})},this},onElementVisibility:function(t){var n=this;if((t=FireBox.extend({selector:"",threshold:.5,on:"",off:"",once:!0},t)).selector&&c.IntersectionObserver){var e=a.querySelector(t.selector),o=!1,i=new IntersectionObserver(function(e){e.forEach(function(e){e.isIntersecting?(t.on(),o=!0,"function"!=typeof t.off&&t.once&&n.unbind()):"function"==typeof t.off&&(t.off(),o&&t.once&&n.unbind())})},{threshold:t.threshold});return this.bind=function(){i.observe(e)},this.unbind=function(){i.unobserve(e)},this}}};c.FireBoxTriggers=e}(window,document),function(i,s,c){"use strict";var n=[],e=function(r){function a(t,e){var n=r.call(this)||this;n.name="FireBox",n.el=t,n.el.box=t.querySelector(".fb-dialog"),n.id=parseInt(t.dataset.id),n.activeTriggers=[];var o,i={trigger:"onPageLoad",trigger_selector:"",prevent_default:!(n.opened=!1),delay:0,scroll_depth:"percentage",scroll_depth_value:80,scroll_dir:"down",firing_frequency:1,reverse_scroll_close:!1,threshold:.5,close_out_viewport:!1,exit_timer:2e3,idle_time:1e4,animation_open:"transition.fadeIn",animation_close:"transition.fadeOut",animation_duration:400,backdrop:!0,backdrop_color:"rgba(0,0,0,.8)",backdrop_click:!0,disable_page_scroll:!1,ga_tracking:!1,ga_tracking_id:"",ga_tracking_label:n.name,css_class_prefix:"fb-",auto_focus:!1,box_log_id:null,test_mode:!1,debug:!1};try{o=JSON.parse(t.dataset.options)}catch(e){console.warn("FireBox: Cannot parse box's data-options property. Using default settings.",t)}return n.options=n.constructor.extend(i,e||o||[]),n.init(),n}_inheritsLoose(a,r);var e=a.prototype;return e.open=function(n){var o=this,i=this.constructor.extend(_extends({},this.options),n);setTimeout(function(){if(o.opened)o.log("Open Fail: Already opened.");else if(o.isTransitioning())o.log("Open Fail: Is triggering..");else if(!1!==o.emitEvent("beforeOpen")){o.el.classList.add("triggering");var e=function(){o.el.classList.remove("fb-hide"),o.emitEvent("open",n)},t=function(){o.opened=!0,o.el.classList.remove("triggering"),o.emitEvent("afterOpen",n)};if(!c)return e(),void o.constructor.animateCSS(o.el.box,"fb-fadeIn",function(){t()});c(o.el.box,i.animation_open,{duration:i.animation_duration,begin:function(){e(),-1<i.animation_open.indexOf("callout.")&&(o.el.box.style.display="block",o.el.box.style.opacity="1")},complete:function(){t()}})}else o.log("Open aborted")},i.delay)},e.close=function(e){var t=this,n=this.constructor.extend(_extends({},this.options),e);if(this.opened)if(this.isTransitioning())this.log("Close Fail: Is triggering.");else if(!1!==this.emitEvent("beforeClose")){this.el.classList.add("triggering");var o=function(){t.emitEvent("close",e)},i=function(){t.opened=!1,t.el.classList.remove("triggering"),t.emitEvent("afterClose",e),t.el.classList.add("fb-hide")};if(!c)return o(),void this.constructor.animateCSS(this.el.box,"fb-fadeOut",function(){i()});c(this.el.box,n.animation_close,{duration:n.animation_duration,begin:function(){o()},complete:function(){i()}})}else this.log("Close aborted");else this.log("Close Fail: Already closed")},e.getNonceToken=function(){return this.constructor.getWPOptions("nonce")},e.getAJAXURL=function(){return this.constructor.getWPOptions("ajax_url")},e.request=function(t,n){var e={nonce:this.getNonceToken()};t=Object.assign(e,t),n=this.constructor.extend({data:null,onSuccess:null},n);var e=Object.keys(t).map(function(e){return e+"="+t[e]}).join("&"),o=new XMLHttpRequest;o.open("POST",this.getAJAXURL()+"?"+e,!0),o.setRequestHeader("X-Ajax-Engine",this.name),o.onload=function(){var e=o.response;try{e=JSON.parse(e)}catch(e){}200===o.status&&n.onSuccess&&n.onSuccess.call(i,e,o)},o.send()},e.isTransitioning=function(){return this.el.classList.contains("triggering")},e.toggle=function(e){this.opened?this.close(e):this.open(e)},e.unbindTriggers=function(){this.activeTriggers.forEach(function(e){e.hasOwnProperty("unbind")&&e.unbind()}),this.log("Triggers unbound")},e.trigger_onScrollDepth=function(e){var t=this,n=this.constructor.extend(_extends({},this.options),e);return new FireBoxTriggers.onScrollDepth({scroll_depth:n.scroll_depth,scroll_depth_value:n.scroll_depth_value,scroll_dir:n.scroll_dir,once:1==n.firing_frequency,callback:function(){t.open(),n.reverse_scroll_close&&new FireBoxTriggers.onScrollDepth({scroll_depth:n.scroll_depth,scroll_depth_value:n.scroll_depth_value,scroll_dir:"up"==n.scroll_dir?"down":"up",callback:function(){t.close({temporary:!0})}}).bind()}})},e.trigger_onElementVisibility=function(e){var t=this,n=this.constructor.extend(_extends({},this.options),e);return new FireBoxTriggers.onElementVisibility({selector:n.trigger_selector,threshold:n.threshold,once:1==n.firing_frequency,on:function(){t.open()},off:function(){n.close_out_viewport&&t.close({temporary:!0})}})},e.trigger_onHover=function(e){var t=this,e=this.constructor.extend(_extends({},this.options),e);return new FireBoxTriggers.onHover({selector:e.trigger_selector,delay:e.delay,callback:function(){t.open({delay:0})}})},e.trigger_onClick=function(e){var t=this,e=this.constructor.extend(_extends({},this.options),e);return new FireBoxTriggers.onClick({selector:e.trigger_selector,prevent_default:e.prevent_default,callback:function(){t.open()}})},e.trigger_onExit=function(e){var t=this,e=this.constructor.extend(_extends({},this.options),e);return this.constructor.isTouchDevice()?new FireBoxTriggers.onScrollDepth({scroll_depth_value:40,scroll_dir:"up",once:!0,callback:function(){t.open()}}):new FireBoxTriggers.onExit({timer:e.exit_timer,aggressive:2==e.firing_frequency,callback:function(){t.open({delay:0})}})},e.trigger_onPageLoad=function(){var e=this;return new FireBoxTriggers.onPageLoad({callback:function(){e.open()}})},e.trigger_onPageReady=function(){var e=this;return new FireBoxTriggers.onPageReady({callback:function(){e.open()}})},e.trigger_onAdBlockDetect=function(){var e=this;return new FireBoxTriggers.onAdBlockDetect({callback:function(){e.open()}})},e.trigger_onIdle=function(e){var t=this,e=this.constructor.extend(_extends({},this.options),e),n=new FireBoxTriggers.onIdle({time:e.idle_time,callback:function(){t.open({delay:0})}});return 2==e.firing_frequency&&this.on("afterClose",function(){n.start()}),n},e.bindTrigger=function(e,t){var n="trigger_"+(e=e||this.options.trigger);"function"==typeof this[n]?(t=this[n](t)).hasOwnProperty("bind")?(t.bind(),this.activeTriggers.push(t),this.log("Bind Trigger: "+e)):this.log("Cannot bind trigger "+e+". bind() method not found."):this.log("Trigger not found: "+e)},e.emitEvent=function(e,t){return this.emit(e,this,t)},e.HTMLAttributes=function(){0<n.length||s.addEventListener("click",function(e){var t=e.target;if(t.hasAttribute("data-fbox-cmd")||t.hasAttribute("data-fbox")){var n=t.dataset&&t.dataset.fbox?t.dataset.fbox:t.closest(".fb-inst")&&t.closest(".fb-inst").dataset.id?t.closest(".fb-inst").dataset.id:null;if(n){var o=a.getInstance(n);if(o){for(var i=t.getAttribute("data-fbox-cmd"),r={},s=0;s<t.attributes.length;s++){var c=t.attributes[s];/^data-fbox-/.test(c.nodeName)&&(r[c.nodeName.replace(/^data-fbox-/,"")]=c.nodeValue)}switch(i){case"open":o.open(r);break;case"close":o.close(r);break;case"closeKeep":case"hide":console.warn('The "'+i+'" command is deprecated. Please, use "close" command instead.'),o.close(r);break;default:o.toggle(r)}"0"!=t.getAttribute("data-fbox-prevent")&&e.preventDefault()}else console.warn('FireBox with ID "#'+n+'" not found on the page. Make sure it is published.')}}})},e.bindActions=function(){var o=this;this.on("beforeOpen",function(){if(!o.options.test_mode&&o.constructor.getCookie(o.name.toLowerCase()+"_"+o.id))return!1});var e,t=s.querySelector("html"),n=this.options.css_class_prefix;this.options.backdrop&&(e=s.createElement("div"),this.on("open",function(){e.classList.add(n+"backdrop"),e.style.backgroundColor=o.options.backdrop_color,o.el.appendChild(e),o.constructor.animateCSS(e,n+"fadeIn"),o.options.backdrop_click&&e.addEventListener("click",function(){o.close()})}).on("close",function(){o.constructor.animateCSS(e,n+"fadeOut",function(){e.parentNode.removeChild(e)})})),this.options.disable_page_scroll&&this.on("open",function(){t.classList.add(n+"page_no_scroll")}).on("afterClose",function(){t.classList.remove(n+"page_no_scroll")}),this.HTMLAttributes(),this.on("open",function(){t.classList.add(n+this.id+"-opening")}).on("afterOpen",function(){var e;!this.options.auto_focus||(e=this.el.querySelector(".fb-content").querySelectorAll('button:not([disabled]), a[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).length&&e[0].focus(),this.el.classList.add(n+"visible"),t.classList.add(n+this.id+"-open"),t.classList.remove(n+this.id+"-opening"),t.classList.add(n+this.el.dataset.type)}).on("close",function(){t.classList.add(n+this.id+"-closing")}).on("afterClose",function(){this.el.classList.remove(n+"visible"),t.classList.remove(n+this.id+"-open"),t.classList.remove(n+this.id+"-closing"),t.classList.remove(n+this.el.dataset.type)}),this.on("open",function(){o.box_log_id=null;var e={event:"open",action:"fb_trackevent",box:o.id,referrer:o.constructor.getWPOptions("referrer"),page:i.location.href};o.request(e,{onSuccess:function(e){e.box_log_id&&(o.box_log_id=e.box_log_id)}})}).on("close",function(e,t){var n={event:"close",action:"fb_trackevent",box_log_id:o.box_log_id,box:o.id};t&&Object.keys(t).forEach(function(e){n["options["+e+"]"]=t[e]}),o.request(n,{onSuccess:function(e){"stop"==e.action&&o.destroy()}})})},e.destroy=function(){return this.off(),this.unbindTriggers(),this.log("Destroyed"),this.el.parentNode.removeChild(this.el),this},e.update=function(){return this.off(),this.unbindTriggers(),this.bindActions(),this.bindTrigger(),this},e.log=function(e){this.options.debug&&(e=this.name+" #"+this.id+": "+e,console.log(e))},a.getCookie=function(e){for(var t=e+"=",n=s.cookie.split(";"),o=0;o<n.length;o++){for(var i=n[o];" "==i.charAt(0);)i=i.substring(1);if(0==i.indexOf(t))return i.substring(t.length,i.length)}return""},a.getInstance=function(t){return n.find(function(e){return e.id==t})},a.closeAll=function(){n.forEach(function(e){e.close()})},a.getInstances=function(t){return void 0===t?n:n.filter(function(e){return e.el.dataset.type==t})},a.getTotalOpened=function(){var t=0;return n.forEach(function(e){e.opened&&t++}),t},a.onReady=function(e){"loading"==s.readyState?s.addEventListener("DOMContentLoaded",e):e()},a.getWPOptions=function(e,t){return void 0===fbox_js_object[e]?t:fbox_js_object[e]},a.throttle=function(o,i){var r=this,s=!1;return function(){if(!s){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];o.apply(r,t),s=!0,setTimeout(function(){s=!1},i)}}},a.isTouchDevice=function(){var e=" -webkit- -moz- -o- -ms- ".split(" ");if("ontouchstart"in i||i.DocumentTouch&&s instanceof DocumentTouch)return!0;var t,e=["(",e.join("touch-enabled),("),"heartz",")"].join("");return t=e,i.matchMedia(t).matches},a.extend=function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},a.animateCSS=function(t,n,o){t.classList.add("fb-animate",n),t.addEventListener("animationend",function e(){t.classList.remove("fb-animate",n),t.removeEventListener("animationend",e),"function"==typeof o&&o()})},e.init=function(){var t=this;this.el.classList.contains(this.options.css_class_prefix+"init")||n.some(function(e){return e.id==t.id})||(this.bindActions(),this.bindTrigger(),this.el.classList.add(this.options.css_class_prefix+"init"),n.push(this),this.el.firebox=this)},a}(function(){function e(){}var t=e.prototype;return t.on=function(e,t){return this._callbacks=this._callbacks||{},this._callbacks[e]||(this._callbacks[e]=[]),this._callbacks[e].push(t),this},t.emit=function(e){this._callbacks=this._callbacks||{};e=this._callbacks[e];if(e){for(var t=arguments.length,n=new Array(1<t?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];for(var i,r=_createForOfIteratorHelperLoose(e);!(i=r()).done;)if(0==i.value.apply(this,n))return!1}return this},t.off=function(e,t){if(!this._callbacks||0===arguments.length)return this._callbacks={},this;var n=this._callbacks[e];if(!n)return this;if(1===arguments.length)return delete this._callbacks[e],this;for(var o=0;o<n.length;o++)if(n[o]===t){n.splice(o,1);break}return this},e}());i.FireBox=e}(window,document,(window.jQuery||window).Velocity),FireBox.onReady(function(){document.querySelectorAll(".fb-inst").forEach(function(e){new FireBox(e)})}); |