PATH:
home
/
thebhoeo
/
.trash
/
woodmart
/
js
/
scripts
/
wc
/* global woodmart_settings */ (function($) { woodmartThemeModule.$document.on('wdShopPageInit wdUpdateWishlist wdArrowsLoadProducts wdLoadMoreLoadProducts wdProductsTabsLoaded wdSearchFullScreenContentLoaded wdBackHistory wdRecentlyViewedProductLoaded', function() { woodmartThemeModule.woodmartCompareUpdateState(); }); woodmartThemeModule.woodmartCompare = function() { var cookiesName = 'woodmart_compare_list'; if (woodmart_settings.is_multisite) { cookiesName += '_' + woodmart_settings.current_blog_id; } if ( typeof Cookies === 'undefined' ) { return; } var $body = woodmartThemeModule.$body, $widget = $('.wd-header-compare'), compareCookie = Cookies.get(cookiesName); if ($widget.length > 0) { if ('undefined' !== typeof compareCookie) { try { var ids = JSON.parse(compareCookie); $widget.find('.wd-tools-count').text(ids.length); } catch (e) { console.log('cant parse cookies json'); } } else { $widget.find('.wd-tools-count').text(0); } if ( 'undefined' !== typeof woodmart_settings.compare_by_category && 'yes' === woodmart_settings.compare_by_category ) { try { getProductsCategory(); } catch (e) { getAjaxProductCategory(); } } } $body.on('click', '.wd-compare-btn a', function(e) { var $this = $(this), id = $this.data('id'), $widget = $('.wd-header-compare'); if ($this.hasClass('added')) { return true; } e.preventDefault(); if ( ! $widget.find('.wd-dropdown-compare').length ) { var products = []; var productsCookies = Cookies.get(cookiesName); if ( 'undefined' !== typeof productsCookies && productsCookies ) { products = Object.values( JSON.parse(productsCookies) ); } if ( ! products.length || -1 === products.indexOf(id.toString()) ) { products.push( id.toString() ); } var count = products.length; updateCountWidget(count); Cookies.set(cookiesName, JSON.stringify(products), { expires: 7, path : woodmart_settings.cookie_path, secure : woodmart_settings.cookie_secure_param }); updateButton( $this ); return; } $this.addClass('loading'); jQuery.ajax({ url : woodmart_settings.ajaxurl, data : { action: 'woodmart_add_to_compare', id : id }, dataType: 'json', method : 'GET', success : function(response) { if ( response.count ) { var $widget = $('.wd-header-compare'); if ($widget.length > 0) { $widget.find('.wd-tools-count').text(response.count); } updateButton( $this ); } else { console.log('something wrong loading compare data ', response); } if (response.fragments) { $.each( response.fragments, function( key, value ) { $( key ).replaceWith(value); }); sessionStorage.setItem( cookiesName + '_fragments', JSON.stringify( response.fragments ) ); } }, error : function() { console.log('We cant add to compare. Something wrong with AJAX response. Probably some PHP conflict.'); }, complete: function() { $this.removeClass('loading'); } }); }); $body.on('click', '.wd-compare-remove', function(e) { e.preventDefault(); var $this = $(this), id = $this.data('id'), categoryId = ''; if ('undefined' !== typeof woodmart_settings.compare_by_category && 'yes' === woodmart_settings.compare_by_category) { categoryId = $this.parents('.wd-compare-table').data('category-id'); if ( categoryId && 1 >= $this.parents('.compare-value').siblings().length ) { removeProductCategory( categoryId, $this.parents('.wd-compare-page') ); return; } } $this.addClass('loading'); jQuery.ajax({ url : woodmart_settings.ajaxurl, data : { action : 'woodmart_remove_from_compare', id : id, category_id: categoryId, key : woodmart_settings.compare_page_nonce, }, dataType: 'json', method : 'GET', success : function(response) { if (response.table) { updateCompare(response); if (response.fragments) { $.each( response.fragments, function( key, value ) { $( key ).replaceWith(value); }); sessionStorage.setItem( cookiesName + '_fragments', JSON.stringify( response.fragments ) ); } } else { console.log('something wrong loading compare data ', response); } }, error : function() { console.log('We cant remove product compare. Something wrong with AJAX response. Probably some PHP conflict.'); }, complete: function() { $this.remove('loading'); } }); }); $body.on('change', '.wd-compare-select', function (e) { e.preventDefault(); var $this = $(this); var $wrapper = $this.parents('.wd-compare-page'); var $activeCompareTable = $wrapper.find('.wd-compare-table[data-category-id=' + $this.val() + ']'); var $oldActiveCompareTable = $wrapper.find('.wd-compare-table.wd-active'); var animationTime = 100; $wrapper.find('.wd-compare-cat-link').attr( 'href', $activeCompareTable.data('category-url') ); $oldActiveCompareTable.removeClass('wd-in'); setTimeout(function() { $oldActiveCompareTable.removeClass('wd-active'); }, animationTime); setTimeout(function() { $activeCompareTable.addClass('wd-active'); }, animationTime); setTimeout(function() { $activeCompareTable.addClass('wd-in'); woodmartThemeModule.$document.trigger('wood-images-loaded'); }, animationTime * 2); }); $body.on('click', '.wd-compare-remove-cat', function (e) { e.preventDefault(); var $this = $(this); var activeCategory = $this.parents('.wd-compare-header').find('.wd-compare-select').val(); var $wrapper = $this.parents('.wd-compare-page'); removeProductCategory( activeCategory, $wrapper ); }); function removeProductCategory( activeCategory, $wrapper ) { var $loader = $wrapper.find('.wd-loader-overlay'); $loader.addClass('wd-loading'); jQuery.ajax({ url : woodmart_settings.ajaxurl, data : { action : 'woodmart_remove_category_from_compare', category_id: activeCategory, key : woodmart_settings.compare_page_nonce, }, dataType: 'json', method : 'GET', success : function(response) { if (response.table) { updateCompare(response); if (response.fragments) { $.each( response.fragments, function( key, value ) { $( key ).replaceWith(value); }); sessionStorage.setItem( cookiesName + '_fragments', JSON.stringify( response.fragments ) ); } } else { console.log('something wrong loading compare data ', response); } }, error : function() { console.log('We cant remove product compare. Something wrong with AJAX response. Probably some PHP conflict.'); }, complete: function() { $loader.removeClass('wd-loading'); var $compareTable = $('.wd-compare-table').first(); setTimeout(function() { $compareTable.addClass('wd-active'); }, 100); setTimeout(function() { $compareTable.addClass('wd-in'); woodmartThemeModule.$document.trigger('wood-images-loaded'); }, 200); } }); } function updateCompare(data) { var $widget = $('.wd-header-compare'); if ($widget.length > 0) { $widget.find('.wd-tools-count').text(data.count); } woodmartThemeModule.removeDuplicatedStylesFromHTML(data.table, function(html) { var $wcCompareWrapper = $('.wd-compare-page'); var $wcCompareTable = $('.wd-compare-table'); if ($wcCompareWrapper.length > 0) { $wcCompareWrapper.replaceWith(html); } else if ($wcCompareTable.length > 0) { $wcCompareTable.replaceWith(html); } }); if ('undefined' !== typeof woodmart_settings.compare_by_category && 'yes' === woodmart_settings.compare_by_category) { woodmartThemeModule.$document.trigger('wdTabsInit'); } } function getProductsCategory() { if ( woodmartThemeModule.supports_html5_storage ) { var fragmentProductCategory = JSON.parse( sessionStorage.getItem( cookiesName + '_fragments' ) ); if ( 'undefined' !== typeof actions && ( actions.is_lang_switched === '1' || actions.force_reset === '1' ) ) { fragmentProductCategory = ''; } if ( fragmentProductCategory ) { $.each( fragmentProductCategory, function( key, value ) { $( key ).replaceWith(value); }); } else { getAjaxProductCategory(); } } else { getAjaxProductCategory(); } } function getAjaxProductCategory() { jQuery.ajax({ url : woodmart_settings.ajaxurl, data : { action : 'woodmart_get_fragment_product_category_compare', }, dataType: 'json', method : 'GET', success : function(response) { if (response.fragments) { $.each( response.fragments, function( key, value ) { $( key ).replaceWith(value); }); sessionStorage.setItem( cookiesName + '_fragments', JSON.stringify( response.fragments ) ); } else { console.log('something wrong loading compare data ', response); } }, error : function() { console.log('We cant remove product compare. Something wrong with AJAX response. Probably some PHP conflict.'); }, }); } function updateButton( $button ) { var addedText = $button.data('added-text'); if ($button.find('.wd-action-text').length > 0) { $button.find('.wd-action-text').text(addedText); } else { $button.text(addedText); } $button.addClass('added'); woodmartThemeModule.$document.trigger('added_to_compare'); woodmartThemeModule.$document.trigger('wdUpdateTooltip', $button); } function updateCountWidget(count) { var $widget = $('.wd-header-compare'); if ($widget.length > 0) { $widget.find('.wd-tools-count').text(count); } } }; woodmartThemeModule.woodmartCompareUpdateState = function() { if ( 'undefined' === typeof woodmart_settings.compare_save_button_state || 'yes' !== woodmart_settings.compare_save_button_state || 'undefined' === typeof Cookies ) { return; } var cookiesName = 'woodmart_compare_list'; var products = []; if (woodmart_settings.is_multisite) { cookiesName += '_' + woodmart_settings.current_blog_id; } var productsCookies = Cookies.get(cookiesName); if ( 'undefined' !== typeof productsCookies && productsCookies ) { products = Object.values( JSON.parse(productsCookies) ); } if ( ! products.length ) { return; } $.each(products, function( index, id ) { var $button = $('.wd-compare-btn a[data-id=' + id + ']'); if ( ! $button.length || $button.hasClass('added') ) { return; } $button.addClass('added'); var addedText = $button.data('added-text'); if ($button.find('.wd-action-text').length > 0) { $button.find('.wd-action-text').text(addedText); } else { $button.text(addedText); } }); }; $(document).ready(function() { woodmartThemeModule.woodmartCompare(); woodmartThemeModule.woodmartCompareUpdateState(); }); })(jQuery);
[+]
..
[-] filtersArea.min.js
[edit]
[-] quickShop.min.js
[edit]
[-] loginSidebar.js
[edit]
[-] shopLoader.min.js
[edit]
[-] woocommerceWrappTable.min.js
[edit]
[-] abandonedCart.min.js
[edit]
[-] product360Button.min.js
[edit]
[-] swatchesLimit.js
[edit]
[-] frequentlyBoughtTogether.js
[edit]
[-] quickShopVariationForm.min.js
[edit]
[-] trackProductViewed.min.js
[edit]
[-] frequentlyBoughtTogether.min.js
[edit]
[-] sortByWidget.js
[edit]
[-] woocommerceQuantity.min.js
[edit]
[-] stickyDetails.min.js
[edit]
[-] filterDropdowns.min.js
[edit]
[-] commentImage.min.js
[edit]
[-] woocommerceQuantity.js
[edit]
[-] singleProductTabsAccordion.js
[edit]
[-] addToCartAllTypes.min.js
[edit]
[-] swatchesVariations.min.js
[edit]
[-] loginTabs.js
[edit]
[-] categoriesAccordion.min.js
[edit]
[-] checkoutRemoveBtn.min.js
[edit]
[-] productImagesGallery.js
[edit]
[-] singleProductTabsSideHidden.js
[edit]
[-] stickyAddToCart.js
[edit]
[-] swatchesVariations.js
[edit]
[-] imagesGalleryInLoop.min.js
[edit]
[-] quickShop.js
[edit]
[-] product360Button.js
[edit]
[-] initZoom.js
[edit]
[-] emailSubscriptionCheckboxes.min.js
[edit]
[-] headerCategoriesMenu.js
[edit]
[-] headerCategoriesMenu.min.js
[edit]
[-] freeGiftsTable.js
[edit]
[-] wishlist.min.js
[edit]
[-] checkoutQuantity.min.js
[edit]
[-] ptSubscribeForm.min.js
[edit]
[-] productHover.js
[edit]
[-] updateAjaxDeliveryDates.js
[edit]
[-] productMoreDescription.min.js
[edit]
[-] woocommercePriceSlider.min.js
[edit]
[-] productImages.js
[edit]
[-] productReviewsLikes.min.js
[edit]
[-] filterDropdowns.js
[edit]
[-] singleProductTabsAccordion.min.js
[edit]
[-] shopMasonry.min.js
[edit]
[-] woodmartCompare.js
[edit]
[-] searchByFilters.js
[edit]
[-] gridQuantity.min.js
[edit]
[-] swatchesOnGrid.js
[edit]
[-] productsLoadMore.min.js
[edit]
[-] productGalleryVideo.js
[edit]
[-] variationsPrice.min.js
[edit]
[-] productReviewsCriteria.js
[edit]
[-] emailSubscriptionCheckboxes.js
[edit]
[-] freeGiftsTable.min.js
[edit]
[-] dynamicDiscountsTable.min.js
[edit]
[-] waitlistTable.min.js
[edit]
[-] abandonedCart.js
[edit]
[-] shopMasonry.js
[edit]
[-] wishlistGroup.js
[edit]
[-] wishlist.js
[edit]
[-] checkoutFields.js
[edit]
[-] addToCartAllTypes.js
[edit]
[-] imagesGalleryInLoop.js
[edit]
[-] productReviews.js
[edit]
[-] waitlistSubscribeForm.min.js
[edit]
[-] categoriesDropdowns.min.js
[edit]
[-] filtersArea.js
[edit]
[-] cartWidget.min.js
[edit]
[-] estimateDeliveryOnCart.js
[edit]
[-] productRecentlyViewed.min.js
[edit]
[-] woocommerceWrappTable.js
[edit]
[-] waitlistSubscribeForm.js
[edit]
[-] productReviewsLikes.js
[edit]
[-] checkoutRemoveBtn.js
[edit]
[-] cartQuantity.min.js
[edit]
[-] productMoreDescription.js
[edit]
[-] ptSubscribeForm.js
[edit]
[-] shopPageInit.js
[edit]
[-] countProductVisits.min.js
[edit]
[-] loginDropdown.min.js
[edit]
[-] productReviewsCriteria.min.js
[edit]
[-] loginDropdown.js
[edit]
[-] actionAfterAddToCart.min.js
[edit]
[-] miniCartQuantity.js
[edit]
[-] woodmartCompare.min.js
[edit]
[-] searchByFilters.min.js
[edit]
[-] miniCartQuantity.min.js
[edit]
[-] updateCartFragmentsFix.min.js
[edit]
[-] waitlistTable.js
[edit]
[-] woocommerceNotices.min.js
[edit]
[-] onRemoveFromCart.min.js
[edit]
[-] quickShopVariationForm.js
[edit]
[-] categoriesAccordion.js
[edit]
[-] singleProductTabsSideHidden.min.js
[edit]
[-] loginTabs.min.js
[edit]
[-] checkoutFields.min.js
[edit]
[-] estimateDeliveryOnCart.min.js
[edit]
[-] productFilters.js
[edit]
[-] wishlistGroup.min.js
[edit]
[-] productRecentlyViewed.js
[edit]
[-] productFilters.min.js
[edit]
[-] shopLoader.js
[edit]
[-] productHover.min.js
[edit]
[-] quickView.min.js
[edit]
[-] checkoutQuantity.js
[edit]
[-] cartWidget.js
[edit]
[-] onRemoveFromCart.js
[edit]
[-] quickView.js
[edit]
[-] woocommerceComments.js
[edit]
[-] countProductVisits.js
[edit]
[-] dynamicDiscountsTable.js
[edit]
[-] loginSidebar.min.js
[edit]
[-] woocommerceComments.min.js
[edit]
[-] swatchesOnGrid.min.js
[edit]
[-] cartQuantity.js
[edit]
[-] productImagesGallery.min.js
[edit]
[-] updateAjaxDeliveryDates.min.js
[edit]
[-] gridQuantity.js
[edit]
[-] stickySidebarBtn.min.js
[edit]
[-] productVideo.min.js
[edit]
[-] variationsPrice.js
[edit]
[-] productReviews.min.js
[edit]
[-] woocommerceNotices.js
[edit]
[-] ajaxFilters.js
[edit]
[-] productImages.min.js
[edit]
[-] trackProductViewed.js
[edit]
[-] ptTable.min.js
[edit]
[-] actionAfterAddToCart.js
[edit]
[-] stickyAddToCart.min.js
[edit]
[-] ptTable.js
[edit]
[-] swatchesLimit.min.js
[edit]
[-] shopPageInit.min.js
[edit]
[-] productVideo.js
[edit]
[-] productGalleryVideo.min.js
[edit]
[-] ajaxFilters.min.js
[edit]
[-] stickyDetails.js
[edit]
[-] productsLoadMore.js
[edit]
[-] woocommercePriceSlider.js
[edit]
[-] sortByWidget.min.js
[edit]
[-] commentImage.js
[edit]
[-] productsTabs.min.js
[edit]
[-] productsTabs.js
[edit]
[-] categoriesDropdowns.js
[edit]
[-] initZoom.min.js
[edit]
[-] updateCartFragmentsFix.js
[edit]
[-] stickySidebarBtn.js
[edit]