PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 1.0.13
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v1.0.13
3.1.13 3.1.12 3.1.11 3.1.10 3.1.9 3.1.8 3.1.7 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 All 122 releases
firebox / Inc / Framework / media / admin / js / fpframework_admin.js

fpframework_admin.js in FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment 1.0.13, at Inc/Framework/media/admin/js/fpframework_admin.js

3 lines 10.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var FPFrameworkAdmin=function(){this.ui=new FPF_UI,this.cpt_helper=new FPF_CPT_Helper,this.conditionize=new FPF_Conditionize,this.tabs_state=new FPF_Tabs_State};document.addEventListener("DOMContentLoaded",function(t){new FPFrameworkAdmin});var FPF_Animation=function(){function t(){}return t.slideUp=function(t,e){void 0===e&&(e=500),t.style.transitionProperty="height, margin, padding",t.style.transitionDuration=e+"ms",t.style.boxSizing="border-box",t.style.height=t.offsetHeight+"px",t.offsetHeight,t.style.overflow="hidden",t.style.height=0,t.style.paddingTop=0,t.style.paddingBottom=0,t.style.marginTop=0,t.style.marginBottom=0,window.setTimeout(function(){t.style.display="none",t.style.removeProperty("height"),t.style.removeProperty("padding-top"),t.style.removeProperty("padding-bottom"),t.style.removeProperty("margin-top"),t.style.removeProperty("margin-bottom"),t.style.removeProperty("overflow"),t.style.removeProperty("transition-duration"),t.style.removeProperty("transition-property")},e)},t.slideDown=function(t,e){void 0===e&&(e=500),t.style.removeProperty("display");var i=window.getComputedStyle(t).display;"none"===i&&(i="block"),t.style.display=i;var n=t.offsetHeight;t.style.overflow="hidden",t.style.height=0,t.style.paddingTop=0,t.style.paddingBottom=0,t.style.marginTop=0,t.style.marginBottom=0,t.offsetHeight,t.style.boxSizing="border-box",t.style.transitionProperty="height, margin, padding",t.style.transitionDuration=e+"ms",t.style.height=n+"px",t.style.removeProperty("padding-top"),t.style.removeProperty("padding-bottom"),t.style.removeProperty("margin-top"),t.style.removeProperty("margin-bottom"),window.setTimeout(function(){t.style.removeProperty("height"),t.style.removeProperty("overflow"),t.style.removeProperty("transition-duration"),t.style.removeProperty("transition-property")},e)},t.slideToggle=function(t,e){return void 0===e&&(e=500),"none"===window.getComputedStyle(t).display?this.slideDown(t,e):this.slideUp(t,e)},t}();Array.prototype.indexOf||(Array.prototype.indexOf=function(t){var e=this.length>>>0,i=Number(arguments[1])||0;for((i=i<0?Math.ceil(i):Math.floor(i))<0&&(i+=e);i<e;i++)if(i in this&&this[i]===t)return i;return-1});var FPF_Conditionize=function(){function t(t){void 0===t&&(t=!1),this.animate=t,this.init()}var e=t.prototype;return e.init=function(){this.setUpShowon()},e.setUpShowon=function(t){var s,l=this;t=t||document;for(var c,e=0,i=(s=t!=document?document.querySelector(t).querySelectorAll("[data-showon]:not(.fpf-run-condition)"):document.querySelectorAll("[data-showon]:not(.fpf-run-condition)")).length;e<i;e++)c=e,function(){var e=s[c];e.classList.add("fpf-run-condition");for(var t,i=JSON.parse(e.getAttribute("data-showon"))||[],n=[],o=0,r=i.length;o<r;o++){t=i[o].field;var a=document.querySelectorAll('[name$="'+t+'"], [name$="'+t+'[]"]');n.push.apply(n,a)}l.linkedoptions(e),n.forEach(function(t){t&&("radio"==t.type?document.querySelectorAll('[name="'+t.getAttribute("name")+'"]').forEach(function(t){t.addEventListener("change",function(t){l.linkedoptions(e,l.animate)})}):t.addEventListener("change",function(t){l.linkedoptions(e,l.animate)}))})}()},e.linkedoptions=function(t,e){function i(i){o=l[i]||{},r=o.field,a=document.querySelectorAll('[name$="'+r+'"], [name$="'+r+'[]"]'),o.valid=0,a.forEach(function(t){for(var e in-1!==["checkbox","radio"].indexOf(t.type)?n=t.checked?t.value:0:null==(n=t.value)&&"select-one"==t.type.toLowerCase()&&(n=[]),"object"!=typeof n&&(n=JSON.parse('["'+n+'"]')),n)n.propertyIsEnumerable(e)&&("="==l[i].sign&&-1!==l[i].values.indexOf(n[e])&&(l[i].valid=1),"!="==l[i].sign&&-1===l[i].values.indexOf(n[e])&&(l[i].valid=1))}),""===o.op?0===o.valid&&(s=!1):("AND"===o.op&&o.valid+l[i-1].valid<2&&(s=!1,o.valid=0),"OR"===o.op&&0<o.valid+l[i-1].valid&&(s=!0,o.valid=1))}for(var n,o,r,a,s=!0,l=JSON.parse(t.getAttribute("data-showon"))||[],c=0,d=l.length;c<d;c++)i(c);if("option"==t.type&&(t.style.display=s?"":"none",t.setAttribute("disabled",!s)),e=e&&!t.classList.contains("no-animation")&&!t.classList.contains("no-animate")&&!t.querySelector(".no-animation, .no-animate"))if(s){if("block"==t.style.display||"flex"==t.style.display)return;FPF_Animation.slideDown(t)}else FPF_Animation.slideUp(t);else t.style.display=s?"":"none"},t}(),FPF_Cookie=function(){function t(){}return t.set=function(t,e,i){var n="";if(i){var o=new Date;o.setTime(o.getTime()+24*i*60*60*1e3),n="; expires="+o.toUTCString()}document.cookie=t+"="+(e||"")+n+"; path=/"},t.get=function(t){for(var e=t+"=",i=document.cookie.split(";"),n=0;n<i.length;n++){for(var o=i[n];" "==o.charAt(0);)o=o.substring(1,o.length);if(0==o.indexOf(e))return o.substring(e.length,o.length)}return null},t.remove=function(t){document.cookie=t+"=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;"},t}(),FPF_CPT_Helper=function(){function t(){this.initEvents()}var e=t.prototype;return e.initEvents=function(){document.addEventListener("click",function(t){this.handlePostTypeStatusChange(t)}.bind(this))},e.handlePostTypeStatusChange=function(t){var e=t.target.closest(".fpf-toggle-post-status");if(e){e.classList.add("disabled");var i=e.getAttribute("data-post-id"),n=e.checked?"publish":"draft";fetch(fpf_js_object.base_url+"/?rest_route=/fpframework/v1/cpt/"+i+"/"+n,{method:"POST",headers:{"X-WP-Nonce":fpf_js_object.wp_rest_nonce}}).then(function(t){return t.json()}).then(function(t){e.classList.remove("disabled")})}},t}(),FPF_FieldTooltipPosition=function(){function t(){this.labelClass=".fpf-tooltip-item",this.init()}return t.prototype.init=function(){document.addEventListener("mouseover",function(t){var e=t.target.closest(this.labelClass);if(e){var i=(e=e.querySelector(".fpf-tooltip")).getBoundingClientRect(),n=e.parentElement.getBoundingClientRect(),o=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;n.top<=120||i.height/2>n.top?e.classList.add("pos-bottom"):n.top+120>o||n.top+120+i.height/2>o?e.classList.add("pos-top"):(e.classList.remove("pos-top"),e.classList.remove("pos-bottom"))}}.bind(this))},t}(),FPF_Helper=function(){function t(){}return t.popupWindow=function(t,e,i,n){var o=null!=window.screenLeft?window.screenLeft:window.screenX,r=null!=window.screenTop?window.screenTop:window.screenY,a=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,s=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height,l=a/window.screen.availWidth,c=(a-i)/2/l+o,d=(s-n)/2/l+r,f=window.open(t,e,"scrollbars=yes, width="+i/l+", height="+n/l+", top="+d+", left="+c);window.focus&&f.focus()},t.getQueryString=function(t){var e=window.location.search;return new URLSearchParams(e).get(t)},t.number_format=function(t,e,i,n){if(null==t||!isFinite(t))throw new TypeError("Number is not valid");if(!e){var o=t.toString().split(".").length;e=1<o?o:0}i=i||".",n=n||",";var r=(t=(t=parseFloat(t).toFixed(e)).replace(".",i)).split(i);return r[0]=r[0].replace(/\B(?=(\d{3})+(?!\d))/g,n),t=r.join(i)},t}(),FPF_Tabs=function(){function t(){}var e=t.prototype;return e.init=function(){this.initEvents(),this.initMobileToggleLabel()},e.initEvents=function(){document.addEventListener("click",function(t){this.initNavigation(t),this.initMobileToggle(t),this.initMobileCloseOnDocumentClick(t)}.bind(this))},e.initNavigation=function(t){var e=t.target.closest(".fpf-tabs-nav-item");if(e){var i=e.closest(".fpf-tabs-wrapper"),n=e.getAttribute("id");tab_name=n.replace("fpf-tab-",""),this.selectTab(i,tab_name),t.preventDefault()}},e.selectTab=function(t,e){if(this.getTabNavItem(t,e)&&(this.clearTabsSelection(t),this.changeSelection(t,e),"function"==typeof FPF_Textarea)){var i=t.querySelector('.fpf-tab-item[id$="'+e+'"]');new FPF_Textarea(i).init()}},e.initMobileToggleLabel=function(){var t=document.querySelectorAll(".fpf-tabs-wrapper");t&&t.forEach(function(t){var e=t.querySelector(".fpf-tabs-nav-mobile-toggle span.text-outer");if(e){var i=t.querySelector(".fpf-tabs-nav .fpf-tabs"),n=i.querySelector("li.is-active");e.innerHTML=n?n.querySelector(".text").innerHTML:i.children[0].querySelector(".text").innerHTML}})},e.initMobileToggle=function(t){var e=t.target.closest(".fpf-tabs-nav-mobile-toggle");if(e){var i=e.parentNode;i.classList.contains("mobile-mode")?i.classList.remove("mobile-mode"):i.classList.add("mobile-mode"),t.preventDefault()}},e.initMobileCloseOnDocumentClick=function(t){if(!t.target.closest(".fpf-tabs-nav")&&!t.target.closest(".fpf-tabs-nav-mobile-toggle")){var e=document.querySelector(".fpf-tabs-nav-wrapper.mobile-mode");e&&e.classList.remove("mobile-mode")}},e.clearTabsSelection=function(t){var e=t.querySelector(".fpf-tabs-nav-item.is-active");e&&e.classList.remove("is-active");var i=t.querySelector(".fpf-tab-item.is-active");i&&i.classList.remove("is-active")},e.changeSelection=function(t,e){var i=this.getTabNavItem(t,e);i.classList.add("is-active"),t.querySelector('.fpf-tab-item[id$="'+e+'"]').classList.add("is-active"),t.querySelector(".fpf-tabs-nav-mobile-toggle")&&(t.querySelector(".fpf-tabs-nav-mobile-toggle .text-outer").innerHTML=i.innerHTML),t.querySelector(".fpf-tabs-nav-wrapper.mobile-mode")&&t.querySelector(".fpf-tabs-nav-wrapper.mobile-mode").classList.remove("mobile-mode")},e.getTabNavItem=function(t,e){return t.querySelector('.fpf-tabs-nav-item[id$="'+e+'"]')},t}(),FPF_Tabs_State=function(){function t(){this.tabsClass=".fpf-tabs-wrapper",this.tabNavItemClass=".fpf-tabs-nav-item",this.tabs_elements=document.querySelectorAll(this.tabsClass),this.tabs=new FPF_Tabs,this.init()}var e=t.prototype;return e.init=function(){this.tabs_elements.length&&(this.detectTabStateAndUpdateTabs(),this.initEvents())},e.initEvents=function(){document.addEventListener("click",function(t){this.setNewTabState(t)}.bind(this)),window.addEventListener("hashchange",function(){this.detectTabStateAndUpdateTabs()}.bind(this))},e.setNewTabState=function(t){var e=t.target.closest(this.tabNavItemClass);if(e){var i=e.getAttribute("id");i=i.replace("fpf-tab-","");var n=e.closest(".fpf-tabs-wrapper").getAttribute("id");null!=n&&FPF_Cookie.set(n,i)}},e.detectTabStateAndUpdateTabs=function(){var e=this,i=window.location.hash;this.tabs_elements.forEach(function(t){e.tabs.selectTab(t,i)})},t}(),FPF_UI=function(){this.tabs=new FPF_Tabs,this.tabs.init(),this.fieldTooltipPosition=new FPF_FieldTooltipPosition};
2
3