PageSourceSearch

https://crystaldtf.com/cdn/shop/t/6/assets/search.js?v=160537919200763487701757459195

js crystaldtf.com collected 2026-10-05 19:04:13 UTC 8,275 bytes, 3 lines download raw bytes

1document.addEventListener("DOMContentLoaded",searchTabsInit,!1),document.addEventListener("shopify:section:load",searchTabsInit,!1),document.addEventListener("DOMContentLoaded",speechInit,!1),document.addEventListener("shopify:section:load",speechInit,!1);var $resultsBox=$(".yv-search-result-container"),searchbarresult=$("body").find(".yv-header-searchbar-content");function removeHtmlEntities(str){const htmlEntities={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&apos;"};return str.replace(/([&<>\"'])/g,match=>htmlEntities[match])}function searchTabsInit(){var tabHead=document.getElementsByClassName("yv-tab-result-head");if(tabHead.length>0){var tabContent=document.getElementsByClassName("yv-search-result-list");Array.from(tabHead).forEach(function(btn){btn.addEventListener("click",e=>{e.preventDefault(),Array.from(tabHead).forEach(function(item){item.classList.remove("active")});let searchUrl2=btn.getAttribute("data-resulturl"),searchContainer=document.querySelector(".search-bar-container");if(searchContainer){let allresultLink=searchContainer.querySelector(".search-result-bottom");searchContainer&&allresultLink.setAttribute("href",searchUrl2)}Array.from(tabContent).forEach(function(item){item.classList.remove("active")}),btn.classList.add("active");var _value=btn.getAttribute("data-results");document.getElementById(_value).classList.add("active")})})}}var searchTyping;$(document).ready(function(){$("body").on("click",".search-form",function(e){e.preventDefault(),focusElement=$(".search-form");var _class=$(this).data("search-drawer");$("body").toggleClass(_class),$("input.search-input").trigger("focus"),$("#recent_search_list").html(""),recentSearch(),focusElementsRotation($(".search-bar-container"))}),$(".AjaxSearchResponse").prepend(""),$(".search-close").show(),$("body").on("keydown",".search-input",function(e){clearTimeout(searchTyping),this.value.length===0&&e.which===32&&e.preventDefault()}),$("body").on("keyup",".search-input",function(e){clearTimeout(searchTyping);var _this=$(this);searchResults(_this)}),$(".search-form, #search-form").on("submit",function(e){e.preventDefault();var term="*"+$(this).find('input[name="q"]').val()+"*",linkURL=$(this).attr("action")+"?q="+term+"&options%5Bprefix%5D=last";window.location=linkURL}),$("body").on("click",".yv-search-drawer-close",function(e){e.preventDefault(),$("input.form-control.search-input").val(""),$resultsBox.empty(),$("body").removeClass("addsearch"),stopFocusElementsRotation(),focusElement.trigger("focus")}),$("body").on("click",".yv-search-bar",function(e){$(this).val().length>2&&$(".yv-header-searchbar-content").show()}),$(document).on("focus","button[data-searchbar-cross]",function(e){e.preventDefault(),$(this).hide(),$(".yv-search-bar").val(""),searchbarresult.hide(),searchbarresult.html("")})});function recentSearch(){$("#recent_search_list").html(""),$(".recent-search-list").siblings(".yv-search-result-container").removeClass("no-recent");var recent_Html="",showRecent=!1;setTimeout(function(){var recent_pro=localStorage.getItem("Recent_search"),recent_pro_val=JSON.parse(recent_pro);if($(".recent-search-list").html(""),recent_pro_val==null)$(".recent-search-list").html(""),$(".recent-search-list").siblings(".yv-search-result-container").addClass("no-recent");else{recent_Html=recent_Html.concat('<h6 class="recent-search-title">'+searchRecentTitleText+"</h6>"),recent_Html=recent_Html.concat('<ul class="list-unstyled recent-search-listing">');var Prev_search=recent_pro_val.reverse();$.each(Prev_search,function(index,value){var productUrl="";if(rootUrl.length>1&&(productUrl=rootUrl),index<10){var getV=value;jQuery.ajax({type:"GET",url:productUrl+"/products/"+value+".json",success:function(response){showRecent=!0;let product=response.product,imgSrc=noProductImage,productTitle=$("<div>"+product.title+"</div>").text();product.image&&(imgSrc=`<img src="${product.image.src}&width=100" alt="${removeHtmlEntities(productTitle)}">`),recent_Html+=`<li><a class="focus-inside" href="${productUrl}/products/${product.handle}">
2                      ${imgSrc}<span>${truncate(removeHtmlEntities(productTitle),2)}</span></a></li>`},error:function(error){console.log("Error: "+error)}})}}),$(document).ajaxStop(function(){recent_Html=recent_Html.concat("</ul>"),showRecent&&($("#recent_search_list").html(recent_Html),focusElementsRotation($(".search-bar-container")))})}},500)}function searchResults(inputField){var section_id="",_drawer=$("[data-search-drawer]").data("search-drawer"),_searchContainer=$("body").find(".search-bar-container"),retrievedSearch=localStorage.getItem("Recent_search"),retrievedSearch_v=JSON.parse(retrievedSearch);if(retrievedSearch_v==null)var retrievedSearch_v=[];var $form=inputField.closest("form");searchTyping=setTimeout(function(){$resultsBox.html(preLoadLoadGif);var term=$form.find('input[name="q"]').val(),resultType="product";searchPageResults&&(resultType+=",page"),searchArticleResults&&(resultType+=",article"),searchCollectionResults&&(resultType+=",collection"),searchSuggestions&&(resultType+=",query"),inputField.hasClass("yv-search-bar")?(searchbarresult.show(),searchbarresult.html(preLoadLoadGif),section_id="predictive-search-lite"):section_id="predictive-search",term!=inputField.data("oldval")?(inputField.hasClass("yv-search-bar")&&$("button[data-searchbar-cross]").show(),fetch(searchUrl+"/suggest?section_id="+section_id+"&q="+term+"&resources[type]="+resultType+"&resources[options][fields]=author,tag,title,product_type,variants.title,vendor,variants.sku").then(response=>response.text()).then(resultHtml=>{let results=new DOMParser().parseFromString(resultHtml,"text/html").querySelector("#shopify-section-"+section_id);inputField.hasClass("yv-search-bar")?results&&searchbarresult.html(results.innerHTML):(_searchContainer.find("[data-search-suggestions]").length>0&&(results&&results.querySelector("[data-search-suggestions]")?(_searchContainer.find("[data-search-suggestions]").html(results.querySelector("[data-search-suggestions]").innerHTML),results.querySelector("[data-search-suggestions]").innerHTML=""):_searchContainer.find("[data-search-suggestions]").html("")),results?($resultsBox.html(results.innerHTML),searchTabsInit(
2),recentProductHandle&&retrievedSearch_v.includes(recentProductHandle)===!1&&retrievedSearch_v.push(recentProductHandle),localStorage.setItem("Recent_search",JSON.stringify(retrievedSearch_v))):$resultsBox.empty(),focusElementsRotation($(".search-bar-container")))})):term.length<=2&&($resultsBox.empty(),searchbarresult.empty(),$("button[data-searchbar-cross]").hide(),searchbarresult.css("display","none"),focusElementsRotation($(".search-bar-container")))},1e3)}function speechInit(){let searchBySpeechs=document.querySelectorAll("[data-speech-search]");Array.from(searchBySpeechs).forEach(function(searchBySpeech){initSpeectRecognition(searchBySpeech)})}function initSpeectRecognition(searchSpeech){let speechRecognition=null,listening=!1,searchInput=null;const userAgent=window.navigator.userAgent.toLowerCase();"webkitSpeechRecognition"in window&&userAgent.indexOf("chrome")>-1&&window.chrome&&userAgent.indexOf("edg/")===-1&&(searchSpeech.classList.remove("hidden"),speechRecognition=new window.webkitSpeechRecognition,speechRecognition.continuous=!1,speechRecognition.interimResults=!1,searchInput=searchSpeech.closest("form").querySelector("[data-search-input]"),speechRecognition.addEventListener("result",debounce(evt=>{if(evt.results){const term=evt.results[0][0].transcript;searchInput.value=term,searchInput.focus(),searchInput.dispatchEvent(new Event("input")),searchResults($(searchInput))}},300)),speechRecognition.addEventListener("audiostart",()=>{listening=!0,searchSpeech.classList.add("active")}),speechRecognition.addEventListener("audioend",()=>{listening=!1,searchSpeech.classList.remove("active")}),searchSpeech.addEventListener("click",function(evt){evt.preventDefault(),listening?(speechRecognition.stop(),listening=!1):(speechRecognition.start(),listening=!0)}),searchSpeech.addEventListener("keydown",evt=>{(evt.code==="Space"||evt.code==="Enter")&&(evt.preventDefault(),listening?speechRecognition.stop():speechRecognition.start())}))}
3//# sourceMappingURL=/cdn/shop/t/6/assets/search.js.map?v=160537919200763487701757459195

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.