Current File : /var/www/kurt6690.2978.w2868/site96340/wp-content/themes/hopeui/assets/js/custom.min.js
"use strict";function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var o;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(o="Object"===(o=Object.prototype.toString.call(e).slice(8,-1))&&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 _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=new Array(t);o<t;o++)n[o]=e[o];return n}!function(o){var n,r=document.getElementsByTagName("body"),t=(document.querySelectorAll(".custom-nav-hopeui_script_slider"),document.querySelector(".ham-toggle")),e=document.querySelector(".close-custom-toggler"),i=document.querySelectorAll(".hopeui_style-menu-toggle"),l=document.getElementById("back-to-top");Element.prototype.slideUp=function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:300;this.style.transitionProperty="height, margin, padding",this.style.transitionDuration=t+"ms",this.style.boxSizing="border-box",this.style.height=this.offsetHeight+"px",this.offsetHeight,this.style.overflow="hidden",this.style.height=0,this.style.paddingTop=0,this.style.paddingBottom=0,this.style.marginTop=0,this.style.marginBottom=0,window.setTimeout(function(){e.style.display="none",e.style.removeProperty("height"),e.style.removeProperty("padding-top"),e.style.removeProperty("padding-bottom"),e.style.removeProperty("margin-top"),e.style.removeProperty("margin-bottom"),e.style.removeProperty("overflow"),e.style.removeProperty("transition-duration"),e.style.removeProperty("transition-property")},t)},Element.prototype.slideDown=function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:300,o=(this.style.removeProperty("display"),window.getComputedStyle(this).display),o=(this.style.display=o="none"===o?"block":o,this.offsetHeight);this.style.overflow="hidden",this.style.height=0,this.style.paddingTop=0,this.style.paddingBottom=0,this.style.marginTop=0,this.style.marginBottom=0,this.offsetHeight,this.style.boxSizing="border-box",this.style.transitionProperty="height, margin, padding",this.style.transitionDuration=t+"ms",this.style.height=o+"px",this.style.removeProperty("padding-top"),this.style.removeProperty("padding-bottom"),this.style.removeProperty("margin-top"),this.style.removeProperty("margin-bottom"),window.setTimeout(function(){e.style.removeProperty("height"),e.style.removeProperty("overflow"),e.style.removeProperty("transition-duration"),e.style.removeProperty("transition-property")},t)},Element.prototype.slideToggle=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:300;return"none"===window.getComputedStyle(this).display?this.slideDown(e):this.slideUp(e)},Element.prototype.getAllSiblings=function(){var t=this;return _toConsumableArray(this.parentElement.children).filter(function(e){return e!==t})},Element.prototype.elementClassToggler=function(e){var t=this;e.forEach(function(e){return t.classList.toggle(e)})},Element.prototype.elementHasClass=function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1],o=2<arguments.length&&void 0!==arguments[2]&&arguments[2];this.classList.contains(e)?t&&t(this):o&&o(this)},Element.prototype.elementHasClosest=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:function(){};return null!==this&&("null"!==(e=this.closest(e))&&t(e))};function s(){document.querySelectorAll("button.plus, button.minus").forEach(function(e){e.addEventListener("click",function(){null!=(e=document.querySelector('button[name="update_cart"]'))&&e.removeAttribute("disabled");var e=this.closest(".quantity").querySelector(".qty"),t=(""==e.value&&(e.value=0),parseFloat(e.value)),o=parseFloat(e.getAttribute("max")),n=parseFloat(e.getAttribute("min")),r=parseFloat(e.getAttribute("step"));this.classList.contains("plus")?e.value=o&&o<=t?o:t+r:n&&t<=n?e.value=n:1<=t&&(e.value=t-r)})})}var a,u=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[];c(r[0],e),d(r[0],t)},c=function(t,e){e.forEach(function(e){return t.classList.add(e)})},d=function(o,e){e.forEach(function(e){var t;return null==o||null==(t=o.classList)?void 0:t.remove(e)})},m=(Element.prototype.getSiblings=function(){var e=[];if(this.parentNode)for(var t,o=this.parentNode.firstChild;o;)1===o.nodeType&&o!==this&&e.push(o),o=null==(t=o)?void 0:t.nextSibling;return e},null!=l&&(a=function(){l.style.opacity=150<document.documentElement.scrollTop?"1":"0"},window.addEventListener("scroll",function(e){return a()}),a(),document.querySelector("#top").addEventListener("click",function(e){e.preventDefault(),window.scrollTo({top:0,behavior:"smooth"})})),window.addEventListener("resize",function(){1200<window.outerWidth?r[0].elementHasClass("overflow-hidden",function(e){d(e,["overflow-hidden"])}):null!==t&&t.elementHasClass("moblie-menu-active",function(e){c(r[0],["overflow-hidden"])})}),i.forEach(function(e){e.addEventListener("click",function(e){var t;this.setAttribute("aria-dropdown","false"==this.getAttribute("aria-dropdown")),null!=(t=this.closest(".hopeui_style-menu-item-wrapper"))&&null!=(t=t.nextElementSibling)&&t.elementClassToggler(["active"])})}),document.querySelectorAll(".navbar-nav a ,.navbar-nav button").forEach(function(e){e.addEventListener("focus",function(e){var t,o;void 0!==n&&(t=this.closest(".sub-menu.active"),null===(o=n.closest(".sub-menu.active"))||null!=o&&o.isSameNode(t)||null!==t&&(null!=o&&o.isSameNode(t)||null!==t.parentElement.closest(".sub-menu.active"))||d(o,["active"])),n=this})}),function(){window.outerWidth<1200&&d(r[0],["overflow-hidden"]),d(document.querySelector(".hopeui_style-mobile-menu"),["menu-open"]),null!=t&&t.elementClassToggler(["is-active"])});t&&t.addEventListener("click",function(e){window.outerWidth<1200&&u(["overflow-hidden"]),document.querySelector(".hopeui_style-mobile-menu").elementClassToggler(["menu-open"]),t.elementClassToggler(["is-active"])}),e&&e.addEventListener("click",function(e){m()}),document.documentElement.addEventListener("click",function(e){null===e.target.closest(".hopeui_style-mobile-menu.menu-open")&&m()},!0),document.addEventListener("keydown",function(e){27===e.keyCode&&(e.preventDefault(),m())}.bind(this)),o(window).on("load",function(e){o("#load").fadeOut(),o("#loading").delay(0).fadeOut("slow");var t=document.querySelector("nav.mobile-menu .top-menu");null!=t&&t.addEventListener("click",function(t){var e=t.target,o=(e.elementHasClosest("a")&&t.preventDefault(),e.getAttribute("href"));e.elementHasClosest("#"==o||"javascript:void(0)"==o?"a":".hopeui_style-menu-toggle",function(e){null!==e&&e.elementHasClosest("li",function(e){t.preventDefault(),e.getSiblings().forEach(function(e){e.classList.contains("active")&&e.querySelector(".hopeui_style-menu-toggle").click()}),e.classList.toggle("active"),e.querySelector(".sub-menu").slideToggle()})})})});s(),o(document).on("updated_cart_totals",s),o(document).on("click",function(e){var t=o(".dropdown-menu-mini-cart");t===e.target||t.has(e.target).length||o(".dropdown-menu-mini-cart").collapse("hide")}),o(document).ready(function(){0<o(".btn-search").length&&(o(document).on("click",".btn-search",function(){o(this).parent().find(".hopeui_style-search").toggleClass("search--open")}),o(document).on("click",".btn-search-close",function(){o(this).closest(".hopeui_style-search").toggleClass("search--open")})),0<o("select").length&&(o("select").each(function(){o(this).select2({width:"100%"})}),o(".select2-container").addClass("wide"))})}(jQuery);