File: /home/nahevttf/public_html/wp-content/themes/woodmart/js/scripts/wc/wishlist.min.js
!function(l){woodmartThemeModule.wishlist=function(){var t="woodmart_wishlist_count";if(woodmartThemeModule.$body.hasClass("logged-in")&&(t+="_logged"),woodmart_settings.is_multisite&&(t+="_"+woodmart_settings.current_blog_id),"undefined"!=typeof Cookies){var t=Cookies.get(t),e=0;if(void 0!==t)try{e=JSON.parse(t)}catch(t){console.log("cant parse cookies json")}void 0!==woodmart_settings.wishlist_expanded&&"yes"===woodmart_settings.wishlist_expanded||i(e),woodmartThemeModule.$body.on("click",".wd-wishlist-btn a",function(t){var e=l(this),t=(e.hasClass("added")||t.preventDefault(),e.data("product-id")),o=e.data("key");if(e.hasClass("added"))return!0;e.addClass("loading"),void 0!==woodmart_settings.wishlist_expanded&&"yes"===woodmart_settings.wishlist_expanded&&"disable"!==woodmart_settings.wishlist_show_popup&&woodmartThemeModule.$body.hasClass("logged-in")?woodmartThemeModule.$document.trigger("wdShowWishlistGroupPopup",[t,o]):n(t,"",o)}),woodmartThemeModule.$body.on("click",".wd-wishlist-remove",function(t){t.preventDefault();var e=l(this),t="";e.parents(".wd-wishlist-group").length&&(t=e.parents(".wd-wishlist-group").data("group-id")),e.addClass("loading"),r(e.data("product-id"),t,e.parents(".wd-products-holder"),function(){e.removeClass("loading")})}),woodmartThemeModule.$body.on("click",".wd-wishlist-checkbox",function(t){var e=l(this),o=e.parents(".product-grid-item"),e=e.parents(".wd-products-element").siblings(".wd-wishlist-bulk-action"),s=e.find(".wd-wishlist-select-all");o.toggleClass("wd-current-product"),s.hasClass("wd-selected")&&e.hasClass("wd-visible")&&!o.hasClass("wd-current-product")&&s.removeClass("wd-selected"),o.siblings(".product").length===o.siblings(".wd-current-product").length&&o.hasClass("wd-current-product")&&s.addClass("wd-selected"),o.siblings(".wd-current-product").length||!e.hasClass("wd-visible")||o.hasClass("wd-current-product")?e.addClass("wd-visible"):e.removeClass("wd-visible")}),woodmartThemeModule.$body.on("click",".wd-wishlist-remove-action > a",function(t){t.preventDefault();var e=l(this),t=e.parents(".wd-wishlist-bulk-action").siblings(".wd-products-element").find(".products"),o=t.find(".wd-current-product"),s=[],d="";o.length&&confirm(woodmart_settings.wishlist_remove_notice)&&(e.addClass("loading"),e.parents(".wd-wishlist-group").length&&(d=e.parents(".wd-wishlist-group").data("group-id")),o.each(function(){s.push(l(this).data("id"))}),r(s,d,t,function(){e.parents(".wd-wishlist-bulk-action").removeClass("wd-visible"),e.removeClass("loading")}))}),woodmartThemeModule.$body.on("click",".wd-wishlist-select-all > a",function(t){t.preventDefault();var t=l(this).parent(),e=t.parents(".wd-wishlist-bulk-action").siblings(".wd-products-element").find(".products");t.hasClass("wd-selected")?(e.find(".product").removeClass("wd-current-product").find(".wd-wishlist-checkbox").prop("checked",!1),t.removeClass("wd-selected"),t.parents(".wd-wishlist-bulk-action").removeClass("wd-visible")):(e.find(".product").addClass("wd-current-product").find(".wd-wishlist-checkbox").prop("checked",!0),t.addClass("wd-selected"))}),woodmartThemeModule.$document.on("wdAddProductToWishlist",function(t,e,o,s,d){n(e,o,s,d)}),woodmartThemeModule.$document.on("wdRemoveProductToWishlist",function(t,e,o,s,d){r(e,o,s,d)}),woodmartThemeModule.$document.on("wdUpdateWishlistContent",function(t,e){a(e)})}function a(t){var e=l(".wd-wishlist-content");i(t.count),0<e.length&&!e.hasClass("wd-wishlist-preview")&&woodmartThemeModule.removeDuplicatedStylesFromHTML(t.wishlist_content,function(t){e.replaceWith(t),woodmartThemeModule.$document.trigger("wdUpdateWishlist")})}function i(t){var e=l(".wd-header-wishlist");0<e.length&&e.find(".wd-tools-count").text(t)}function n(t,e,o,s=""){var d=l("a[data-product-id="+t+"]"),i=d.data("added-text");l.ajax({url:woodmart_settings.ajaxurl,data:{action:"woodmart_add_to_wishlist",product_id:t,group:e,key:o},dataType:"json",method:"GET",success:function(t){t?(d.addClass("added"),t.wishlist_content&&a(t),(0<d.find("span").length?d.find("span"):d).text(i),t.fragments&&woodmartThemeModule.$document.trigger("wdWishlistSaveFragments",[t.fragments,t.hash]),woodmartThemeModule.$document.trigger("added_to_wishlist"),woodmartThemeModule.$document.trigger("wdUpdateTooltip",d)):console.log("something wrong loading wishlist data ",t),s&&s()},error:function(){console.log("We cant add to wishlist. Something wrong with AJAX response. Probably some PHP conflict.")},complete:function(){d.removeClass("loading")}})}function r(t,e,s,d=""){var o="";void 0!==s.data("atts")&&((o=s.data("atts")).ajax_page=s.attr("data-paged")),l.ajax({url:woodmart_settings.ajaxurl,data:{action:"woodmart_remove_from_wishlist",product_id:t,group_id:e,key:woodmart_settings.wishlist_page_nonce,atts:o},dataType:"json",method:"GET",success:function(t){var e,o;t.wishlist_content?(i(t.count),e=t,(o=s.parents(".wd-products-element")).length&&!l(".wd-wishlist-content").hasClass("wd-wishlist-preview")&&woodmartThemeModule.removeDuplicatedStylesFromHTML(e.wishlist_content,function(t){o.replaceWith(t),woodmartThemeModule.$document.trigger("wdUpdateWishlist")}),setTimeout(function(){var t=l(".wd-wishlist-content .wd-pagination").find("a.page-numbers");t.length&&t.each(function(){var t=l(this),e=t.attr("href").split("product-page=")[1],e=parseInt(e);t.attr("href",window.location.origin+window.location.pathname+"?product-page="+e)})},500)):console.log("something wrong loading wishlist data ",t),t.fragments&&woodmartThemeModule.$document.trigger("wdUpdateWishlistFragments",[t.fragments,t.hash]),d&&d()},error:function(){console.log("We cant remove from wishlist. Something wrong with AJAX response. Probably some PHP conflict.")}})}},l(document).ready(function(){woodmartThemeModule.wishlist()})}(jQuery);