if (localStorage.getItem("mandarin-vip") == "true") { $(".store-logo").each((index, elem) => { $(elem).find("a").empty(); $(elem).find("a").append(``); }); details = JSON.parse(localStorage.getItem("mandarin-details")); $.ajax({ type: "GET", url: `https://vip.mandarin.club/details_refresh?email=${details["email"]}`, dataType: "text", success: function (data) { if (data == "login failed") { } else { localStorage.setItem("mandarin-vip", "true"); localStorage.setItem("mandarin-details", data); } }, error: function (data) { console.log(data); }, }); function numberWithCommas(x) { return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); } details = JSON.parse(localStorage.getItem("mandarin-details")); current_credit = (Number(details["credits"]) / 100).toFixed(2); $("#localization_form").html(`
CR ${numberWithCommas(current_credit)}
`); $(".account-options").attr("href", "https://mandarin.club/pages/vip-info"); interval_debug = false; setInterval(function () { if (!interval_debug) { $(".blocker").remove(); $(".blocker-buynow").remove(); $(".checkout,.cart-mini-actions__checkout").prepend(`
`); $(".shopify-payment-button").prepend(`
`); $(".blocker").on("click", () => { location.assign("https://mandarin.club/pages/vip-checkout"); }); $(".blocker-buynow").on("click", () => { if (window.location.search.split("=")[1]) { Shopify.addItem(window.location.search.split("=")[1]); } else { Shopify.addItem(meta.product.variants[0].id); } }); Shopify.onCartUpdate = function (t) {}; Shopify.onItemAdded = function (t) { location.assign("https://mandarin.club/pages/vip-checkout"); }; } }, 500); } else { $(".account-options").attr("href", "https://mandarin.club/pages/vip-login"); if(location.pathname == 'vip_link'){ location.replace("https://mandarin.club") } }