{"version":3,"sources":["before.js","main.js","after.js"],"names":["$","OpalWoocommerceMain","_classCallCheck","this","initCarousel","addedToCart","initSelectOrder","_createClass","key","value","instance","hasClass","a","x","b","document","getElementsByClassName","elmnt","y","i","arrNo","push","c","length","indexOf","classList","add","j","selElmnt","$select","getElementsByTagName","createElement","setAttribute","innerHTML","options","selectedIndex","appendChild","addEventListener","e","k","s","h","parentNode","click","trigger","stopPropagation","closeAllSelect","toggle","each","index","element","$container","$slider","closest","flexslider","selector","animation","controlNav","smoothHeight","_this2","activeGalleryThumbnail","slider","currentSlide","after","start","setTimeout","data","resize","on","find","directionNav","slideshow","$gallery","removeClass","addClass","event","$item","remove","$img","first","before","currentTarget","outerHTML","src","object","srcset","attr","$element","items","items980","items768","dots","responsive","0","768","980","1200","$product","button","productName","text","template","wp","$wishlist","ajax","action","dataType","success","beforeSend","complete","OpalTheme_Woocommerce_filter","_this3","selectorsClick","url","initCategoriesDropdown","initOrdering","window","history","state","woofilter","renderHtml","_this4","join","preventDefault","$this","sendRequest","val","objUrl","URL","location","href","searchParams","URLSearchParams","search","set","toString","position","offset","top","outerHeight","scrollTop","animate","getCookie","get","_this5","arguments","undefined","replaceUrl","initLoading","post","$html","title","filter","sidebar","html","content","pushState","scrollUp","initPriceSlider","getInstance","initSlideProduct","check","append","recentlyTitle","recentlyContent","hide","show","scrollHeight","height","contentHeight","_this","parent","off","replace","_this6","min_price","range","min","max","max_price","values","current_min_price","current_max_price","create","body","slide","ui","change","_this7","ca","substring","name","cname","cvalue","exdays","d","setTime","getTime","cookie","expires","ready","jQuery"],"mappings":"8XAAA,SAAAA,GAAA,GCAAC,GDAA,WAAA,QAAAA,KAAAC,gBAAAC,KAAAF,GAAAE,KAAAC,eCGAD,KAAAE,cACAJ,KAAAA,eAEAE,KAAAG,kBDNA,MAAAC,cAAAN,EAAA,OAAAO,IAAA,cAAAC,MAAA,WAAA,MCGAR,GAAAS,WACAT,EAAAS,SAAA,GAAAT,IDJAA,EAAAS,aAAAH,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6K,QAAA,OAAA,GApCA5D,IAAA,IAAAA,EAAAzF,QAAA,KAAAyF,EAAAA,cAAAgE,EAAA,cAAAC,EAAAjE,EAAAA,cAAAgE,EAAA,cAAAC,EAKAlL,EAAAA,YAAAA,QDleAQ,IAAA,YAAAC,MAAA,SCseAyK,EAAAA,GAwCA,IAAA,GAvCAE,GAAAA,EAAAA,IACAG,EAAAA,SAAAA,OAAAA,MAAAA,KAsCApK,EAAA,EAAAA,EAAA0K,EAAAtK,OAAAJ,IAAA,CAnCAnB,IADAA,GAAAA,GAAAA,EAAAA,GACAA,MAAAA,EAAAA,OAAAA,IAsCAsB,EAAAA,EAAAwK,UAAA,EAnCA,IAAA,IAAAxK,EAAAE,QAAAuK,GACAN,MAAAA,GAAAA,UAAAA,EAAAA,OAAAA,EAAAA,QAGAzL,MAAAA,MDlfAQ,IAAA,YAAAC,MAAA,SCqfAuL,EAAAC,GAAA,GAAAC,GAAAjD,UAAA1H,OAAA,OAAA2H,KAAAD,UAAA,GAAAA,UAAA,GAAA,GACA0C,EAAAA,GAAAA,KAsCAQ,GAAAC,QAAAD,EAAAE,UAAA,GAAAH,EAAA,GAAA,GAAA,IApCAlM,IAAAA,GAAAA,WAAAA,EAAAA,aACAe,UAAAuL,OAAAN,EAAA,IAAAC,EAAA,IAAAM,EAAA,cDzfAzF,IAAA9G,GAAAe,UAAAyL,MAAA,WC8fAvM,EAAA8J,cAwCA,GAAAjD,MCtiBA2F","file":"main.js","sourcesContent":["(function ($) {","class OpalWoocommerceMain {\n static instance;\n static getInstance() {\n if (!OpalWoocommerceMain.instance) {\n OpalWoocommerceMain.instance = new OpalWoocommerceMain();\n }\n return OpalWoocommerceMain.instance;\n }\n\n constructor() {\n this.initCarousel();\n this.addedToCart();\n this.initWishlist();\n //this.initSlideProduct();\n this.initSelectOrder();\n }\n\n initSelectOrder(){\n if($('body').hasClass('post-type-archive-product')) {\n\n let x, i, j, selElmnt, a, b, c;\n /*look for any elements with the class \"custom-select\":*/\n x = document.getElementsByClassName(\"woocommerce-ordering\");\n let $select = $('.woocommerce-ordering .orderby');\n for (i = 0; i < x.length; i++) {\n selElmnt = x[i].getElementsByTagName(\"select\")[0];\n /*for each element, create a new DIV that will act as the selected item:*/\n a = document.createElement(\"DIV\");\n a.setAttribute(\"class\", \"select-selected\");\n a.innerHTML = selElmnt.options[selElmnt.selectedIndex].innerHTML;\n x[i].appendChild(a);\n /*for each element, create a new DIV that will contain the option list:*/\n b = document.createElement(\"DIV\");\n b.setAttribute(\"class\", \"select-items select-hide\");\n for (j = 1; j < selElmnt.length; j++) {\n /*for each option in the original select element,\n create a new DIV that will act as an option item:*/\n c = document.createElement(\"DIV\");\n c.innerHTML = selElmnt.options[j].innerHTML;\n c.addEventListener(\"click\", function (e) {\n /*when an item is clicked, update the original select box,\n and the selected item:*/\n let y, i, k, s, h;\n s = this.parentNode.parentNode.getElementsByTagName(\"select\")[0];\n h = this.parentNode.previousSibling;\n for (i = 0; i < s.length; i++) {\n if (s.options[i].innerHTML == this.innerHTML) {\n s.selectedIndex = i;\n h.innerHTML = this.innerHTML;\n y = this.parentNode.getElementsByClassName(\"same-as-selected\");\n for (k = 0; k < y.length; k++) {\n y[k].removeAttribute(\"class\");\n }\n this.setAttribute(\"class\", \"same-as-selected\");\n break;\n }\n }\n h.click();\n $select.trigger('change');\n });\n b.appendChild(c);\n }\n x[i].appendChild(b);\n a.addEventListener(\"click\", function (e) {\n /*when the select box is clicked, close any other select boxes,\n and open/close the current select box:*/\n e.stopPropagation();\n closeAllSelect(this);\n this.nextSibling.classList.toggle(\"select-hide\");\n this.classList.toggle(\"select-arrow-active\");\n });\n }\n\n function closeAllSelect(elmnt) {\n /*a function that will close all select boxes in the document,\n except the current select box:*/\n let x, y, i, arrNo = [];\n x = document.getElementsByClassName(\"select-items\");\n y = document.getElementsByClassName(\"select-selected\");\n for (i = 0; i < y.length; i++) {\n if (elmnt == y[i]) {\n arrNo.push(i)\n } else {\n y[i].classList.remove(\"select-arrow-active\");\n }\n }\n for (i = 0; i < x.length; i++) {\n if (arrNo.indexOf(i)) {\n x[i].classList.add(\"select-hide\");\n }\n }\n }\n\n /*if the user clicks anywhere outside the select box,\n then close all select boxes:*/\n document.addEventListener(\"click\", closeAllSelect);\n }\n }\n\n initSlideProduct() {\n $('.product-block .product-img-wrap').each((index, element) => {\n let $slider = $(element);\n let $container = $slider.closest('.product-block');\n $slider.flexslider({\n selector: '.inner > .product-image',\n animation: 'slide',\n controlNav: true,\n directionNav: true,\n slideshow: false,\n smoothHeight: false,\n before: (slider) => {\n\n if (slider.direction === 'next') {\n this.activeGalleryThumbnail($container, slider.currentSlide + 1);\n } else {\n this.activeGalleryThumbnail($container, slider.currentSlide - 1);\n }\n },\n after: (slider) => {\n this.activeGalleryThumbnail($container, slider.currentSlide);\n },\n start: function(){\n setTimeout(function(){\n $slider.addClass('flexslider-loaded');\n $slider.data('flexslider').resize();\n }, 500);\n }\n // 'animationSpeed': 500,\n });\n $('.gallery-nav-next', $container).on('click', function () {\n $container.find('.flex-nav-next a').trigger('click');\n });\n\n $('.gallery-nav-prev', $container).on('click', function () {\n $container.find('.flex-nav-prev a').trigger('click');\n });\n\n $('.gallery_item', $container).on('click', (event) => {\n let number = $(event.currentTarget).data('number');\n $slider.data('flexslider').flexAnimate(number);\n this.activeGalleryThumbnail($container, number);\n })\n })\n }\n\n activeGalleryThumbnail($container, key) {\n let $gallery = $('.woocommerce-loop-product__gallery', $container);\n $('.gallery_item', $gallery).removeClass('active');\n $('.gallery_item[data-number=\"' + key + '\"]', $gallery).addClass('active');\n }\n\n initVariableItem() {\n $('.otf-wrap-swatches .swatch').on('click', (event) => {\n event.preventDefault();\n let $item = $(event.currentTarget);\n let $container = $item.closest('.product');\n\n if ($item.hasClass('checked')) {\n $container.removeClass('product-swatched');\n $item.removeClass('checked');\n $container.find('.product-image-swatch').remove();\n } else {\n $item.closest('.otf-wrap-swatches').find('.swatch').removeClass('checked');\n $container.addClass('product-swatched product-swatch-loading');\n $item.addClass('checked');\n let object = $item.data('image');\n if (object.src) {\n let $img = $('').on('load', (event) => {\n $container.find('.product-image-swatch').remove();\n $container.removeClass('product-swatch-loading');\n $container.find('.product-image').first().before(`
${event.currentTarget.outerHTML}
`);\n }).attr({\n src: object.src,\n });\n if (object.srcset) {\n $img.attr(srcset, object.srcset);\n }\n }\n }\n })\n }\n\n initCarousel() {\n $('.woocommerce-product-carousel').each((index, element) => {\n let $element = $(element);\n let items = $element.data('columns');\n let itemMobile = 1;\n let items768 = 2;\n let items980 = items;\n if (items > 3) {\n items980 = items - 1;\n items768 = items - 2;\n }\n if (items < 2) {\n items768 = items;\n }\n $element.find('ul.products').owlCarousel({\n items: items,\n nav: true,\n dots: false,\n responsive: {\n 0: {\n items: itemMobile,\n },\n 480: {\n items: itemMobile,\n },\n 768: {\n items: items768\n },\n 980: {\n items: items980\n },\n 1200: {\n items: items\n }\n }\n })\n });\n }\n\n addedToCart() {\n let $product;\n $('body').on('adding_to_cart', function (event, button) {\n $product = button.closest('.product');\n }).on('added_to_cart', function () {\n let src = $product.find('img').first().attr('src');\n let productName = $product.find('.woocommerce-loop-product__title').text();\n let template = wp.template('added-to-cart-template');\n $('#page-title-bar').after(template({src: src, name: productName}));\n setTimeout(function () {\n $('.notification-added-to-cart').addClass('hide');\n }, 3000);\n });\n }\n\n initWishlist() {\n $(document).on('added_to_wishlist removed_from_wishlist', function () {\n let $wishlist = $('.opal-header-wishlist');\n $.ajax({\n url: yith_wcwl_l10n.ajax_url,\n data: {\n action: 'osf_update_wishlist_count'\n },\n dataType: 'json',\n success: function (data) {\n $wishlist.find('.count').text(data.count);\n },\n beforeSend: function () {\n },\n complete: function () {\n }\n })\n })\n }\n}\n\nclass OpalTheme_Woocommerce_filter {\n selectorsClick = []\n selectorsChange = []\n\n constructor() {\n this.selectorsClick = [\n '#secondary .widget .product-categories a',\n '#secondary .widget .product-brands a',\n '#secondary .widget .woocommerce-widget-layered-nav-list a',\n '#secondary .widget.widget_layered_nav_filters a',\n '#secondary .widget.widget_rating_filter a',\n '#secondary .widget_product_tag_cloud a',\n\n '#opal-canvas-filter .widget .product-categories a',\n '#opal-canvas-filter .widget .product-brands a',\n '#opal-canvas-filter .widget .woocommerce-widget-layered-nav-list a',\n '#opal-canvas-filter .widget.widget_layered_nav_filters a',\n '#opal-canvas-filter .widget.widget_rating_filter a',\n '#opal-canvas-filter .widget_product_tag_cloud a',\n\n '#main ul.products + .woocommerce-pagination a',\n '#secondary .widget .product-brands a',\n '.otf-active-filters .widget_layered_nav_filters a',\n '.otf-active-filters .clear-all',\n ];\n this.initDisplayMode();\n this.init();\n this.initCategoriesDropdown();\n this.initRecentlyReviewed();\n this.priceSlideChange();\n this.initOrdering();\n\n $(window).on(\"popstate\", () => {\n if (history.state && history.state.woofilter) {\n this.renderHtml(history.state);\n }\n });\n }\n\n init() {\n $('body').on('click', this.selectorsClick.join(','), (event) => {\n event.preventDefault();\n let $this = $(event.currentTarget);\n let url = $this.attr('href');\n this.sendRequest(url);\n }).on('click', '.display-mode button[type=\"submit\"]', (event) => {\n event.preventDefault();\n let $this = $(event.currentTarget);\n if (!$this.hasClass('active')) {\n let value = $this.val();\n let objUrl = new URL(window.location.href);\n let searchParams = new URLSearchParams(window.location.search);\n searchParams.set('display', value);\n objUrl.search = searchParams.toString();\n this.sendRequest(objUrl.toString(), false);\n }\n });\n }\n\n scrollUp() {\n\n let position = $('#primary').offset().top;\n if ($('body').hasClass('opal-header-sticky')) {\n position -= $('#opal-header-sticky').outerHeight();\n }\n\n if ($('#wpadminbar').length > 0) {\n position -= $('#wpadminbar').outerHeight();\n }\n if ($(window).scrollTop() > position) {\n $('html, body').animate({scrollTop: position}, 'slow');\n }\n }\n\n replaceUrl(url) {\n let layout = this.getCookie('otf_woocommerce_display', 'grid');\n if (layout === 'list') {\n if (url.indexOf('?') !== -1) {\n url = url + '&display=list';\n } else {\n url = url + '?display=list';\n }\n }\n\n return url;\n }\n\n initDisplayMode() {\n if ($('body').hasClass('opal-woocommerce-archive')) {\n let display = this.getCookie('otf_woocommerce_display', 'grid');\n if (display === 'list') {\n let url = window.location.href;\n let objUrl = new URL(url);\n let dp = objUrl.searchParams.get(\"display\");\n if (!dp) {\n this.sendRequest(url);\n }\n }\n }\n }\n\n sendRequest(url, replace = true) {\n if (replace) {\n url = this.replaceUrl(url);\n }\n this.initLoading(true);\n $.post(url, (data) => {\n if (data) {\n let $html = $(data);\n let state = {\n woofilter: true,\n title : $html.filter('title').text(),\n sidebar : $html.find('#secondary').html(),\n content : $html.find('#primary').html(),\n filter : $html.find('.opal-canvas-filter-wrap').html(),\n };\n this.renderHtml(state);\n window.history.pushState(state, state.title, url);\n }\n this.initLoading(false)\n })\n }\n\n renderHtml(state) {\n this.scrollUp();\n $('head title').text(state.title);\n $('#primary').html(state.content);\n $('#secondary').html(state.sidebar);\n $('#opal-canvas-filter .opal-canvas-filter-wrap').html(state.filter);\n this.initPriceSlider();\n this.initCategoriesDropdown();\n this.initOrdering();\n this.initLoading(false)\n OpalWoocommerceMain.getInstance().initSlideProduct();\n OpalWoocommerceMain.getInstance().initSelectOrder();\n }\n\n initLoading(check) {\n if (check) {\n $('body').addClass('opal-filter-loading').append('
');\n } else {\n $('body').removeClass('opal-filter-loading');\n $('#opal-woocommerce-loading').remove();\n }\n }\n\n initRecentlyReviewed() {\n let recentlyTitle = $('h2.otf-woocommerce-recently-viewed');\n let recentlyContent = $('.otf-product-recently-content');\n recentlyContent.hide();\n\n recentlyTitle.on('click', function (e) {\n e.stopPropagation();\n if (!recentlyTitle.hasClass('active')) {\n recentlyContent.show(400);\n recentlyTitle.addClass('active');\n let scrollHeight = $(document).height();\n let contentHeight = $('.widget_recently_viewed_products').height();\n $(\"html, body\").animate({scrollTop: scrollHeight}, contentHeight + 10);\n } else {\n recentlyContent.hide(400);\n recentlyTitle.removeClass('active');\n }\n });\n\n }\n\n\n initCategoriesDropdown() {\n $('.widget_product_categories ul li.cat-item').each(function () {\n let _this = $(this);\n _this.find('ul.children').hide();\n if (_this.find('.current-cat').length > 0) {\n _this.find('ul.children').show();\n $(this).append('');\n } else if (_this.find('ul.children').length > 0) {\n $(this).append('');\n }\n\n });\n $(\"body\").on(\"click\", '.widget_product_categories ul li.cat-item .closed', function () {\n $(this).parent().find('ul.children').first().show(400);\n $(this).parent().addClass('open');\n $(this).removeClass('closed').removeClass('icon-559').addClass('opened').addClass('icon-558');\n });\n $(\"body\").on(\"click\", '.widget_product_categories ul li.cat-item .opened', function () {\n $(this).parent().find('ul.children').first().hide(400);\n $(this).parent().addClass('close').removeClass('open');\n $(this).removeClass('opened').removeClass('icon-558').addClass('closed').addClass('icon-559');\n });\n }\n\n initOrdering() {\n setTimeout(() => {\n $('.woocommerce-ordering').off('change');\n $('.woocommerce-ordering').on('change', (event) => {\n let $select = $(event.currentTarget).find('.orderby');\n let url = window.location.href.replace(/&orderby(=[^&]*)?|^orderby(=[^&]*)?&?/g, '')\n .replace(/\\?orderby(=[^&]*)?|^orderby(=[^&]*)?&?/g, '?')\n .replace(/\\?$/g, '')\n\n\n if (url.indexOf('?') !== -1) {\n url = url + `&orderby=${$select.val()}`;\n } else {\n url = url + `?orderby=${$select.val()}`;\n }\n this.sendRequest(url);\n })\n }, 100);\n }\n\n initPriceSlider() {\n setTimeout(() => {\n if ($('.price_slider:not(.ui-slider)').length <= 0) {\n return true;\n }\n $('input#min_price, input#max_price').hide();\n $('.price_slider, .price_label').show();\n\n let min_price = $('.price_slider_amount #min_price').data('min'),\n max_price = $('.price_slider_amount #max_price').data('max'),\n current_min_price = $('.price_slider_amount #min_price').val(),\n current_max_price = $('.price_slider_amount #max_price').val();\n\n $('.price_slider:not(.ui-slider)').slider({\n range : true,\n animate: true,\n min : min_price,\n max : max_price,\n values : [current_min_price, current_max_price],\n create : function () {\n\n $('.price_slider_amount #min_price').val(current_min_price);\n $('.price_slider_amount #max_price').val(current_max_price);\n\n $(document.body).trigger('price_slider_create', [current_min_price, current_max_price]);\n },\n slide : function (event, ui) {\n\n $('input#min_price').val(ui.values[0]);\n $('input#max_price').val(ui.values[1]);\n\n $(document.body).trigger('price_slider_slide', [ui.values[0], ui.values[1]]);\n },\n change : function (event, ui) {\n\n $(document.body).trigger('price_slider_change', [ui.values[0], ui.values[1]]);\n }\n });\n }, 200);\n }\n\n priceSlideChange() {\n $(document.body).bind('price_slider_change', (event, min, max) => {\n let url = window.location.href.replace(/(min_price=\\d+\\&*|max_price=\\d+\\&*)/g, '')\n .replace(/\\?$/g, '')\n if (url.indexOf('?') !== -1) {\n url = url + `&min_price=${min}&max_price=${max}`;\n } else {\n url = url + `?min_price=${min}&max_price=${max}`;\n }\n this.sendRequest(url);\n })\n }\n\n getCookie(cname, _default) {\n let name = cname + \"=\";\n let ca = document.cookie.split(';');\n for (let i = 0; i < ca.length; i++) {\n let c = ca[i];\n while (c.charAt(0) === ' ') {\n c = c.substring(1);\n }\n if (c.indexOf(name) === 0) {\n return c.substring(name.length, c.length);\n }\n }\n return \"\";\n }\n\n setCookie(cname, cvalue, exdays = 10) {\n let d = new Date();\n d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));\n let expires = \"expires=\" + d.toUTCString();\n document.cookie = cname + \"=\" + cvalue + \";\" + expires + \";path=/\";\n }\n\n\n}\n\n$(document).ready(function () {\n OpalWoocommerceMain.getInstance();\n new OpalTheme_Woocommerce_filter();\n});","})(jQuery);"]}