if (Shopify && Shopify.shop === "house-ofchikankari.myshopify.com") { throw new Error("Script stopped for this shop."); } if (window.location.pathname.includes("/pages/wishlist")) { throw new Error("Script stopped for this shop."); } window.icallofzColl=1; var zooomyColl= function(jQuery) { var getwishselector = document.querySelectorAll(".zoomywishid"); if(icallofzColl>1){ return false; } window.$=jQuery var getwishselectorlength = getwishselector.length; var ifruncode = getwishselectorlength; var myurlcheck = document.location.href; var checktrue = myurlcheck.includes("login"); if (checktrue == false) { checktrue = myurlcheck.includes("register"); } if (checktrue == false) { checktrue = myurlcheck.includes("challenge"); } if (checktrue == false) { checktrue = myurlcheck.includes("account"); } if (checktrue == false) { checktrue = myurlcheck.includes("cart"); } if (checktrue == false) { checktrue = myurlcheck.includes("pages"); } if (checktrue == false) { checktrue = myurlcheck.includes("blog"); } if (checktrue == false) { checktrue = myurlcheck.includes("policies"); } if ($('#zooomy-wishlist-counter').length){ getwishselectorlength = 1; } if (checktrue) { getwishselectorlength = 1; } var sendurl =""; //console.log(myurlcheck); if (getwishselectorlength == 0) { return false } else { icallofzColl++ let callAjax=1; function wishlist(callAjaxLen) { var WishIdsArray = []; var WishIds = ""; let getwishselector = $(".zoomywishid"); $(getwishselector).each(function() { if ($(this).html().trim() == '') { WishIds = $(this).attr("data-product-id"); WishIdsArray.push(WishIds); } }); let shop = ""; var customerid = ""; var scripts = document.getElementsByTagName("script"); for (var i = 0, l = scripts.length; i < l; i++) { if (scripts[i].getAttribute("data-shop-id") != null) { customerid = scripts[i].getAttribute("data-cus-id"); customername = scripts[i].getAttribute("data-cus-name"); customer_email = scripts[i].getAttribute("data-cus-email"); } } shop = Shopify.shop; var cvalforcust = btoa(customer_email); sendurl = "https://zooomyapps.com/wishlist/Coll.php?shop=" + shop + "&customerid=" + customerid + "&WishIdsArray=" + WishIdsArray + "&ifruncode=" + ifruncode; if(customerid=="") { var WishIdsArrayempty = ""; sendurl = "https://zooomyapps.com/wishlist/Coll.php?shop=" + shop + "&customerid=" + customerid + "&WishIdsArray=" + WishIdsArrayempty + "&ifruncode=" + ifruncode; } $.ajax({ url: sendurl, data: {}, dataType: "jsonp", jsonp: "jsonCode", async: "true", success: function(jsonData) { var usercss = jsonData.custom_css; var useraddedcss = jsonData.user_added_css; var empty = jsonData.empty; var itemadded = jsonData.itemadded; var coll_f_color = jsonData.coll_f_color; var coll_e_color = jsonData.coll_e_color; var login_text = jsonData.login_text; var shop = jsonData.shop; var totalv = jsonData.totalv; var wish_icon= jsonData.wish_icon; if (jsonData.l_f_color == undefined) { jsonData.l_f_color = "#000"; jsonData.l_b_color = "#a4dfc7"; jsonData.l_br_color = "#277f4e"; } if ($('#zooomy-wishlist-counter').length){ $("#zooomy-wishlist-counter span").replaceWith(""+totalv+""); } if ($('.zooomyIconval').length) { if (totalv > 0) { $('.zooomyIconval i.fa').addClass('fa-'+wish_icon).removeClass('fa-'+wish_icon+'-o'); } } $('').appendTo("body"); if (jsonData.w_login == "yes") { $("body").append( '' ); $("").appendTo("body"); } $( "" ).appendTo("body"); $("").appendTo("body"); $("").appendTo("body"); var alldata = {}; if (jsonData.app_plan != "free") { if (getwishselector.length == 0) {} else { $(getwishselector).each(function() { var productid = $(this).attr("data-product-id"); if (jsonData.itemadded[productid] == "yes") { hearticon = "
'); var whiProductInfo = data.filter(function(hero) { return hero.product_id == productid; }); if (whiProductInfo.length == 0) { data.push(alldata); } $(".zwishfixed").append( "" ); if (shop != "happily-ever-a.myshopify.com") { $.ajax({ url: "https://zooomyapps.com/wishlist/ZooomyGuestWishlist.php", data: { shop: shop, productid: productid, title: protitle, handle: handle, proimage: proimage, price: proprice, vname: vname }, dataType: "jsonp", jsonp: "guestdatacode", async: "true", success: function(gjsonData) {}, }); } } else if ($(this).find("p.zadbg").length> 0) { // $(this).prop('checked')==false $(".zooomywishmsg-" + productid).replaceWith('
'); data = data.filter((product) => { return product.product_id != productid; }); $("." + productid).remove(); } var myJSON = JSON.stringify(data); localStorage.setItem("myzooomy__wishlist", myJSON); if ($('#zooomy-wishlist-counter').length){ document.getElementById("zooomy-wishlist-counter").innerHTML = ""+data.length+""; } if ($('.zooomyIconval').length) { if (data.length > 0) { $('.zooomyIconval i.fa').addClass('fa-'+wish_icon).removeClass('fa-'+wish_icon+'-o'); } else { $('.zooomyIconval i.fa').addClass('fa-'+wish_icon+'-o').removeClass('fa-'+wish_icon); } } return false; }); } if (localStorage.getItem("myzooomy__wishlist") == undefined) {} else { let nnitem = localStorage.getItem("myzooomy__wishlist"); let nndata = JSON.parse(nnitem); $.each(nndata, function(key, value) { var pidsall = value.product_id; hearticon = "
'); } if ($(".zooomywishmsg-" + productid + " i").is(".fa-"+wish_icon+"-o")) { $(".zooomywishmsg-" + productid).replaceWith('
'); } $.ajax({ url: "https://zooomyapps.com/wishlist/CollCheck.php", data: { shop: Shopify.shop, productid: productid, customerid: customerid, title: protitle, handle: handle, img: proimage, price: proprice, cval: cvalforcust, customer_name: customername, }, dataType: "jsonp", jsonp: "mylinkprocode", async: "true", success: function(njsonData) { var status = njsonData.done; var productid = njsonData.productid; if (status == "done") { $(".checkbox-" + productid).prop("checked", true); $(".zooomywishmsg-" + productid).replaceWith('
'); if ($('#zooomy-wishlist-counter').length){ const container = document.getElementById('zooomy-wishlist-counter'); var newvalint = parseInt(container.innerText); newvalint=newvalint+1; document.getElementById("zooomy-wishlist-counter").innerHTML = ""+newvalint+""; } } if (status == "ndone") { $(".checkbox-" + productid).prop("checked", false); $(".zooomywishmsg-" + productid).replaceWith('
'); if ($('#zooomy-wishlist-counter').length){ const container = document.getElementById('zooomy-wishlist-counter'); var newvalintnegative = parseInt(container.innerText); newvalintnegative=newvalintnegative-1; document.getElementById("zooomy-wishlist-counter").innerHTML = ""+newvalintnegative+""; } } if ($('.zooomyIconval').length) { if (newtotalval > 0) { $('.zooomyIconval i.fa').addClass('fa-'+wish_icon).removeClass('fa-'+wish_icon+'-o'); } else { $('.zooomyIconval i.fa').addClass('fa-'+wish_icon+'-o').removeClass('fa-'+wish_icon); } } }, }); e.stopPropagation(); return false; }); } } else { $("body").on("click", ".zoomywishid", function(e) { var productid = $(this).attr("data-product-id"); }); } }, }); } wishlist(callAjax); if ($('#zooomy-wishlist-counter').length){ setTimeout(function() { var text = document.getElementById("zooomy-wishlist-counter").innerHTML; if(text == "00" || text=="") { document.getElementById("zooomy-wishlist-counter").innerHTML = "0"; } }, 300); } $(window).scroll(function() { if (getwishselector.length > 0) { clearTimeout($.data(this, 'scrollTimer')); $.data(this, 'scrollTimer', setTimeout(function() { let checkWishList = []; let WishIds = '' let getwishselectorScroll = $(".zoomywishid"); $(getwishselectorScroll).each(function() { if ($(this).html().trim() == '') { WishIds = $(this).attr("data-product-id"); // console.log('..',WishIds) checkWishList.push(WishIds); } }); if (checkWishList.length > 0) { callAjax++; wishlist(callAjax); } }, 300)); } }); } }; function reqJquery(){if("undefined"==typeof jQuery||!jQuery||1===parseInt(jQuery.fn.jquery)&&11>parseFloat(jQuery.fn.jquery.replace(/^1\./,""))){var o=document.getElementsByTagName("head")[0],t=document.createElement("script");t.src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.1/jquery.min.js",t.type="text/javascript",t.onload=t.onreadystatechange=function(){t.readyState?"complete"!==t.readyState&&"loaded"!==t.readyState||(t.onreadystatechange=null,zooomyColl(jQuery.noConflict(!0))):zooomyColl(jQuery.noConflict(!0))},o.appendChild(t)}else zooomyColl(jQuery)} // "product"==meta.page.pageType?setTimeout(reqJquery,2000):reqJquery(); function callFunction() { if (document.readyState === "complete") { // Loading has finished yet reqJquery(); } else { setTimeout(callFunction,500) } } callFunction();