whoami7 - Manager
:
/
home
/
dataiclx
/
vielorbe.com
/
wp-content
/
themes
/
botiga
/
assets
/
js
/
Upload File:
files >> //home/dataiclx/vielorbe.com/wp-content/themes/botiga/assets/js/custom.min.js
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _createForOfIteratorHelper(e,t){var o="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!o){if(Array.isArray(e)||(o=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){o&&(e=o);var a=0,t=function(){};return{s:t,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:t}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,i=!0,r=!1;return{s:function(){o=o.call(e)},n:function(){var e=o.next();return i=e.done,e},e:function(e){r=!0,n=e},f:function(){try{i||null==o.return||o.return()}finally{if(r)throw n}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(o="Object"===o&&e.constructor?e.constructor.name:o)||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,a=new Array(t);o<t;o++)a[o]=e[o];return a}var botiga=botiga||{};botiga.helpers={botigaDomReady:function(e){if("function"==typeof e)return"interactive"===document.readyState||"complete"===document.readyState?e():void document.addEventListener("DOMContentLoaded",e,!1)},isInVerticalViewport:function(e){e=e.getBoundingClientRect();return 0<=e.top&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)},isInHorizontalViewport:function(e){e=e.getBoundingClientRect();return 0<=e.left&&e.right<=document.documentElement.clientWidth},ajax:function(e,t,o,a){var n;(n=new XMLHttpRequest).open("POST",botiga.ajaxurl,!0),n.setRequestHeader("Content-type","application/x-www-form-urlencoded"),n.onload=function(){200<=this.status&&this.status<400&&a.apply(this)};var i="";o=Object.entries(o);for(var r=0;r<o.length;r++)i+="&"+o[r].join("=");n.send("action="+e+"&nonce="+t+i)},setCookie:function(e,t,o){var a=new Date;a.setTime(a.getTime()+24*o*60*60*1e3);a="expires="+a.toUTCString();document.cookie=e+"="+t+";"+a+";path=/"},getCookie:function(e){for(var t=e+"=",o=document.cookie.split(";"),a=0;a<o.length;a++){for(var n=o[a];" "==n.charAt(0);)n=n.substring(1);if(0==n.indexOf(t))return n.substring(t.length,n.length)}return""}},botiga.navigation={init:function(){var e=null==document.getElementById("site-navigation")?document.getElementById("site-navigation-mobile"):document.getElementById("site-navigation"),n=document.getElementsByClassName("botiga-offcanvas-menu")[0],i=document.getElementsByClassName("menu-toggle")[0];if(null!==e&&(e||void 0!==i)&&void 0!==n){var t=document.getElementsByClassName("mobile-menu-close")[0];if(void 0!==i){var o=e.getElementsByTagName("ul")[0];e.getElementsByClassName("mobile-menu-close")[0];if(void 0!==o){o.classList.contains("nav-menu")||o.classList.add("nav-menu");var r=(c=n.querySelectorAll("a[href]:not([disabled]):not(.mobile-menu-close)"))[0];i.addEventListener("click",function(e){e.preventDefault(),i.classList.add("open"),n.classList.add("toggled"),document.body.classList.add("mobile-menu-visible");var t,o=_createForOfIteratorHelper(n.querySelectorAll('.dropdown-symbol, .menu-item-has-children > a[href="#"]'));try{for(o.s();!(t=o.n()).done;){var a=t.value;a.addEventListener("touchstart",g),a.addEventListener("click",g),a.addEventListener("keydown",function(e){"Enter"!==e.key&&13!==e.keyCode||(e.preventDefault(),a.parentNode.parentNode.getElementsByClassName("sub-menu")[0].classList.toggle("toggled"))})}}catch(e){o.e(e)}finally{o.f()}r.focus()});e=n.querySelectorAll('a[href*="#"]');if(e.length){var a,s=_createForOfIteratorHelper(e);try{for(s.s();!(a=s.n()).done;)a.value.addEventListener("click",function(e){e.target.hash&&null!==document.querySelector(e.target.hash)&&!e.target.classList.contains("botiga-tabs-nav-link")&&(i.classList.remove("open"),n.classList.remove("toggled"),document.body.classList.remove("mobile-menu-visible"))})}catch(e){s.e(e)}finally{s.f()}}var r=(c=n.querySelectorAll("a[href]:not([disabled])"))[0],c=c[c.length-1];c.addEventListener("keydown",function(e){"Tab"!==e.key&&9!==e.keyCode||(e.shiftKey||r.focus())}),t.addEventListener("click",function(e){e.preventDefault();e=i.getBoundingClientRect();0<e.top+e.height&&i.focus(),i.classList.remove("open"),n.classList.remove("toggled"),document.body.classList.remove("mobile-menu-visible")}),document.addEventListener("click",function(e){null!==e.target.closest(".botiga-offcanvas-menu")||e.target.classList.contains("menu-toggle")||null!==e.target.closest(".menu-toggle")||(i.classList.remove("open"),n.classList.remove("toggled"),document.body.classList.remove("mobile-menu-visible"))});var l,t=o.getElementsByTagName("a"),o=o.querySelectorAll(".menu-item-has-children > a, .page_item_has_children > a"),d=_createForOfIteratorHelper(t);try{for(d.s();!(l=d.n()).done;){var u=l.value;u.addEventListener("focus",f,!0),u.addEventListener("blur",f,!0)}}catch(e){d.e(e)}finally{d.f()}var m,v=_createForOfIteratorHelper(o);try{for(v.s();!(m=v.n()).done;)m.value.addEventListener("touchstart",f,!1)}catch(e){v.e(e)}finally{v.f()}this.mobileAccordionNavigation(),this.initHoverClass(),this.checkMenuReverse()}else i.style.display="none"}}function g(e){e.cancelable&&e.preventDefault();var t=e.target.closest("li");if(t.querySelector(".sub-menu").classList.contains("toggling"))return!1;t.querySelector(".sub-menu").classList.toggle("toggling"),t.querySelector(".sub-menu").classList.toggle("toggled"),setTimeout(function(){t.querySelector(".sub-menu").classList.remove("toggling")},300)}function f(){if("focus"===event.type||"blur"===event.type)for(var e=this;!e.classList.contains("nav-menu");)"li"===e.tagName.toLowerCase()&&e.classList.toggle("focus"),e=e.parentNode;if("touchstart"===event.type){var t=this.parentNode;event.preventDefault();var o,a=_createForOfIteratorHelper(t.parentNode.children);try{for(a.s();!(o=a.n()).done;){var n=o.value;t!==n&&n.classList.remove("focus")}}catch(e){a.e(e)}finally{a.f()}t.classList.toggle("focus")}}},initHoverClass:function(){var e=this;if(void 0!==botiga.settings&&"no"===botiga.settings.misc.dropdowns_hover_delay)return!1;for(var t=!1,o=0,a=[{name:"scroll",selector:window},{name:"mouseenter",selector:document},{name:"mouseover",selector:document},{name:"touchstart",selector:document}];o<a.length;o++){var n=a[o];n.selector.addEventListener(n.name,function(){return!t&&(t=!0,void e.addHoverClassToDropdownItems())})}},addHoverClassToDropdownItems:function(){var r,t=_createForOfIteratorHelper(document.querySelectorAll(".botiga-dropdown-li"));try{for(t.s();!(r=t.n()).done;)!function(){var e=r.value,o=void 0,a=void 0,n=e;e.addEventListener("mouseover",function(e){var t=this;clearTimeout(o),a=setTimeout(function(){t.classList.add("hovered")},300)});var t,i=_createForOfIteratorHelper(e.querySelectorAll(".botiga-dropdown-ul > .botiga-dropdown-li"));try{for(i.s();!(t=i.n()).done;)t.value.addEventListener("mouseover",function(e){clearTimeout(o),setTimeout(function(){n.classList.add("hovered")},300)})}catch(e){i.e(e)}finally{i.f()}e.addEventListener("mouseout",function(e){var t=this;if(clearTimeout(a),n.contains(e.relatedTarget))return!1;o=setTimeout(function(){t.classList.remove("hovered")},300)})}()}catch(e){t.e(e)}finally{t.f()}},mobileAccordionNavigation:function(){var e=document.querySelectorAll(".botiga-dropdown-mobile-accordion");if(!e.length)return!1;var t,o=_createForOfIteratorHelper(e);try{for(o.s();!(t=o.n()).done;){var a=t.value.querySelectorAll(".menu-item-has-children");if(!a.length)return!1;var n,i=_createForOfIteratorHelper(a);try{for(i.s();!(n=i.n()).done;)n.value.querySelectorAll(".dropdown-symbol")[0].addEventListener("click",function(e){e.stopPropagation();e=this.parentNode;e.classList.contains("expand")?e.classList.remove("expand"):e.classList.add("expand")})}catch(e){i.e(e)}finally{i.f()}}}catch(e){o.e(e)}finally{o.f()}},checkMenuReverse:function(){var e,t=_createForOfIteratorHelper(document.querySelectorAll(".header-login-register, .top-bar-login-register, .botiga-dropdown .menu li"));try{for(t.s();!(e=t.n()).done;){var o=e.value;o.removeEventListener("mouseover",this.menuReverseEventHandler),o.addEventListener("mouseover",this.menuReverseEventHandler,{passive:!0}),o.removeEventListener("touchstart",this.menuReverseEventHandler),o.addEventListener("touchstart",this.menuReverseEventHandler,{passive:!0})}}catch(e){t.e(e)}finally{t.f()}},menuReverseEventHandler:function(){var e="rtl"===document.querySelector("html").getAttribute("dir");event.stopPropagation();var t=event.currentTarget.querySelector(".header-login-register>nav, .top-bar-login-register>nav, .sub-menu");return null!==t&&(t.classList.remove("sub-menu-reverse"),!e&&(0!=botiga.helpers.isInHorizontalViewport(t)||t.closest(".menu-item").classList.contains("botiga-mega-menu"))?t.classList.remove("sub-menu-reverse"):t.classList.add("sub-menu-reverse"),!(t.closest(".site-header")||t.closest(".bottom-header-row")||t.closest(".bhfb-header"))&&(t.classList.remove("sub-menu-reverse-vertically"),void(0!=botiga.helpers.isInVerticalViewport(t)||t.closest(".menu-item").classList.contains("botiga-mega-menu")?t.classList.remove("sub-menu-reverse-vertically"):t.classList.add("sub-menu-reverse-vertically"))))}},botiga.desktopOffCanvasToggleNav={init:function(){var e=document.getElementById("site-navigation"),t=document.getElementsByClassName("botiga-desktop-offcanvas-menu")[0];if(e&&void 0!==t){var o,a=_createForOfIteratorHelper(t.querySelectorAll('.dropdown-symbol, .menu-item-has-children > a[href="#"]'));try{for(a.s();!(o=a.n()).done;){var n=o.value;n.addEventListener("touchstart",i),n.addEventListener("click",i),n.addEventListener("keydown",function(e){"Enter"!==e.key&&13!==e.keyCode||(e.preventDefault(),n.parentNode.parentNode.getElementsByClassName("sub-menu")[0].classList.toggle("toggled"))})}}catch(e){a.e(e)}finally{a.f()}}function i(e){e.preventDefault(),e.target.closest("li").querySelector(".sub-menu").classList.toggle("toggled")}}},botiga.desktopOffcanvasNav={init:function(){var e=document.querySelectorAll(".desktop-menu-toggle"),t=document.getElementsByClassName("desktop-menu-close")[0],o=document.getElementsByClassName("botiga-desktop-offcanvas")[0];if(!e.length)return!1;for(var a=0;a<e.length;a++)e[a].addEventListener("click",function(e){e.preventDefault(),o.classList.contains("botiga-desktop-offcanvas-show")?o.classList.remove("botiga-desktop-offcanvas-show"):o.classList.add("botiga-desktop-offcanvas-show")});t.addEventListener("click",function(e){e.preventDefault(),o.classList.remove("botiga-desktop-offcanvas-show")}),document.addEventListener("click",function(e){null===e.target.closest(".botiga-desktop-offcanvas-menu")&&null!==o.querySelector(".botiga-mega-menu .sub-menu.toggled")&&o.querySelector(".botiga-mega-menu .sub-menu.toggled").classList.remove("toggled")})}},botiga.headerSearch={init:function(){var t=this,n=document.querySelectorAll(".header-search"),i=window.matchMedia("(max-width: 1024px)").matches?document.querySelector("#masthead-mobile .header-search-form"):document.querySelector("#masthead .header-search-form"),r=document.getElementsByClassName("search-overlay")[0],e=null!==i?i.getElementsByClassName("search-submit")[0]:void 0;if(0!==n.length){if(document.body.classList.contains("has-bhfb-builder")&&(i=document.querySelector(".header-search-form")),void 0!==r){var o,a=_createForOfIteratorHelper(n);try{for(a.s();!(o=a.n()).done;)o.value.addEventListener("click",function(e){if(e.preventDefault(),1<n.length){var t,o=_createForOfIteratorHelper(n);try{for(o.s();!(t=o.n()).done;)t.value.classList.toggle("hide")}catch(e){o.e(e)}finally{o.f()}}i.classList.toggle("active"),r.classList.toggle("active"),document.body.classList.toggle("header-search-form-active"),e.target.closest(".header-search").getElementsByClassName("icon-search")[0].classList.toggle("active"),e.target.closest(".header-search").getElementsByClassName("icon-cancel")[0].classList.toggle("active"),e.target.closest(".header-search").classList.add("active"),e.target.closest(".header-search").classList.remove("hide");var a="",a=(window.matchMedia("screen and (min-width: 1024px)").matches?document.querySelectorAll(".bhfb-desktop .header-search-form .search-field"):document.querySelectorAll(".bhfb-mobile .header-search-form .search-field"))[0];void 0!==(a=e.target.closest(".header-search").parentNode.classList.contains("header-search-form-hide-input-on-mobile")?document.querySelectorAll(".bhfb-mobile .header-search-form .search-field")[1]:a)&&a.focus(),null!==e.target.closest(".botiga-offcanvas-menu")&&e.target.closest(".botiga-offcanvas-menu").classList.remove("toggled")})}catch(e){a.e(e)}finally{a.f()}r.addEventListener("click",function(){i.classList.remove("active"),r.classList.remove("active"),document.body.classList.remove("header-search-form-active"),t.backButtonsToDefaultState(n)})}void 0!==e&&e.addEventListener("keydown",function(e){"Tab"!==e.key&&e.keyCode!==KEYCODE_TAB||(i.classList.remove("active"),r.classList.remove("active"),document.body.classList.remove("header-search-form-active"),t.backButtonsToDefaultState(n),n.focus())});e=null!==document.getElementsByClassName("header-desktop-offcanvas-layout2")[0]&&document.getElementsByClassName("botiga-desktop-offcanvas")[0];return e&&e.addEventListener("click",function(e){null===e.target.closest(".header-search")&&(i.classList.remove("active"),r.classList.remove("active"),document.body.classList.remove("header-search-form-active"),t.backButtonsToDefaultState(n))}),this}},backButtonsToDefaultState:function(e){var t,o=_createForOfIteratorHelper(e);try{for(o.s();!(t=o.n()).done;){var a=t.value;a.classList.remove("hide"),a.querySelector(".icon-cancel").classList.remove("active"),a.querySelector(".icon-search").classList.add("active")}}catch(e){o.e(e)}finally{o.f()}}},botiga.stickyHeader={init:function(){var e,t,o,a=this,n=document.getElementsByClassName("sticky-header")[0],i=document.getElementsByClassName("bhfb-sticky-header")[0],r=document.getElementsByTagName("body")[0];void 0===n&&void 0===i||(e=void 0!==n?".sticky-header":".bhfb-sticky-header",void 0===n&&(n=i),this.stickyChangeLogo(),10<(window.pageYOffset||document.documentElement.scrollTop)&&(n.classList.add("is-sticky"),r.classList.add("sticky-header-active"),window.dispatchEvent(new Event("botiga.sticky.header.activated"))),t=document.querySelector(e).getBoundingClientRect().y,document.body.classList.contains("admin-bar")&&(t-=32),document.body.classList.contains("botiga-site-layout-padded")&&(t-=parseInt(getComputedStyle(document.body).getPropertyValue("--botiga_padded_spacing"))),n.classList.contains("sticky-scrolltop")||null!==document.querySelector(".bhfb.sticky-scrolltop")?(o=0,window.addEventListener("scroll",function(){var e=window.pageYOffset||document.documentElement.scrollTop,t=o<e||e<10;(t=null!==document.querySelector(".bhfb.sticky-scrolltop")?e<document.querySelector(".bhfb.sticky-scrolltop").getBoundingClientRect().height:t)?(n.classList.remove("is-sticky"),r.classList.remove("sticky-header-active"),a.isHBStickyDeactivated("scrolltop"),r.classList.add("on-header-area"),window.dispatchEvent(new Event("botiga.sticky.header.deactivated"))):(n.classList.add("is-sticky"),r.classList.add("sticky-header-active"),a.isHBStickyActive("scrolltop"),r.classList.remove("on-header-area"),window.dispatchEvent(new Event("botiga.sticky.header.activated"))),o=e<=0?0:e},!1)):window.addEventListener("scroll",function(){var e=window.scrollY;t<e?(n.classList.add("sticky-shadow"),r.classList.add("sticky-header-active"),a.isHBStickyActive(),window.dispatchEvent(new Event("botiga.sticky.header.activated"))):(n.classList.remove("sticky-shadow"),r.classList.remove("sticky-header-active"),a.isHBStickyDeactivated(),window.dispatchEvent(new Event("botiga.sticky.header.deactivated")))},!1))},isHBStickyActive:function(e){var t=document.querySelector("header.bhfb"),o=document.body.classList.contains("admin-bar"),a=document.querySelector(".bhfb-above_header_row"),n=document.querySelector(".bhfb-main_header_row"),i=document.querySelector(".bhfb-below_header_row");if(null===t)return!1;var r=0,s=!1;t.classList.contains("sticky-row-main-header-row")&&(a.classList.contains("bt-d-none")?s=!0:(r=a.clientHeight,document.body.classList.contains("botiga-site-layout-padded")&&(s=!0)),o?r-=32:!a.classList.contains("bt-d-none")&&document.body.classList.contains("botiga-site-layout-padded")&&(s=!1),document.body.classList.contains("botiga-site-layout-padded")&&(r-=parseFloat(getComputedStyle(document.body).getPropertyValue("--botiga_padded_spacing"))),r=s?+Math.abs(r):-Math.abs(r),t.style.top="".concat(r,"px")),t.classList.contains("sticky-row-below-header-row")&&(i.classList.contains("bt-d-none")||(r=o?t.clientHeight-i.clientHeight-32-parseFloat(getComputedStyle(i).borderBottomWidth):t.clientHeight-i.clientHeight-parseFloat(getComputedStyle(i).borderBottomWidth)),a.classList.contains("bt-d-none")&&n.classList.contains("bt-d-none")&&(s=!0),document.body.classList.contains("botiga-site-layout-padded")&&(r-=parseFloat(getComputedStyle(document.body).getPropertyValue("--botiga_padded_spacing"))),r=s?+Math.abs(r):-Math.abs(r),t.style.top="".concat(r,"px")),"scrolltop"===e&&document.body.classList.contains("on-header-area")&&(t.classList.add("bhfb-no-transition"),setTimeout(function(){t.classList.remove("bhfb-no-transition")},500))},isHBStickyDeactivated:function(e){var t=document.querySelector("header.bhfb");if(null===t)return!1;t.classList.contains("sticky-row-main-header-row")&&(t.style.top="0px"),t.classList.contains("sticky-row-below-header-row")&&(document.querySelector(".bhfb-below_header_row").classList.contains("bt-d-none")||(t.style.top="0px"))},stickyChangeLogo:function(){var e=!1;if(window.matchMedia("screen and (min-width: 1024px)").matches&&"undefined"!=typeof botiga_sticky_header_logo){var t=document.body.classList.contains("has-bhfb-builder")?document.querySelector(".bhfb-sticky-header .site-branding img"):document.querySelector(".sticky-header .site-branding img");if(null===t)return!1;var o=t.getAttribute("src"),a=t.getAttribute("srcset"),n=t.getAttribute("sizes"),i=t.clientHeight;window.addEventListener("botiga.sticky.header.activated",function(){return!e&&(t.setAttribute("src",botiga_sticky_header_logo[0]),t.setAttribute("style","max-height: "+i+"px;"),void 0!==botiga_sticky_header_logo.srcset&&t.setAttribute("srcset",botiga_sticky_header_logo.srcset),void 0!==botiga_sticky_header_logo.sizes&&t.setAttribute("sizes",botiga_sticky_header_logo.sizes),void(e=!0))}),window.addEventListener("botiga.sticky.header.deactivated",function(){return!!e&&(t.setAttribute("src",o),null!==a&&t.setAttribute("srcset",a),null!==n&&t.setAttribute("sizes",n),void(e=!1))})}}},botiga.scrollDirection={init:function(){var t,e=document.querySelectorAll(".botiga-single-sticky-add-to-cart-wrapper.hide-when-scroll"),o=document.getElementsByTagName("body")[0];"null"!=typeof e&&(t=0,window.addEventListener("scroll",function(){var e=window.pageYOffset||document.documentElement.scrollTop;t<e?(o.classList.remove("botiga-scrolling-up"),o.classList.add("botiga-scrolling-down")):(o.classList.remove("botiga-scrolling-down"),o.classList.add("botiga-scrolling-up")),t=e<=0?0:e},!1))}},botiga.customAddToCartButton={init:function(){var e=document.querySelectorAll(".botiga-custom-addtocart");if(!e.length)return!1;for(var t=0;t<e.length;t++)e[t].addEventListener("click",function(e){e.preventDefault();var t=this,o=this.getAttribute("data-product-id"),a=this.getAttribute("data-context"),n=this.innerHTML,i=this.getAttribute("data-loading-text"),r=this.getAttribute("data-added-text"),s=this.getAttribute("data-nonce"),e=new XMLHttpRequest;e.open("POST",botiga.ajaxurl,!0),e.setRequestHeader("Content-type","application/x-www-form-urlencoded"),t.innerHTML=i,e.onload=function(){200<=this.status&&this.status<400&&(t.innerHTML=r,setTimeout(function(){t.innerHTML=n},1500),jQuery(document.body).trigger("wc_fragment_refresh"),jQuery(document.body).trigger("added_to_cart"),document.body.dispatchEvent(new Event("botiga.custom_added_to_cart")))},e.send("action=botiga_custom_addtocart&product_id="+o+"&context="+a+"&nonce="+s)})}},botiga.backToTop={init:function(){this.backToTop(),window.addEventListener("scroll",function(){this.backToTop()}.bind(this)),this.safariDoubleClickFix()},backToTop:function(){var e=document.getElementsByClassName("back-to-top")[0];void 0!==e&&(300<window.pageYOffset?e.classList.add("display"):e.classList.remove("display"),e.removeEventListener("click",this.scrollToTop),e.addEventListener("click",this.scrollToTop))},scrollToTop:function(){window.scrollTo({top:0,left:0,behavior:"smooth"})},safariDoubleClickFix:function(){var e=document.querySelectorAll(".product-gallery-summary .botiga-single-addtocart-wrapper .button, .single-product .content-wrapper a, .single-product .footer-widgets a, .single-product .site-footer a");if(!e.length)return!1;var t,o=_createForOfIteratorHelper(e);try{for(o.s();!(t=o.n()).done;)t.value.addEventListener("touchend",function(){})}catch(e){o.e(e)}finally{o.f()}}},botiga.qtyButton={init:function(e){this.events(e),this.wooEvents()},isInsideCarousel:function(e){return null!==e.closest(".botiga-carousel")&&!1===e.closest(".botiga-carousel").classList.contains("botiga-carousel-not-initialized")&&"true"!==e.closest(".botiga-carousel").getAttribute("data-initialized")},events:function(e){var r=this,t=document.querySelectorAll(".botiga-quantity-minus");if(t.length<1)return!1;for(var o=0;o<t.length;o++){var a=t[o].closest(".quantity");if(null!==a&&!a.dataset.qtyInitialized&&!r.isInsideCarousel(t[o])){if(a.classList.contains("hidden"))return!1;var n=a.querySelector(".qty"),i=a.querySelector(".botiga-quantity-plus"),s=a.querySelector(".botiga-quantity-minus"),c=a.querySelector(".input-text");i.classList.add("show"),s.classList.add("show"),n.addEventListener("change",function(e){r.behaviorsBasedOnQuantityValue(this,this.value)}),n.addEventListener("keyup",function(e){r.behaviorsBasedOnQuantityValue(this,this.value)}),i.addEventListener("click",function(e){e.preventDefault();var t=this.parentNode.querySelector(".qty"),o=Number(t.getAttribute("max"))||99999,a=Number(t.getAttribute("min")),n=Number(t.getAttribute("step")),i=Number(t.value),e=document.createEvent("HTMLEvents");t.value=Math.max(a,Math.min(o,(i+n).toFixed(1))),e.initEvent("change",!0,!1),t.dispatchEvent(e),r.updateAddToCartQuantity(this,t.value),r.updateBuyNowButtonQuantity(this,t.value),r.behaviorsBasedOnQuantityValue(this,t.value)}),s.addEventListener("click",function(e){e.preventDefault();var t=this.parentNode.querySelector(".qty"),o=Number(t.getAttribute("max"))||99999,a=Number(t.getAttribute("min")),n=Number(t.getAttribute("step")),i=Number(t.value),e=document.createEvent("HTMLEvents");t.value=Math.max(a,Math.min(o,(i-n).toFixed(1))),e.initEvent("change",!0,!1),t.dispatchEvent(e),r.updateAddToCartQuantity(this,t.value),r.updateBuyNowButtonQuantity(this,t.value),r.behaviorsBasedOnQuantityValue(this,t.value)}),c.addEventListener("change",function(e){r.updateAddToCartQuantity(this,this.value),r.updateBuyNowButtonQuantity(this,this.value)}),a.dataset.qtyInitialized=!0}}},wooEvents:function(){var e=this;"undefined"!=typeof jQuery&&(jQuery("body").on("updated_cart_totals",function(){e.events()}),jQuery(document).on("wc_fragments_loaded",function(){e.events()}))},updateAddToCartQuantity:function(e,t){if(null!==e.closest(".woocommerce-cart-form"))return!1;var o,a=e.closest(".product")?".product":".wc-block-grid__product",n=e.closest(a),a=e.parentNode.querySelector(".qty");!n||(n=n.querySelector(".add_to_cart_button:not(.single_add_to_cart_button)"))&&n.setAttribute("data-quantity",t),(e.closest(".mini_cart_item")?e.closest(".mini_cart_item"):e.closest(".woocommerce-cart-form__cart-item"))&&((o=jQuery(e.closest(".widget_shopping_cart"))).block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),jQuery.post({url:botiga.ajaxurl,data:{action:"botiga_update_mini_cart_quantity",quantity:a.value,cart_item_key:a.name,nonce:jQuery("#mini_cart_qty_nonce").val()},success:function(e){jQuery(document.body).trigger("added_to_cart",[e.fragments,e.cart_hash]),setTimeout(function(){o.unblock()},100)}}))},updateBuyNowButtonQuantity:function(e,t){var o=!(!e.parentNode.parentNode.classList.contains("botiga-sc-product-name")&&!e.parentNode.parentNode.classList.contains("product-name")),a=null!==e.closest(".woocommerce-mini-cart-item");if(o||a)return!1;a=e.closest(".product")?".product":".wc-block-grid__product",a=e.closest(a),e.parentNode.querySelector(".qty"),e=a?a.querySelector(".botiga-buy-now-button"):null;if(null===e)return!1;a=new URL(e.getAttribute("href"));a.searchParams.set("quantity",t),e.setAttribute("href",a)},behaviorsBasedOnQuantityValue:function(e,t){var o=e.closest(".product")?".product":".wc-block-grid__product",o=e.closest(o);!o||(o=o.querySelector(".add_to_cart_button:not(.single_add_to_cart_button)"))&&(0==t?o.classList.add("disabled"):o.classList.remove("disabled"))}},botiga.carousel={init:function(){this.build(),this.events()},build:function(){var e=this;if(null===document.querySelector(".botiga-carousel")&&null===document.querySelector(".has-cross-sells-carousel")&&null===document.querySelector(".botiga-woocommerce-mini-cart__cross-sell"))return!1;var t,o=_createForOfIteratorHelper(document.querySelectorAll(".botiga-carousel, #masthead .cross-sells, .botiga-side-mini-cart .cross-sells, .cart-collaterals .cross-sells"));try{for(o.s();!(t=o.n()).done;){var a=t.value;if(null===a.querySelector(".botiga-carousel-stage")&&a.querySelector(".products").classList.add("botiga-carousel-stage"),"true"!==a.getAttribute("data-initialized")){var n,i=a.getAttribute("data-per-page");null===i&&(n=a.querySelector(".products").classList.value,[1,2,3,4,5].forEach(function(e){0<n.indexOf("columns-"+e)&&(i=e)}));var r=document.createElement("div"),s=a.querySelector(".botiga-carousel-stage");r.className="botiga-carousel-wrapper",r.innerHTML=s.outerHTML,s.remove(),a.append(r);var c=30;if("undefined"!=typeof botiga_carousel?c=parseInt(botiga_carousel.margin_desktop):null!==a.closest(".botiga-woocommerce-mini-cart__cross-sell")&&(c=15),a.querySelectorAll("li.product").length<=parseInt(i))return a.classList.add("botiga-carousel-not-initialized"),!1;new Siema({parentSelector:a,selector:".botiga-carousel-stage",duration:200,easing:"ease-out",perPage:null!==i?{0:1,768:2,1025:parseInt(i)}:2,startIndex:0,draggable:!0,multipleDrag:!1,threshold:20,loop:!0,rtl:"rtl"===document.querySelector("html").getAttribute("dir"),margin:c,onInit:function(){window.dispatchEvent(new Event("botiga.carousel.initialized")),e.maybeInitExtraFeatures()}})}}}catch(e){o.e(e)}finally{o.f()}},events:function(){var o,a=this;"undefined"!=typeof jQuery&&(o=!0,jQuery(document.body).on("wc_fragment_refresh added_to_cart removed_from_cart",function(){setTimeout(function(){var e=document.getElementById("site-header-cart");if(null===e)return!1;var t=e.querySelector(".cart_list");null!==t&&(2<t.children.length?(e.classList.remove("mini-cart-has-no-scroll"),e.classList.add("mini-cart-has-scroll")):(e.classList.remove("mini-cart-has-scroll"),e.classList.add("mini-cart-has-no-scroll"))),a.build(),o=!1},o?1e3:0)}))},maybeInitExtraFeatures:function(){botiga.qtyButton.init()}},botiga.copyLinkToClipboard={init:function(e,t){e.preventDefault(),navigator.clipboard.writeText(window.location.href),t.classList.add("copied"),t.setAttribute("data-botiga-tooltip",botiga.i18n.botiga_sharebox_copy_link_copied),setTimeout(function(){t.setAttribute("data-botiga-tooltip",botiga.i18n.botiga_sharebox_copy_link),t.classList.remove("copied")},1e3)}},botiga.toggleClass={init:function(e,t,o){e.preventDefault(),e.stopPropagation();var a=document.querySelector(t.getAttribute("data-botiga-selector")),e=t.getAttribute("data-botiga-toggle-class-remove"),t=t.getAttribute("data-botiga-toggle-class"),a=a.classList;"string"==typeof e&&a.remove(e),a.toggle(t),o&&((t=document.createEvent("HTMLEvents")).initEvent(o,!0,!1),window.dispatchEvent(t))}},botiga.collapse={init:function(){var a=document.querySelectorAll("[data-botiga-collapse]");if(!a.length)return!1;for(var n=this,e=0;e<a.length;e++){var t=function(t){var e=a[t].getAttribute("data-botiga-collapse"),o=JSON.parse(e.replace(/'/g,'"').replace(";",""));if(!o.enable)return{v:!1};n.expand(a[t],o,!0),a[t].addEventListener("click",function(e){e.preventDefault(),this.dispatchEvent(new Event("botiga.collapse.before.expand")),a[t].classList.contains("active")?n.collapse(a[t],o):n.expand(a[t],o),this.dispatchEvent(new Event("botiga.collapse.after.collapse"))}),o.options.oneAtTime&&a[t].addEventListener("botiga.collapse.before.expand",function(){for(var e=document.querySelectorAll(o.options.oneAtTimeParentSelector+" [data-botiga-collapse]"),t=0;t<e.length;t++)n.collapseAll(e[t],o)})}(e);if("object"===_typeof(t))return t.v}},expand:function(e,t,o){if(o&&!e.classList.contains("active"))return!1;o=t.id,t=document.getElementById(o),o=t.querySelector(".botiga-collapse__content");t.addEventListener("transitionend",this.expandTransitionEnd.bind(this,e)),t.style="max-height: "+o.clientHeight+"px;",e.classList.add("active"),t.classList.add("active")},expandTransitionEnd:function(e){if(!e.classList.contains("active"))return!1;e.dispatchEvent(new Event("botiga.collapse.expanded"))},collapse:function(e,t,o){t=t.id,t=document.getElementById(t);t.style="max-height: 0px;",e.classList.remove("active"),t.classList.remove("active"),e.dispatchEvent(new Event("botiga.collapse.collapsed"))},collapseAll:function(e,t){e.classList.remove("active"),e.nextElementSibling.classList.remove("active"),e.nextElementSibling.style="max-height: 0px;"}},botiga.tabsNav={init:function(){if(!document.querySelectorAll(".botiga-tabs-nav").length)return!1;this.events()},events:function(){var e,t=_createForOfIteratorHelper(document.querySelectorAll(".botiga-tabs-nav-item"));try{for(t.s();!(e=t.n()).done;){var a=e.value;a.closest(".botiga-tabs-nav").classList.contains("botiga-tabs-nav-click-on-mouseover")&&function(){var o=void 0;a.addEventListener("mouseover",function(e){e.preventDefault();var t=this;o=setTimeout(function(){t.dispatchEvent(new Event("click"))},500)}),a.addEventListener("mouseout",function(e){clearTimeout(o)})}(),a.addEventListener("click",function(e){e.preventDefault();var t=this,o=this.querySelector(".botiga-tabs-nav-link").getAttribute("href"),e=this.closest(".botiga-tabs-nav").querySelector(".botiga-tabs-nav-item.is-active .botiga-tabs-nav-link").getAttribute("href"),a=document.querySelector(e),n=document.querySelector(o),o=n.parentNode.querySelectorAll(".botiga-tab-content.is-active").length;if(null===n)return!1;if(0===o||1<o)return!1;if(n.classList.contains("is-active"))return!1;var i,r=_createForOfIteratorHelper(this.closest(".botiga-tabs-nav").querySelectorAll(".botiga-tabs-nav-item"));try{for(r.s();!(i=r.n()).done;){var s=i.value,c=document.querySelector(s.querySelector(".botiga-tabs-nav-link").getAttribute("href"));null!==c&&(s.classList.remove("is-active"),c.classList.remove("is-active"))}}catch(e){r.e(e)}finally{r.f()}a.classList.add("removing"),setTimeout(function(){t.classList.add("is-active"),n.classList.add("activating"),setTimeout(function(){n.classList.add("is-active"),n.classList.remove("activating")},300),a.classList.remove("removing")},300)})}}catch(e){t.e(e)}finally{t.f()}}},botiga.misc={init:function(){this.general(),this.wcExpressPayButtons(),this.singleProduct(),this.cart(),this.checkout(),this.customizer()},general:function(){var e=document.getElementById("site-header-cart");if(null===e)return!1;e.addEventListener("mouseover",function(){document.body.classList.add("bt-mini-cart-hovered")}),e.addEventListener("mouseout",function(){document.body.classList.remove("bt-mini-cart-hovered")})},wcExpressPayButtons:function(){var e,t=document.querySelector("body.woocommerce-checkout"),o=document.querySelector("body.woocommerce-cart");if(null===document.querySelector("body.single-product")&&null===t&&null===o)return!1;"function"==typeof jQuery&&void 0!==(e=jQuery)("#wc-stripe-payment-request-button-separator, #wcpay-payment-request-wrapper").get(0)&&null===t&&(e("#wc-stripe-payment-request-button-separator, #wcpay-payment-request-button-separator").appendTo("form.cart"),e("#wc-stripe-payment-request-wrapper, #wcpay-payment-request-wrapper").appendTo("form.cart"),e(window).trigger("botiga.wcexpresspaybtns.appended"))},singleProduct:function(){var e,t,a,o,n=this;if(null===document.querySelector("body.single-product"))return!1;"function"==typeof jQuery&&((e=jQuery)(".variations_form").each(function(){return!0!==e(this).data("misc-variations")&&(n.moveResetVariationButton(e(this)),n.checkIfHasVariationSelected(e(this)),e(this).on("woocommerce_variation_select_change",function(){n.checkIfHasVariationSelected(e(this))}),void e(this).data("misc-variations",!0))}),e(".botiga-in-cart-flag").length&&(t=e("body.single-product .entry-summary .variations_form, .botiga-tb-sp-add-to-cart"),a=t.find(".single_add_to_cart_button"),o=a.text(),t.each(function(){e(this).on("found_variation",function(e,t){var o=botigaInCartFlag.variations_in_cart.filter(function(e){return e.variation_id===t.variation_id}),o=o.length?o[0].addtocart_button_text:a.text();a.html(o)}),e(this).on("reset_data",function(){a.text(o)})})))},moveResetVariationButton:function(e){var t=e.find(".reset_variations");t.remove(),e.find("table").after(t)},checkIfHasVariationSelected:function(e){var t=!0;e.find("td.value select").each(function(){return""!==jQuery(this).val()?(t=!1,jQuery(this).closest("table").addClass("has-variation-selected"),!1):void jQuery(this).closest("table").removeClass("has-variation-selected")}),t?e.closest(".variations_form").find(".reset_variations").css("display","none"):e.closest(".variations_form").find(".reset_variations").css("display","inline-block")},cart:function(){var t;if(null===document.querySelector("body.woocommerce-cart"))return!1;"function"==typeof jQuery&&(t=jQuery)("header.has-sticky-header").length&&t(document).on("updated_cart_totals",function(){t(window).on("scroll",function(e){t("html, body").stop(!0,!1),t(this).off(e),t("html, body").animate({scrollTop:t('[role="alert"]').offset().top-t("header.has-sticky-header").height()},1e3)})})},checkout:function(){if(null===document.querySelector("body.woocommerce-checkout"))return!1;"function"==typeof jQuery&&jQuery(document).on("updated_checkout",function(){null!==document.querySelector("#order_review .woocommerce-shipping-totals > td")&&document.querySelector("#order_review .woocommerce-shipping-totals > td").setAttribute("colspan",2)})},customizer:function(){if(!window.parent.document.body.classList.contains("wp-customizer"))return!1;window.onload=function(){document.querySelectorAll(".cart-count").length&&jQuery(document.body).trigger("wc_fragment_refresh")}}},botiga.helpers.botigaDomReady(function(){botiga.navigation.init(),botiga.desktopOffcanvasNav.init(),botiga.desktopOffCanvasToggleNav.init(),botiga.headerSearch.init(),botiga.customAddToCartButton.init(),botiga.stickyHeader.init(),botiga.scrollDirection.init(),botiga.backToTop.init(),botiga.qtyButton.init(),botiga.carousel.init(),botiga.collapse.init(),botiga.tabsNav.init(),botiga.misc.init()});
Copyright ©2021 || Defacer Indonesia