PageSourceSearch

https://craftshack.com/cdn/shop/t/252/assets/filter-menu.js?v=47385571132426110051689290856

js craftshack.com collected 2026-09-27 01:23:09 UTC 7,037 bytes, 2 lines download raw bytes

1function deferFilterjQuery(){if(window.jQuery){var $=window.jQuery;$(function(){var pt_on_load=function(){var entries=performance.getEntriesByType("navigation");entries.forEach(function(entry){console.log(entry),entry.type==="back_forward"&&sessionStorage.scrollPosition&&($(window).scrollTop(sessionStorage.getItem("scrollPosition")),sessionStorage.removeItem("scrollPosition"))}),$(".pt-display-search").not(".has_group_selected").find("input.fm-search-box").show(),$(".pt-display-dropdown").each(function(index){$(this).find("h4").after($(this).find(".filter-clear"))}),$(".pt-display-dropdown .scroll-content").each(function(index){if($(this).parent().find(".menu-trigger").length===0)if($(this).find("li.selected").length){var selected=$.map($(this).find("li.selected a"),function(element){return $(element).text()}).join(", ");selected.length<30?$(this).before('<div class="menu-trigger" tabindex="0" aria-label="'+$(this).closest(".filter-group").find("h4").text()+' dropdown selection collapsed">'+selected+"</div>"):$(this).before('<div class="menu-trigger" tabindex="0" aria-label="'+$(this).closest(".filter-group").find("h4").text()+' dropdown selection collapsed">'+$(this).find("li.selected").length+" Selected </div>")}else $(this).before('<div class="menu-trigger" tabindex="0" aria-label="'+$(this).closest(".filter-group").find("h4").text()+' dropdown selection collapsed">'+$(this).closest(".filter-group").find("h4").text()+"</div>")}),$(".filter-menu li a").attr("title",function(){return($(this).closest("li").hasClass("selected")?"Clear filter: ":"Add filter: ")+$(this).text()});var splitPath=function(url){var splitUrl=url.split("?")[0].split("#")[0].split("/");return splitUrl},getCollection=function(url){var splitUrl=splitPath(url);return splitUrl[2]},getTags=function(url){var splitUrl=splitPath(url);return(splitUrl[3]||"").split("+")},getCommonCollection=function(url_top,url_nested){var collection_top=getCollection(url_top),collection_nested=getCollection(url_nested);return collection_top!==collection_nested?"all":collection_top},getCommonTags=function(url_top,url_nested){var tags_top=getTags(url_top),tags_nested=getTags(url_nested);return tags_top.filter(function(n){return tags_nested.indexOf(n)>-1})},getCommonUrl=function(url_top,url_nested){var val="/collections/"+getCommonCollection(url_top,url_nested)+"/"+getCommonTags(url_top,url_nested).join("+"),lastChar=val.slice(-1);return lastChar=="/"&&(val=val.slice(0,-1)),val},clearNestedParent=$(".pt-display-nested").prev().each(function(){var clearNested=$(this).next().find("a.filter-clear").attr("href");if(clearNested){var clearLink=$(this).find("a.filter-clear");clearLink.attr("href",getCommonUrl(clearLink.attr("href"),clearNested));var filterLinks=$(this).find("li.selected .collection-name a").each(function(){$(this).attr("href",getCommonUrl($(this).attr("href"),clearNested))})}});if(window.location.pathname.lastIndexOf("/collections/",0)===0)var pjax=new Pjax({elements:".pt-ajax-container .filter-group li a, .filter-group .filter-clear,.pt-ajax-container .pagination a",selectors:["title",".pt-ajax-container"],scrollTo:!1})};pt_on_load(),$(".product-card").on("click",function(){var scrollPosition=$(window).scrollTop();scrollPosition>650&&sessionStorage.setItem("scrollPosition",scrollPosition)}),$(document).on("keyup",".filter-group input.fm-search-box",function(){var value=this.value.toLowerCase();$(this).closest(".filter-group").find("li").each(function(){$(this).text().toLowerCase().search(value)>-1?$(this).show(100):$(this).hide(100)})}),$(document).on("click",".pt-display-dropdown .menu-trigger",function(){$(this).next(".scroll-content").css("top",$(this).position().top+$(this).height()+1).css("left",$(this).position().left),$(this).next(".scroll-content").slideToggle("fast"),$(this).next(".scroll-content").toggleClass("dropdown-open"),$(this).next(".scroll-content").hasClass("dropdown-open")?$(this).attr("aria-label",$(this).closest(".filter-group").find("h4").text()+" dropdown selection expanded"):$(this).attr("aria-label",$(this).closest(".filter-group").find("h4").text()+" dropdown selection collapsed")}),$(document).on("keydown",".pt-display-dropdown .menu-trigger",function(e){(e.which==13||e.which==32)&&(e.preventDefault(),$(this).click())}),$(document).on("mouseleave",".pt-display-dropdown .scroll-content",function(){$(this).removeClass("dropdown-open"),$(this).slideUp("fast"),$(this).prev(".menu-trigger").attr("aria-label",$(this).closest(".filter-group").find("h4").text()+" dropdown selection collapsed")}),$(document).on("focusout",".pt-display-dropdown .scroll-content li:last-child",function(){$(this).closest(".scroll-content").removeClass("dropdown-open"),$(this).closest(".scroll-content").slideUp("fast"),$(this).closest(".scroll-content").prev(".menu-trigger").attr("aria-label",$(this).closest(".filter-group").find("h4").text()+" dropdown selection collapsed")}),$(document).on("click",".filter-menu .filter-group li a",function(){$(this).closest("li").siblings().hasClass("selected")&&$(this).closest("li").siblings().removeClass("selected"),$(this).closest(".filter-group li").toggleClass("selected")});var retries=3,ptAsync=function(){var view,target;window.location.pathname=="/"?(view="view=pt-fm-index-ajax",target="/collections/all?"+view):(view="view=pt-filter-menu",window.location.search!=""?target=window.location.pathname+window.location.search+"&"+view:target=window.location.pathname+"?"+view),$.get(target,function(response){data=response.replace(/view=pt-filter-menu&/g,"").replace(/.view=pt-filter-menu/g,""),html=$
1(data).filter("div#pt-async").contents(),$("[data-pt-async]").replaceWith(html),pt_on_load()}).fail(function(){retries>0?setTimeout(function(){retries-1,console.log("ptAsync failed, retrying "+retries),ptAsync()},500):$("[data-pt-async]").append('<div class="filter-menu" style="text-align:center;">\n                      <div>Error loading filters</div>\n                   </div>')})};ptAsync();var body=document.querySelector("body");document.addEventListener("pjax:send",function(){body.classList.add("pt-ajax-loading");var sidebarEl=document.querySelector(".collection-sidebar");sidebarEl&&(sidebarEl.classList.remove("show"),document.querySelector(".pt-overlay").style.display="none")}),document.addEventListener("pjax:complete",function(){body.classList.remove("pt-ajax-loading"),pt_on_load(),ptAsync();var sections=new theme.Sections;sections.register("collection-template",theme.Collection),$(".zoom-fade-animation-element-wrapper .zoom-fade-animation-element").css({transition:"all 250ms linear",opacity:"1",transform:"scale(1)"}),$(".zoom-fade-animation-element-wrapper .load_media_spinner").hide(),document.querySelector("#PageContainer").setAttribute("style","z-index:1;"),document.querySelector("#shopify-section-header").setAttribute("style","z-index:1000;")})})}else setTimeout(function(){deferFilterjQuery()},50)}deferFilterjQuery();
2//# sourceMappingURL=/cdn/shop/t/252/assets/filter-menu.js.map?v=47385571132426110051689290856

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.