').addClass('caret fa fa-chevron-down');*/ console.log("top filter dropdown view all click"); $(this).closest(".sb-filter-dropdown-mobile").find("button").each(function (index, item) { $(item).attr("data-selected-filter", ""); $(item).attr("title", $(item).attr("data-filter")); $(item).html($(item).attr("data-filter") + ('')); }); // $(this).closest(".filter-control-inner").find("button").html($(this).attr("data-filter")); GetAllFilterParameter(GetSelectedLeftFilters(), topFilterParameter); }); /* item tout: if top filter dropdown clicked */ $(document).on("click", ".sb-listing-filter-control .filter-dropdown .dropdown-menu li", function () { /*var currentcatId = $(this).closest(".filter-dropdown").find("button").prop("id");*/ document.title = $(this).find(".filter-text").data("text"); window.location.href = window.location.href.split('#')[0] + "#" + $(this).find("a").attr("data-text"); var topFilterParameters = ""; // topFilterParameters = GetSelectedTopFilters(currentcatId, topFilterParameters); $(this).closest(".filter-container").siblings().find("button").attr("data-selected-filter", ""); var otherDpValue = $(this).closest(".filter-container").siblings().find("button").attr("data-filter"); $(this).closest(".filter-container").siblings().find("button").attr("title", otherDpValue); $(this).closest(".filter-container").siblings().find("button").html(otherDpValue + ('')); if ($(this).find(".filter-text").attr("class").indexOf("listing-filter-type-category") > -1) { if (topFilterParameters.length !== 0) { topFilterParameters = topFilterParameters + " and "; } topFilterParameters = topFilterParameters + "(" + "cat= \"%" + $(this).find(".filter-text").attr("data-filter-value") + "%\"" + ")"; } else { if (topFilterParameters.length !== 0) { topFilterParameters = topFilterParameters + " and "; } topFilterParameters = topFilterParameters + "(" + "tag= \"%" + $(this).find(".filter-text").attr("data-filter-value") + "%\"" + ")"; } GetAllFilterParameter(GetSelectedLeftFilters(), topFilterParameters); }); $(document).on("click", ".sb-listing-filter-control .filter-dropdown .fa-close", function () { document.title = $(this).data("text"); history.pushState({}, null, window.location.href.split('#')[0]); $(this).closest(".filter-container").find("button").attr("data-selected-filter", ""); $(this).closest(".filter-container").find("button").attr("title", $(this).closest(".filter-container").find("button").attr("data-filter")); $(this).closest(".filter-container").find("button").html($(this).closest(".filter-container").find("button").attr("data-filter") + ('')); GetAllFilterParameter(GetSelectedLeftFilters(), GetSelectedTopFilters("", "")); }); $(document).on("click", ".sb-listing-filter-control .btn.btn-default.clear-filter", function () { GetAllFilterParameter(GetSelectedLeftFilters(), ""); }); $(document).on("click", ".sb-prod-landing .navbar-nav .custom-link-buttons .nav-pills li a", function () { var category = this.hash.replace('#', '').replace("#", ""); $(".sb-listing-filter-control .filter-dropdown .dropdown-menu li a[data-text=\"" + category + "\"]").closest("li").trigger("click"); }); if ($(".sb-site .filter-listing-container").length > 0) { var category = $(location).attr('hash').replace("#", ""); $(".sb-listing-filter-control .filter-dropdown .dropdown-menu li a[data-text=\"" + category + "\"]").closest("li").trigger("click"); } /* :: adding filter entries into listing filter // mallik */ function add_element_to_array_sb(ele) { var currentItem = ele; var currentVlaue = ele.find(".filter-text").attr("data-filter-value"); var butttonClass = currentItem.closest(".filter-dropdown").find("button").attr("class").split(" ").pop(); var SelectText = $.trim(currentItem.text()); var filterCategoryBox = $(".sb-listing-filter-control .filter-by .hide").clone(); if ($(".sb-listing-filter-control .filter-by span." + butttonClass).size() === 0) { currentItem.closest(".filter-dropdown").find("button").html(SelectText); currentItem.closest(".filter-dropdown").find("button").attr("data-selected-filter", currentVlaue); currentItem.closest(".filter-dropdown").find("button").attr("title", SelectText); $(".sb-listing-filter-control .filter-by").append(filterCategoryBox.removeClass("hide").addClass(butttonClass).html(SelectText)); } else { currentItem.closest(".filter-dropdown").find("button").html(SelectText); currentItem.closest(".filter-dropdown").find("button").attr("data-selected-filter", currentVlaue); currentItem.closest(".filter-dropdown").find("button").attr("title", SelectText); $(".sb-listing-filter-control .filter-by span." + butttonClass).html(SelectText); } } /* :: item tout functions // prachi */ function GetAllFilterParameter(LeftParameters, TopParamters, SortParameter) { var FilterParameters = ""; /*var selectedSortOption = "";*/ if (LeftParameters.length > 0) { FilterParameters = LeftParameters; if (TopParamters.length > 0) { FilterParameters = FilterParameters + " and " + TopParamters; } } else { if (TopParamters.length > 0) { FilterParameters = TopParamters; } } if (FilterParameters.length > 0) { FilterParameters = "[" + FilterParameters + "]"; } GetEnabledCategories(FilterParameters); SortFilterData(FilterParameters, SortParameter); } function GetEnabledCategories(FilterParameters) { var placeholderKey = $("#itemToutPlaceholder").val(); var itemListing = $("#itemListingPageItem").val(); var EnableSmartFilter = $("#EnableSmartFilter-ListingFilter").val(); if (EnableSmartFilter == "True" && FilterParameters.length) { $.ajax({ type: "POST", context: this, data: { scController: "SbListingFilter", scAction: "GetEnabledCategories", Placeholder: placeholderKey, PageItem: itemListing, filterParameter: FilterParameters }, success: function (CategoryTagList) { EnableDisableFilters(CategoryTagList); }, error: function (qXHR, exception) { console.log("error", qXHR); console.log("error", exception); } }); } else { $(".sb-listing-filter-control .filter-category input[type=checkbox]").removeAttr("disabled"); } } function SortFilterData(FilterParameters, SortParameter) { var placeholderKey = $("#itemToutPlaceholder").val(); var itemListing = $("#itemListingPageItem").val(); $.ajax({ type: "POST", context: this, data: { scController: "SbItemTouts", scAction: "SortItemToutsContent", hiddenPlaceholderKey: placeholderKey, itemListingPageItem: itemListing, sortOptions: SortParameter, filterParameter: FilterParameters }, success: function (data) { $(".item-thumbnail.item-tout").html(data); $(".compare-tray-container .product").each(function () { if (!$(this).hasClass("hide")) { var uniqueClass = $(this).attr("class").split(" ")[1]; $(".compare-products").find("." + uniqueClass).addClass("compare-added"); $(".compare-products").find("." + uniqueClass + " input:checkbox").attr("checked", true); } }); if ($(".compare-tray-container .product").length == 5) { $(".compare-selector :checkbox:not(:checked)").attr("disabled", true); $(".compare-selector :checkbox:not(:checked)").closest(".product-compare").addClass("disabled"); } $(".compare-selector :checkbox").each(function () { if ($(this).prop("checked") === true) { /* if the checkbox is checked */ $(this).closest("label").find("span").show(); $(this).closest("label").find("span:first").hide(); } else { $(this).closest("label").find("span").hide(); $(this).closest("label").find("span:first").show(); } }); }, error: function (data) { console.log("error", data); } }); } function GetAllCategories(topFilterParameter) { $(".listing-filter-control .tabs li a").each(function (index, item) { if ($(item).attr("class").indexOf("listing-filter-top-browse-all") === -1) { if (topFilterParameter.length) { if ($(item).attr("class").indexOf("listing-filter-type-category") > -1) { topFilterParameter = topFilterParameter + " or " + "cat= \"%" + getCategoryId($(this).attr("class")) + "%\""; } else { topFilterParameter = topFilterParameter + " or " + "tag= \"%" + getCategoryId($(this).attr("class")) + "%\""; } } else { if ($(item).attr("class").indexOf("listing-filter-type-category") > -1) { topFilterParameter = topFilterParameter + "(" + "cat= \"%" + getCategoryId($(this).attr("class")) + "%\""; } else { topFilterParameter = topFilterParameter + "(" + "tag= \"%" + getCategoryId($(this).attr("class")) + "%\""; } } } }); if (topFilterParameter.length) { topFilterParameter = topFilterParameter + ")"; } return topFilterParameter; } /* :: category content */ function getCategoryId(classNames) { var CategoryId = ""; if (classNames && classNames.length && classNames.split) { classNames = $.trim(classNames); classNames = classNames.replace(/\s+/g, " "); /* remove doube spaces */ var classList = classNames.split(" "); CategoryId = $.map(classList, function (value, key) { if (value.match("^cls-")) { return value.replace("cls-", ""); } }); } return CategoryId; } function GetSelectedTopFilters(currentcatId, topFilterParameters) { $(".sb-listing-filter-control .filter-dropdown .btn-default.dropdown-toggle").each(function (index, element) { if (currentcatId != $(element).attr("data-selected-filter") && $.trim($(element).attr("data-selected-filter")).length !== 0) { if (topFilterParameters.length !== 0) { topFilterParameters = topFilterParameters + " and "; } if ($(element).attr("class").indexOf("listing-filter-type-category") > -1) { topFilterParameters = topFilterParameters + "(" + "cat= \"%" + $(element).attr("data-selected-filter") + "%\"" + ")"; } else { topFilterParameters = topFilterParameters + "(" + "tag= \"%" + $(element).attr("data-selected-filter") + "%\"" + ")"; } } }); if ($(".sb-listing-filter-control .tabs li.active a").length) { if (topFilterParameters.length !== 0) { topFilterParameters = topFilterParameters + " and "; } if ($(".sb-listing-filter-control .tabs li.active a").attr("class").indexOf("listing-filter-top-browse-all") > -1) { topFilterParameters = topFilterParameters + GetAllCategories(topFilterParameters); } else { if ($(".sb-listing-filter-control .tabs li.active a").attr("class").indexOf("listing-filter-type-category") > -1) { topFilterParameters = topFilterParameters + "(" + "cat= \"%" + getCategoryId($(".sb-listing-filter-control .tabs li.active a").attr("class")) + "%\"" + ")"; } else { topFilterParameters = topFilterParameters + "(" + "tag= \"%" + getCategoryId($(".sb-listing-filter-control .tabs li.active a").attr("class")) + "%\"" + ")"; } } } return topFilterParameters; } function EnableDisableFilters(CategoryTagList) { /* left filters */ $(".sb-listing-filter-control .filter-category input[type=checkbox]").each(function (index, item) { if (JSON.stringify(CategoryTagList).toLowerCase().indexOf($(this).val().toLowerCase()) > -1 || $(this).is(":checked")) { $(this).removeAttr("disabled"); } else { $(this).attr("disabled", true); } }); $(".sb-listing-filter-control .filter-container .filter-dropdown .dropdown-menu li").each(function (index, item) { if (JSON.stringify(CategoryTagList).toLowerCase().indexOf($(this).find("a span").attr("data-filter-value").toLowerCase()) > -1) { $(this).find("a").removeClass("filter-disabled"); } else { $(this).find("a").addClass("filter-disabled"); } }); } function GetSelectedLeftFilters() { var CategoryList = []; var CategoryClassList = []; var categoryParam = ""; $(".sb-listing-filter-control .filter-category").find("input:checked").each(function (index, item) { var category = Object.create(null); category.Value = $(item).val(); category.Class = $(item).attr("class"); CategoryList.push(category); if ((CategoryClassList.indexOf($(item).attr("class")) == -1)) { CategoryClassList.push($(item).attr("class")); } }); $.each(CategoryClassList, function (index, item) { var subCategory = []; $.map(CategoryList, function (obj) { if (obj.Class === item) { if (obj.Class.indexOf("listing-filter-type-category") > -1) { subCategory.push("cat= \"%" + obj.Value + "%\""); } else { subCategory.push("tag= \"%" + obj.Value + "%\""); } } }); categoryParam = categoryParam + "(" + subCategory.join(" or ") + ")" + " and "; }); if (categoryParam.slice(-4) == "and ") { categoryParam = categoryParam.slice(0, -4); } return categoryParam; } /* end js code from Sitecore team */ /* Header Starts */ $(".navbar-header .search-primary").before($(".navbar-header .navbar-toggle")); /* Mobile Menu Search Swap */ $("#navbar .nav.navbar-nav").before($("#navbar .site-search.search-expand")); /* Mobile Menu Search Icon Swap */ $(".language-selector-hover>ul>li>a").append(""); /* Utility Menu --> Language Selector */ /* close dropdown / search box */ $(document).on("click", "button.navbar-toggle", function () { $(".site-search.primary-mobile-search").css('display', 'none'); }); $(document).on("click", ".search-primary", function () { $("div#navbar.navbar-collapse").removeClass("in"); $("header > .row .primary-menu .sb-wrapper .navbar-header button.navbar-toggle").removeClass("mobileopen"); }); /* close dropdown / search box */ $(".primary-menu.sticky-menu .container-fluid, header li.megamenu-slidedown>ul>li>.dropdown-menu-container>.row").addClass("sb-wrapper"); $("header > .row .primary-menu .sb-wrapper .navbar-collapse > .nav .megamenu-item ul.dropdown-menu li .dropdown-menu-container > .row nav .custom-link-title").addClass("expand"); /*Megamenu Link, Dropdown Expand and Hide Starts*/ $("header>.row .primary-menu .sb-wrapper .navbar-collapse>.nav .megamenu-slidedown").prepend(""); $("header>.row .primary-menu .sb-wrapper .navbar-collapse>.nav .megamenu-fadein>a, header>.row .primary-menu .sb-wrapper .navbar-collapse>.nav .megamenu-slidedown>a:nth-child(2)").unbind(); $(document).on("click", "header>.row .primary-menu .sb-wrapper .navbar-collapse>.nav .megamenu-slidedown .trigger", function (e) { $("header>.row .primary-menu .sb-wrapper .navbar-collapse>.nav .megamenu-slidedown").toggleClass("open"); }); /*Megamenu Link, Dropdown Expand and Hide Ends*/ /* Header Ends */ $(".sb-tip-detail main .sb-wrapper .product-recommend-thumbnail .thumbnail .col-sm-6, .sb-prod-detail main .sb-panel3 .product-recommend-thumbnail .thumbnail .col-sm-6").removeClass(); /* Touts*/ /* Home Page Last Panel Tout */ $(".sb-landing-01 .sb-panel3 .featured-gallery,.sb-landing-02 .sb-panel2 .featured-gallery").find(".slider").slick("unslick"); /* Filter Menu Mobile View*/ $(document).on("click", ".filter-control-inner>.off-filters-btn-mobile", function () { $(this).toggleClass('filteropen'); $('.filter-control-inner .sb-filter-dropdown-mobile').toggleClass('hidefilter'); }); $(document).on("click", ".navbar-header .navbar-toggle", function () { $(this).toggleClass("mobileopen"); }); $("header .megamenu-item").unbind("mouseenter mouseleave"); /* Mouse Hover Effect for Megamenu */ $(document).on("click", ".navbar-toggle", function () { if ($(".megamenu-item").css('display') == 'none') { $(".megamenu-item").show(); $("header>.row .primary-menu .sb-wrapper .site-search.search-expand").removeClass("open"); $(".site-search.search-expand").css("width", "auto"); $(".site-search.search-expand .input-group .form-control").removeClass("transition"); } else if ($(".megamenu-item").css('display') == 'show') { $(".megamenu-item").toggle(); $("header>.row .primary-menu .sb-wrapper .site-search.search-expand").removeClass("open"); $(".site-search.search-expand").css("width", "auto"); $(".site-search.search-expand .input-group .form-control").removeClass("transition"); } }); /* Search Input Option Animation Starts*/ $(document).on("click", ".search-toggle", function () { $(".megamenu-item, #navbar .search-toggle").hide(); $(".site-search.search-expand").css("width", "100%"); }); $(document).on("click", ".site-search .close", function () { $(".site-search.search-expand").css("width", "0px"); $(".megamenu-item, #navbar .search-toggle").delay(400).show(0); }); /* Search Input Option Animation Ends*/ //if Site Search close button clicks, clear search text // Priyanka $(document).on("click", ".site-search .close", function () { $(".site-search .input-group input[type=text]").val(""); }); //if Site Search close button clicks, clear search text Mobile View // Priyanka $(document).on("click", ".primary-menu .search-primary", function () { $(".site-search .input-group input[type=text]").val(""); }); //if search result page, expand search box //Priyanka if ($(".sb-search-res .sb-search-result").length > 0) { $(".site-search .input-group input[type=text]").val($(".sb-search-result .searched-ele span").html()); $(".sb-search-res .primary-menu").find(".site-search.search-expand .search-toggle a").trigger("click"); } if ($(".sb-faq .sb-wrapper .accordion-control").length > 0) { $(".sb-faq .sb-wrapper .accordion-control .panel-title").each(function (index, item) { $(this).find("a").attr("title", $("
").html($(this).find("a").attr("title")).text()); }); } /* Mobile Menu Item Expand and Hide */ $(document).on("click", ".megamenu-item .custom-link-title", function () { var checkstatus = $(this).siblings(".nav-pills"); if (checkstatus.css('display') == 'block') { checkstatus.hide(); $(this).addClass("expand"); } else if (checkstatus.css('display') == 'none') { checkstatus.show(); $(this).removeClass("expand"); } }); /* start tip detail slick */ $('.sb-slide-items .related-page-thumbnail').slick({ infinite: true, speed: 300, slidesToShow: 4, slidesToScroll: 4, responsive: [ { breakpoint: 1024, settings: { slidesToShow: 3, slidesToScroll: 3, infinite: true, dots: true } }, { breakpoint: 600, settings: { slidesToShow: 2, slidesToScroll: 2 } }, { breakpoint: 480, settings: { slidesToShow: 1, slidesToScroll: 1 } } ] }); /* start tip detail slick */ /* megamenu click + hover */ $("#main-container header>.row .primary-menu .sb-wrapper .navbar-collapse>.nav .megamenu-item .dropdown-menu a").click(function () { $("#main-container header>.row .primary-menu .sb-wrapper .navbar-collapse>.nav .megamenu-item .dropdown-menu").css("display", "none"); $("div#navbar.navbar-collapse").removeClass("in"); $("header > .row .primary-menu .sb-wrapper .navbar-header button.navbar-toggle").removeClass("mobileopen"); $("header>.row .primary-menu .sb-wrapper .navbar-collapse>.nav .megamenu-slidedown").removeClass("open"); }); $("#main-container header>.row .primary-menu .sb-wrapper .navbar-collapse>.nav .megamenu-slidedown").hover(function () { $("#main-container header>.row .primary-menu .sb-wrapper .navbar-collapse>.nav .megamenu-slidedown .dropdown-menu").fadeIn(200); }, function () { $("#main-container header>.row .primary-menu .sb-wrapper .navbar-collapse>.nav .megamenu-slidedown .dropdown-menu").fadeOut(200); }); /* megamenu click + hover */ var deviceAgent = navigator.userAgent.toLowerCase(); var agentID = deviceAgent.match(/(iphone|ipod)/); if (agentID) { $("#main-container header>.row .primary-menu .sb-wrapper .navbar-collapse>.nav .megamenu-slidedown").unbind(); } if (!(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent))) { $('.sb-prod-detail #main-container main .sb-panel1 .product-detail .image .callout .img-responsive, .sb-prod-detail #main-container main .sb-panel1 .product-detail .image .callout .slick-slide').click(function (e) { e.stopImmediatePropagation(); }); } $(".sb-landing-01 .sb-panel1 .fullwidth-promo-callout>.callout-content-right>h2").remove(); $(".sb-landing-01 .sb-panel1 .callout ").addClass("sb-wrapper"); /* end of documentready */ } function windowload() { /* execute on windowload */ /* adding id for prev and next buttons for tips detail page and product detail page */ $(".sb-slide-items button.slick-prev.slick-arrow").attr('id', 'sb-ra-previous'); $(".sb-slide-items button.slick-next.slick-arrow").attr('id', 'sb-ra-next'); $(".sb-prod-detail .product-detail .product-gallery button.slick-prev").attr('id', 'sb-pd-previous'); $(".sb-prod-detail .product-detail .product-gallery button.slick-next").attr('id', 'sb-pd-next'); /* adding id for prev and next buttons for tips detail page and product detail page */ var deviceAgent = navigator.userAgent.toLowerCase(); var agentID = deviceAgent.match(/(iphone|ipod|ipad)/); if (agentID) { $(".magnifier").unbind("mouseenter mouseleave mousedown mousemove mouseout mouseover mouseup"); $(".glass").remove(); } /* end of windowload */ } function windowscroll() { /* execute on windowscroll */ /* On Scroll Header change Starts*/ if ($(window).scrollTop() >= 20) { $("header .utility-menu").hide(); $("header .primary-menu .sb-wrapper .navbar-header .navbar-brand img").addClass("afterscroll"); $("header > .row .primary-mobile-search").css("top", "51px"); } else { $("header .utility-menu").show(); $("header .primary-menu .sb-wrapper .navbar-header .navbar-brand img").removeClass("afterscroll"); $("header > .row .primary-mobile-search").css("top", "71px"); } /* On Scroll header change Ends*/ /* end of windowscroll */ } function windowresize() { /* execute on windowresize */ if ($(window).width() <= screenMd && $(window).width() >= screenSm) { $(".megamenu-slidedown>a").click(function (e) { e.preventDefault(); }); } /* end of windowresize */ } return { scriptload: scriptload, documentready: documentready, windowload: windowload, windowscroll: windowscroll, windowresize: windowresize }; /* all named functions */ /* end of all named functions */ })($); /* anonymous function to prepare the page prior to load being complete */ (function () { SCJSCRUBBINGBUBBLES.scriptload(); })(); /* initiate all the functions here */ $(document).ready(function () { SCJSCRUBBINGBUBBLES.documentready(); }); $(window).load(function () { SCJSCRUBBINGBUBBLES.windowload(); }); $(window).resize(function () { SCJSCRUBBINGBUBBLES.windowresize(); }); $(window).scroll(function () { SCJSCRUBBINGBUBBLES.windowscroll(); });