');
});
/* End of USP script */
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/* Start of Mega Menu Mobile script */
require(['jquery'], function($){
$(document).load($(window).bind("resize", menuResize));
function menuResize() {
if($(window).width()li.c-topmenu__category>a.c-topmenu__category--title.menudeptmobile").off('mouseover mouseleave touchstart pointerdown click');
$("ul.c-topmenu__categories>li.c-topmenu__category>a.c-topmenu__category--title.menudeptmobile").next("div").removeAttr("style");
$("ul.c-topmenu__categories>li.c-topmenu__category>a.c-topmenu__category--title.menudeptmobile").click(function(){
$(this).parent("li").toggleClass("is-open");
$(this).next("div").toggleClass("o-animated--open-accordion");
});
$("ul.megamenucategorymain>li>a.megamenucategorymainmobile").off('mouseover mouseleave touchstart pointerdown click');
$("ul.megamenucategorymain>li>a.megamenucategorymainmobile").click(function(){
$(this).parent("li").toggleClass("megamenucategorymainactive");
$(this).next("ul").toggleClass("megamenucategorysubopen");
});
$("ul.megamenucategorymain>li:not(:has(>ul))").css("order", "1");
} else {
$("header>div.c-drawer.o-animated").attr("class","c-drawer o-animated");
$("li.c-topmenu__category>a.c-topmenu__category--title.menudeptmobile.is-open").attr("class","c-topmenu__category--title menudeptmobile");
$("ul.megamenucategorymain>li>a.megamenucategorymainmobile").parent("li").removeClass();
$("ul.megamenucategorymain>li>a.megamenucategorymainmobile").next("ul").attr("class","megamenucategorysub");
}
}
menuResize();
});
/* End of Mega Menu Mobile script */
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/* Start of Basket - Product Stock Message script */
require(['jquery'], function($){
$(document).ready(function() {
// Check if the page is the basket. Presence of 'c-basket__item-lead-time-container' class means its the basket page
if ($('.c-basket__item-lead-time-container').length) {
// Function to change 'lead time' to 'stock status' on each product in basket
$(".c-basket__item-lead-time-container").each(function() {
var basketStockMessageTitle = $(this).html();
$(this).html(basketStockMessageTitle.replace('Lead time', 'Stock Status'));
});
// Function to add classes to 'c-basket__item-lead-time' class on each product in basket dependant on stock message text specific to each product
$(".c-basket__item-lead-time").each(function() {
var basketStockMessageString = $(this).text().toLowerCase();
if (basketStockMessageString.indexOf("in stock for immediate despatch") >= 0) {
$(this).attr("class","c-basket__item-lead-time stock-message-in-warehouse");
} else if (basketStockMessageString.indexOf("not available for instore collection") >= 0) {
$(this).attr("class","c-basket__item-lead-time stock-message-in-supplier");
} else if (basketStockMessageString.indexOf("order now for despatch in") >= 0) {
$(this).attr("class","c-basket__item-lead-time stock-message-order-from-supplier");
} else if ((basketStockMessageString.indexOf("out of stock") >= 0) && !(basketStockMessageString.indexOf("order now for despatch in") >= 0)) {
$(this).attr("class","c-basket__item-lead-time stock-message-out-of-stock");
}
});
}
});
});
/* End of Basket - Product Stock Message script */
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------