function MM_findObj(n, d) { //v4.01 var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) { d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p); } if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n]; for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document); if (!x && d.getElementById) x = d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i, j = 0, x, a = MM_swapImage.arguments; if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) return; document.MM_sr = new Array; for (i = 0; i < (a.length - 2); i += 3) if ((x = MM_findObj(a[i])) != null) { document.MM_sr[j++] = x; if (!x.oSrc) x.oSrc = x.src; x.src = a[i + 2]; } } (function ($) { $(document).ready(function () { // console.log("ready function entered"); //ipad and iphone fix if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) { $(".bot").click(function () { //we just need to attach a click event listener to provoke iPhone/iPod/iPad's hover event }); document.addEventListener('touchstart', function (e) { $(".MagicThumb-background").remove(); }, false); }// put all your jQuery goodness in here. $(document).ready(function () { $("#email_mailout").submit(function (event) { //$("#mailout").submit(function(event) { /* Stop form from submitting normally */ event.preventDefault(); /* Clear result div*/ $("#result").html(''); /* Get some values from #email_mailout on this page: */ var values = $(this).serialize(); var atpos = values.lastIndexOf("%40") + 2; var lastdotpos = values.lastIndexOf("."); if (atpos < 11 || lastdotpos < atpos + 2 || lastdotpos + 2 >= values.length || atpos == -1) { $("#result").html('The email that was entered had an incorrect format, please try again'); return; } $.support.cors = true; $.ajax({ type: 'POST', data: values, url: '/signup_free_shipping.php', success: function (client) { $("#result").html(client); }, error: function (client) { $("#result").html('There was an error, please try entering your email again'); } }); }); }); $(document).ready(function () { $("#fs_mailout").submit(function (event) { //$("#mailout").submit(function(event) { /* Stop form from submitting normally */ event.preventDefault(); /* Clear result div*/ $("#result").html(''); /* Get some values from #email_mailout on this page: */ var values = $(this).serialize(); var atpos = values.lastIndexOf("%40") + 2; var lastdotpos = values.lastIndexOf("."); if (atpos < 11 || lastdotpos < atpos + 2 || lastdotpos + 2 >= values.length || atpos == -1) { $("#result").html('The email that was entered had an incorrect format, please try again'); return; } $.support.cors = true; $.ajax({ type: 'POST', data: values, url: '/signup_free_shipping.php', success: function (client) { $("#result").html(client); }, error: function (client) { $("#result").html('There was an error, please try entering your email again'); } }); }); }); $(document).ready(function () { $("#discount_mailout").submit(function (event) { //$("#discount_mailout").submit(function(event) { /* Stop form from submitting normally */ event.preventDefault(); /* Clear result div*/ $("#result").html(''); /* Get some values from #discount_mailout on this page: */ var values = $(this).serialize(); var atpos = values.lastIndexOf("%40") + 2; var lastdotpos = values.lastIndexOf("."); if (atpos < 11 || lastdotpos < atpos + 2 || lastdotpos + 2 >= values.length || atpos == -1) { $("#result").html('The email that was entered had an incorrect format, please try again'); return; } $.support.cors = true; $.ajax({ type: 'POST', data: values, url: '/signup_discount.php', success: function (client) { $("#result").html(client); }, error: function (client) { $("#result").html('There was an error, please try entering your email again'); } }); }); }); }); $(document).ready(function () { $("#email_unsubscribe").submit(function (event) { //$("#mailout").submit(function(event) { /* Stop form from submitting normally */ event.preventDefault(); /* Clear result div*/ $("#result").html(''); /* Get some values from #email_mailout on this page: */ var values = $(this).serialize(); var atpos = values.lastIndexOf("%40") + 2; var lastdotpos = values.lastIndexOf("."); if (atpos < 11 || lastdotpos < atpos + 2 || lastdotpos + 2 >= values.length || atpos == -1) { $("#result").html('The email that was entered had an incorrect format, please try again'); return; } $.support.cors = true; $.ajax({ type: 'POST', data: values, url: '/unsubscribe.php', success: function (client) { alert("Submitted successfully"); $("#result").html(client); }, error: function (client) { $("#result").html('There was an error, please try entering your email again'); } }); }); }); $(document).ready(function () { $("#presale_signup").submit(function (event) { //$("#mailout").submit(function(event) { /* Stop form from submitting normally */ event.preventDefault(); /* Clear result div*/ $("#presale_signup_result").html(''); /* Get some values from #presale_signup form on the presale page: */ var values = $(this).serialize(); var atpos = values.lastIndexOf("%40") + 2; var lastdotpos = values.lastIndexOf("."); if (atpos < 11 || lastdotpos < atpos + 2 || lastdotpos + 2 >= values.length || atpos == -1) { $("#presale_signup_result").html('The email that was entered had an incorrect format, please try again'); return; } $.ajax({ type: 'POST', data: values, url: '/presalesignup.php', success: function (client) { $("#presale_signup_result").html(client); }, error: function (client) { $("#presale_signup_result").html('There was an error, please try entering your email again'); } }); }); }); $(document).ready(function () { $("#mc-embedded-subscribe-form").submit(function (event) { //e.preventDefault(); var values = $(this).serialize(); var atpos = values.lastIndexOf("%40") + 2; var lastdotpos = values.lastIndexOf("."); if (atpos < 11 || lastdotpos < atpos + 2 || lastdotpos + 2 >= values.length || atpos == -1) { $(".webserver_response").html('The resubscribe email that was entered had an incorrect format, please try again.'); return; } $.support.cors = true; $.ajax({ type: 'POST', data: values, url: '/resubscribe.php', success: function (client) { //alert("Submitted successfully, you have been resubscribed to the newsletter"); $("#result").html(client); }, error: function (client) { $("#result").html('There was an error connecting to our server, please enter your email again.'); } }); }); }); $('.mobile-nav').on('click', function() { $(this).toggleClass("fa-times"); const closeMobileNavOnScreenWidthIncrease = (event) => { if (event.currentTarget.innerWidth >= 1024) { window.removeEventListener("resize", closeMobileNavOnScreenWidthIncrease); $('.mobile-nav').click(); } }; if (window.innerWidth < 1024) { window.addEventListener("resize", closeMobileNavOnScreenWidthIncrease); } var nav_wrapper = $(".header_nav .nav_wrapper"); if ($(this).hasClass("fa-times")) { nav_wrapper.css('width', 'auto'); nav_wrapper.css('overflow', 'visible'); $('html').css('overflow', 'hidden'); $('body').css('overflow-x', 'initial').css('overflow-y', 'unset'); } else { nav_wrapper.css('width', 0); nav_wrapper.css('overflow', 'hidden'); $('html').css('overflow', 'visible'); $('.with_chevron.open').click(); } $('.main_nav .with_chevron').on('click', function () { var siblings = $(this).siblings('li'); if ($(this).hasClass("closed")) { $(this).removeClass("closed").addClass("open"); siblings.css('display', 'none'); $('.mobile_acc_btn').css('display', 'none'); } else { $(this).removeClass("open").addClass("closed"); siblings.css('display', 'block'); $('.mobile_acc_btn').css('display', 'block'); } }); if ($('.mobile_acc_btn .with_chevron .my_account_nav')) { $('.mobile_acc_btn .with_chevron').on('click', function () { if ($(this).hasClass("closed")) { $(this).removeClass("closed").addClass("open"); $('.main_nav').css('display', 'none'); $('.mobile_acc_btn').css('margin-top', 0); } else { $(this).removeClass("open").addClass("closed"); $('.main_nav').css('display', 'block'); $('.mobile_acc_btn').css('margin-top', 50); } }); } }); $('.nav_backdrop').on('click', function () { $('.mobile-nav').click(); }); $('.nav_buttons .account_icon.sign_in, .account_cat .sign_in, .bf_points .sign_in').on('click', function (e) { e.preventDefault(); var newUrl = new URL(window.location); var params = new URLSearchParams(newUrl.search); params.set('modal', 'login'); newUrl.search = params.toString(); window.history.pushState('openModal', '', newUrl.href); window.dispatchEvent(new Event('popstate')); if ($('.mobile-nav').css('display') !== 'none') { $('.mobile-nav').click(); } }); $('.account_icon_mobile.sign_in').on('click', function (e) { e.preventDefault(); var newUrl = new URL(window.location); var params = new URLSearchParams(newUrl.search); params.set('modal', 'login'); newUrl.search = params.toString(); window.history.pushState('openModal', '', newUrl.href); window.dispatchEvent(new Event('popstate')); }); $('.currency_header_bar .currency, .currency_nav .currency').on('click', function (e) { e.preventDefault(); e.stopImmediatePropagation(); var newUrl = new URL(window.location); var params = new URLSearchParams(newUrl.search); params.set('modal', 'location'); newUrl.search = params.toString(); window.history.pushState('openModal', '', newUrl.href); window.dispatchEvent(new Event('popstate')); if ($('.mobile-nav').css('display') !== 'none') { $('.mobile-nav').click(); } }); $('#find_stylist_btn, .find_stylist_btn').on('click', function (e) { e.preventDefault(); var newUrl = new URL(window.location); var params = new URLSearchParams(newUrl.search); params.set('modal', 'find_stylist'); newUrl.search = params.toString(); window.history.pushState('openModal', '', newUrl.href); window.dispatchEvent(new Event('popstate')); }); $(".advantages_accordion").on('click', function () { $(this).toggleClass('open'); }); $("#filter_form .category_listing .sub_nav_label").on('click', function (e) { if ($(this).hasClass("closed")) { $(this).removeClass("closed").addClass("open"); } else { $(this).removeClass("open").addClass("closed"); } }); $(".account_wrapper_icon .account_icon.sign_out").on('click', function (e) { e.preventDefault(); var sibling = $(this).siblings('.sub_nav_wrapper'); if (sibling.hasClass("closed")) { sibling.removeClass("closed").addClass("open"); } else { sibling.removeClass("open").addClass("closed"); } $('.account_cover_bg').show(); }); $(".account_cover_bg").on('click', function (e) { $(this).hide(); $('.account_wrapper_icon .sub_nav_wrapper').removeClass("open").addClass("closed"); }); $(".search_header_icon").on('click', function (e) { $('#search_header .search_wrapper').removeClass("closed").addClass("open"); $('.search_cover_bg').show(); $('.search_field').focus(); }); $(".search_cover_bg").on('click', function (e) { $(this).hide(); $('#search_header .search_wrapper .search_field').val(''); $('#search_header .search_wrapper').removeClass("open").addClass("closed"); }); $("#search_header .search_cancel").on('click', function (e) { e.preventDefault(); $('#search_header .search_wrapper .search_field').val(''); $('#search_header .search_wrapper').removeClass("open").addClass("closed"); }); $('.bag_wrapper').on('click', function (e) { e.preventDefault(); openBagModal(); }); $(window).on('scroll', function () { if ($(this).scrollTop() > 100) { $('.scrolltop').fadeIn(); } else { $('.scrolltop').fadeOut(); } }); $('.scrolltop').on('click', function () { $('html, body').animate({ scrollTop: 0 }, 'fast'); }); })(jQuery); function openBagModal() { var newUrl = new URL(window.location); var params = new URLSearchParams(newUrl.search); params.set('bag', 'true'); newUrl.search = params.toString(); // using replaceState to replace current URL without adding it to history entries window.history.replaceState('openModal', '', newUrl.href); window.dispatchEvent(new Event('popstate')); }