Files
Last update 2 months 4 days
by
Arnaud-Apu-Fanovard
Product.js.téléchargementvar ihsObjectId,envDocsList,showPdpRecommendedProducts,getSimilarProductsData,tidForRecommendedProducts,spec_Checkbox_FocusElement,reachGa4dataAttribute,DocsShowAll=!0,DocsToShow=25,ihsCalled=!1,countAp=0,countAb=0,reachModalClosedByXButton=!1,reachIsESCKeyHandled=!1,alsoBoughtPanelExpanded=!1,associatedProductPanelExpanded=!1;function populateLwSimilarProducts(e){if(!showPdpRecommendedProducts)return e();var s,o=(s=$("#ProductIdEncForCustPartNum"))===null||s===void 0?void 0:s.val(),t=document.getElementById("tblSimilarProducts"),n=document.getElementById("pdpSimilarProducts");if(!t)return e();if(t.removeAttribute("aria-hidden"),n){if(!o&&!tidForRecommendedProducts)return animateAndHide(n,"panelAnimation",t),window.dataLayer.push({event:"pdp_similar_products_error",error_type:"default error"}),e();$.ajax({type:"GET",url:"/Product/GetSimilarProducts?qs="+encodeURIComponent(o)+"&tid="+encodeURIComponent(tidForRecommendedProducts),success:function(s){if(!s.success)return animateAndHide(n,"panelAnimation",t),window.dataLayer.push({event:"pdp_similar_products_error",error_type:"default error"}),e();document.querySelectorAll(".pdp-similar-products-row").forEach(function(e){return e.classList.remove("loading")}),s.similarProductsCount!=0?(n.classList.remove("similar-products-panel-height"),document.getElementById("similarProductCompareBtnRow").classList.remove("hidden"),document.getElementById("similarProductCompareBtnRow").addEventListener("click",function(){window.dataLayer.push({event:"pdp_compare_similar_products_click_button",event_index:s.similarProductsCount})}),t.querySelector("tbody").innerHTML=s.similarProductsListPartialView,window.dataLayer.push({event:"pdp_similar_products_shown",event_index:s.similarProductsCount}),s.similarProductsViewItemListGa4&&eval(s.similarProductsViewItemListGa4)):(animateAndHide(n,"panelAnimation",t),s.LwProductCount>0?window.dataLayer.push({event:"pdp_similar_products_error",error_type:"no valid products returned"}):s.LwProductCount==0&&window.dataLayer.push({event:"pdp_similar_products_error",error_type:"no products returned from lw"})),getSimilarProductsData=s,e()},error:function(){animateAndHide(n,"panelAnimation",t),window.dataLayer.push({event:"pdp_similar_products_error",error_type:"ajax call failed"}),e()}})}}function animateAndHide(e,t,n){if(n===void 0&&(n=null),e.classList.add(t),t==="animationHidden"){var s,o=document.getElementById("similarProductEmptyElement"),i=document.getElementById("similarProductContainer");o&&i&&(o.style.display="none",i.classList.add("smoothDisappear")),e.style.display="none"}else n&&n.classList.add("panelBodyOpacity"),e.classList.add("smoothDisappearPanel"),s=document.getElementById("pdpSimilarProductsHeading"),s&&(s.style.display="none"),e.addEventListener("animationend",function t(){e.style.display="none",e.removeEventListener("animationend",t)})}function displaySimilarProductAvailability(){if(!showPdpRecommendedProducts)return;var e=document.getElementById("similarProductCount");e&&(e.classList.remove("availability-loading"),getSimilarProductsData!=null?getSimilarProductsData.similarProductsCount==0?animateAndHide(e,"animationHidden"):(e.classList.add("availability-similar-products-text"),e.innerHTML=`<div> <i class="fa fa-lg fa-info-circle similar-product-info-circle" aria-hidden="true"></i> <button id="btnSimilarProductBanner" type="button" onclick="routeSimilarProduct(event); similarProductBannerClickGa4();" class="btn btn-link similar-product-alert-link"> `+getSimilarProductsData.similarProductsCountString+` </button> </div>`,window.dataLayer.push({event:"pdp_compare_similar_products_shown",event_index:getSimilarProductsData.similarProductsCount})):animateAndHide(e,"animationHidden"))}function similarProductBannerClickGa4(){window.dataLayer.push({event:"pdp_compare_similar_products_click_link",event_index:getSimilarProductsData.similarProductsCount})}function routeSimilarProduct(e){e&&e.preventDefault();var n,s,o,t=getSimilarProductsData.similarProductsproductIds;!t||t.length===0?window.location.href="~/404/":(n=new URLSearchParams,s=encodeURIComponent(t),n.append("qs",s),o=n.toString(),window.location.href="/Compare/SimilarProducts?"+o)}function CheckValidQuantityComparePartModalButton(e,t){var n,o=!1,s=$("#"+e).val(),i=/^(?!0+$)\d+$/;return s===""||i.test(s)&&s.indexOf(".")>-1===!1&&!isNaN(s)?($("#compareProductModalAddToCart").prop("disabled",!1),n=document.getElementById(t),n&&(n.style.display="none"),document.getElementById(e).classList.remove("input-validation-error"),o=!0):(n=document.getElementById(t),n&&(n.classList.remove("field-validation-valid"),n.classList.add("field-validation-error"),n.style.display="block",n.textContent=document.getElementById(e).getAttribute("data-val-regex")),document.getElementById(e).classList.add("input-validation-error")),o}function CheckValidQuanityPdpAddToProjectButton(){var t,n,e=$("#QuantityForAddToProject").val(),s=/^(?!0+$)\d+$/;e==""||s.test(e)&&e.indexOf(".")>-1==!1&&!isNaN(e)?($("#btnAddToProject").prop("disabled",!1),$("#AddToProject").prop("disabled",!1),n=$("#QuantityForAddToProject-error-span"),n&&n.hide(),document.getElementById("QuantityForAddToProject").classList.remove("input-validation-error")):($("#btnAddToProject").prop("disabled",!0),$("#AddToProject").prop("disabled",!0),document.getElementById("QuantityForAddToProject").classList.add("input-validation-error"),document.getElementById("QuantityForAddToProject-error-span").classList.remove("field-validation-valid"),document.getElementById("QuantityForAddToProject-error-span").classList.add("field-validation-error"),t=document.getElementById("QuantityForAddToProject-error-span"),t&&(t.style.display="block",t.textContent=document.getElementById("QuantityForAddToProject").getAttribute("data-val-regex")))}function CheckAB(){if(countAb==0){var e=$("input:hidden[name=Ga4AlsoBoughtOnClick]").val();eval(e),countAb++,customerAbGa4()}}function customerAbGa4(){$("#collapseAlsoBought").on("show.bs.collapse",function(){window.dataLayer.push({event:"pdp_also_bought_section_expanded"})})}function populateAB(){alsoBoughtPanelExpanded||(customerAbGa4(),populateApOrAb("tblAlsoBought","GetCustomersAlsoBoughtProducts"),alsoBoughtPanelExpanded=!0)}function CheckAP(){if(countAp==0){var e=$("input:hidden[name=Ga4AssociatedProductOnClick]").val();eval(e),countAp++,customerAPGa4()}}function customerAPGa4(){window.isGA4PDPEnabled&&$("#collapseAssociatedProd").on("show.bs.collapse",function(){window.dataLayer.push({event:"pdp_associated_products_section_expanded"})})}function populateAP(){associatedProductPanelExpanded||(customerAPGa4(),populateApOrAb("tblAssociatedProducts","GetAssociatedProducts"),associatedProductPanelExpanded=!0)}function populateApOrAb(e,t){var s,o,i='<div id="apAbProductsPanelAlert" class="alert alert-info text-center ">'+pdpStrResources.apAbProductRetrievalErrorMsg+"</div>",n=document.getElementById(e);if(!n)return;n.removeAttribute("aria-hidden"),o=(s=$("#ProductIdEncForCustPartNum"))===null||s===void 0?void 0:s.val(),o||(n.style.border="none",n.innerHTML=i),$.ajax({type:"GET",url:"/Product/"+t+"?qs="+encodeURIComponent(o),success:function(e){e.accordionOnClickGa4&&eval(e.accordionOnClickGa4),n.querySelector("tbody").innerHTML=e.apOrAbPartialView,typeof BindQuickViewPopup!="undefined"&&typeof BindQuickViewPopup=="function"&&BindQuickViewPopup()},error:function(){n.style.border="none",n.innerHTML=i}})}function CheckPC(){window.isProductComplianceGa4Enabled&&$("#pdpProdCompliance a").hasClass("collapsed")===!0&&window.dataLayer.push({event:"pdp_product_compliance_section_expanded"})}function GaPdpViewExpectedDatesOnClick(){window.isGA4PDPEnabled&&window.dataLayer.push({event:"pdp_view_dates_clicked"})}function GaPdpReturnToResultsOnClick(e){window.isGA4PDPEnabled&&window.dataLayer.push({event:"pdp_breadcrumb_return_to_results_clicked",link_url:e})}function GaPdpFeaturedProductsClick(e,t,n,s){window.isGA4FeaturedProductPDPEnabled&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push({event:"select_promotion",ecommerce:{items:[{promotion_id:t.toLowerCase().replace("~",""),promotion_name:e.toLowerCase(),creative_name:"pdp featured products "+n,creative_slot:"pdp_fp_"+ ++s}]}}))}function GaPdpSpecificationsSeriesClick(e){window.isGA4PDPEnabled&&e==="lnkSpecSeries"&&window.dataLayer.push({event:"pdp_specifications_series_clicked"})}function OpenPopUpWindow(e,t,n,s,o,i){e||(e="popUpMsg"),t||(t=600),n||(n=600),o||(o="no"),i||(i="yes");var c,l,d,u,h,a=0,r=0;typeof window.screenLeft!="undefined"?(a=window.screenLeft,r=window.screenTop):typeof window.screenX!="undefined"&&(a=window.screenX,r=window.screenY),c={toolbar:"no",location:"no",directories:"no",left:a+($(window).width()-t)*.5,top:r+($(window).height()-n)*.5,status:"yes",menubar:"no",scrollbars:o,resizable:i,width:t,height:n},l=[];for(d in c)l.push(d+"="+c[d]);return u=l.join(","),h=window.open(s,e,u),h.focus(),!1}function RestCenCebEufPopUp(e){OpenPopUpWindow("cenCebEufMsg",488,454,e)}function RestZeroPricePopUp(e){OpenPopUpWindow("zeroPriceMsg",488,454,e)}function RestItarPopUp(e){OpenPopUpWindow("itarMsg",488,454,e)}function RestLthormPopUp(e){OpenPopUpWindow("lthormMsg",488,454,e)}function RestEeePopUp(e){OpenPopUpWindow("eeeMsg",488,454,e)}function RestPunchoutCategoryPopUp(e){OpenPopUpWindow("PunchoutMsg",488,454,e)}function RestHzfPopUp(e){OpenPopUpWindow("hzfMsg",488,454,e)}function RestBigRmbPopUp(e){OpenPopUpWindow("bigRmbMsg",488,454,e)}function RestOdePopUp(e){OpenPopUpWindow("odeMsg",488,454,e)}function ImportantInfoPopup(e){OpenPopUpWindow("impInfoMsg",454,488,e)}function ProductUpdatePopup(e){OpenPopUpWindow("prodUpdateInfoMsg",454,488,e)}function FactoryPackQtyPopup(e){OpenPopUpWindow("aooMsg",500,300,e)}function DdPopup(){var t=pdpStrResources.SoftwarePurchaseInfo,e=$('<div id="ddModal" class="center"><p>'+t+"</p></div>");e.dialog({title:pdpStrResources.SoftwarePurchaseInfoTitle,autoOpen:!1,resizable:!1,modal:!0,closeOnEscape:!1,draggable:!1,width:GetResponsiveModalWidth(440),height:GetResponsiveModalHeight(200),buttons:[{id:"btnClose",text:pdpStrResources.btnClose,click:function(){e.dialog("destroy")}}]}),$("#ddModal").dialog("open")}function ViewDeliveryDatesModal(){var e=$('<div id="DeliveryDatesModal" class="center"></div>'),t=$("input:hidden[name=MouserPartNumFormatted]").val(),n="/search/include/aoo_popup.aspx?mouserpartnumber="+t;e.dialog({autoOpen:!1,resizable:!1,closeOnEscape:!0,draggable:!1,modal:!0,width:GetResponsiveModalWidth(565),height:GetResponsiveModalHeight(625),open:function(){e.load(n)},buttons:[{id:"btnClose",text:pdpStrResources.btnClose,click:function(){e.dialog("destroy")}}]}),$("#DeliveryDatesModal").dialog("open"),$(".ui-dialog-titlebar").hide()}function PdpSpinnerOpen(){$.colorbox.settings.trapFocus=!1,$("#colorbox").css("display")!=="block"&&$("a#lnkloader").trigger("click")}function PdpSpinnerClose(){$("#colorbox").css("display")==="block"&&setTimeout(function(){$.colorbox.close()},500)}function SpecificationSpinnerClose(){$("#colorbox").css("display")==="block"&&setTimeout(function(){$.colorbox.close(),spec_Checkbox_FocusElement&&spec_Checkbox_FocusElement.classList.contains("find-similar")&&spec_Checkbox_FocusElement.focus()},500)}function IsValid(e){return typeof e!="undefined"&&e}function IsPositiveInteger(e){return/^\d+$/.test(e)}function GetModalDimensions(){var t=$(window).height()-35,e=$(window).width()-35;return e>=785&&(e=750),{height:t,width:e}}function ShowDocs(){var e,n,t=$("#DocTypesSelection").val();if(typeof t=="undefined")return!1;t===""?e=$("div[data-dbdoctype], li[data-dbdoctype]"):e=$('div[data-dbdoctype="'+t.toLowerCase()+'"], li[data-dbdoctype="'+t.toLowerCase()+'"]'),IsValid(e)&&e.length>0?(n=e.length,$("div[data-dbdoctype], li[data-dbdoctype]").hide(),$("span[data-dbdoctype]").hide(),DocsShowAll?n>DocsToShow?(e.slice(0,DocsToShow).show(),$(".docs-show-less").hide(),$(".docs-show-all").show()):(e.show(),$(".docs-show-less, .docs-show-all").hide()):(e.show(),n>DocsToShow?($(".docs-show-less").show(),$(".docs-show-all").hide()):$(".docs-show-less, .docs-show-all").hide())):$(".docs-show-less, .docs-show-all").hide()}function UpdateViewCompareCount(e){$("#btnAddToCompare").text(pdpStrResources.AddedToCompareList+" ("+e+")")}function AddToCompareList(){try{var e=$("input:hidden[name=ProductIdEncForAddToCompare]").val();$.ajax({url:"/Product/Product/AddToCompare",type:"POST",async:!1,timeout:1e4,data:{productIdEncForAddToCompare:e}}).done(function(e){e.productAdded&&($("#chkAddToCompare").prop("checked",e.productAdded),$("#lblCompareProduct").addClass("hidden"),UpdateViewCompareCount(e.itemsToCompare),$("#btnAddToCompare").removeClass("hidden"))})}catch{}}function RemoveFromCompareList(){try{var e=$("input:hidden[name=ProductIdEncForAddToCompare]").val();$.ajax({url:"/Product/Product/RemoveFromCompare",type:"POST",data:{productIdEncForAddToCompare:e}}).done(function(e){e.toLowerCase()==="true"?e=!0:e=!1,$("#chkAddToCompare").prop("checked",!e),e&&($("#lblCompareProduct").removeClass("hidden"),$("#btnAddToCompare").addClass("hidden"))})}catch{}}function AddRemoveCompareList(){$("#chkAddToCompare").is(":checked")?AddToCompareList():RemoveFromCompareList()}function CheckProductInCompareSet(){try{var e=$("input:hidden[name=ProductIdEncForAddToCompare]").val();$.ajax({url:"/Product/Product/ProductInCompareSet",type:"POST",data:{productIdEncForAddToCompare:e}}).done(function(e){e>0?($("#lblCompareProduct").addClass("hidden"),$("#btnAddToCompare").removeClass("hidden"),$("#chkAddToCompare").prop("checked",!0),UpdateViewCompareCount(e)):($("#lblCompareProduct").removeClass("hidden"),$("#btnAddToCompare").addClass("hidden"),$("#chkAddToCompare").prop("checked",!1))})}catch{}}function LoginCheck(){var e,t=!1,n=GetCurrentUrlPathAndQuery();return $.ajax({url:"/Product/Product/CustIsLoggedIn",type:"POST",async:!1,timeout:1e4,data:{currentPathAndQuery:n},success:function(n){n.isLoggedIn?t=!0:e=n.redirectString},error:function(){e="../MyMouser/MouserLogin.aspx"}}).done(function(){IsValid(e)&&e.length>0&&(window.location.href=e)}),t}function GetCurrentUrlPathAndQuery(){return window.location.pathname+window.location.search+window.location.hash}function AddToProjectDialog(){var e,t,n=LoginCheck();if(!n)return!1;$("#btnAddToProject").prop("disabled",!1),e=$("input:hidden[name=ProductQs]").val(),t="/Product/Product/AddToProjectDialog?qs="+e,$("#divAddToProjectDialog").load(t,function(){$("select#ddlProjects").on("change",function(){AtpListChange()}),$("input#QuantityForAddToProject").on("keyup",function(){AtpQtyChange()}),$("#btnCancelAtp, #btnAddToProject").show(),$("#btnCloseAtp").hide(),$("#divAddToProjectDialog").dialog("open")})}function AddToProjectClick(){var t=$("#QuantityForAddToProject").val(),e=$("input:hidden[name=DataLayerScriptForAddToProject]").val();$.ajax({url:"/Product/Product/AddToProject?customerPartNumber="+encodeURIComponent(MiniCart.GetCustomerPartNumber()),type:"POST",data:$("#formAddToProject").serialize(),success:function(n){$("#formAddToProject").html(n),$("#btnCloseAtp").show(),$("#btnCancelAtp, #btnAddToProject").hide();var s,o,a,r,i=Number(t);IsValid(i)&&IsPositiveInteger(i)?(s='"quantity":'+i,o=e.replace('"quantity":1',s)):(a=t.replace(/[^0-9]/g,""),r=Number(a),IsPositiveInteger(a)?(s='"quantity":'+r,o=e.replace('"quantity":1',s)):o=e),eval(o)}})}function LoadEnvironmentalDocuments(){ga("send","event","IHS Environmental Documents","Dropdown Interaction","Opened"),ihsCalled||$.ajax({url:"/Product/Product/GetEnvironmentalDocs?objectId="+ihsObjectId,data:{fabEnvDocs:envDocsList},type:"POST",success:function(e){ihsCalled=!0,$("#envDocsBody").html(e)}})}function TriggerIhsGaEvents(e,t){e&&e.length>0?e.toLowerCase().indexOf("timeout")>-1?ga("send","event","IHS Environmental Documents","Error","Timeout"):ga("send","event","IHS Environmental Documents","Error","Error Status "+e):t>0?ga("send","event","IHS Environmental Documents","Documents Returned",t.toString(),t):ga("send","event","IHS Environmental Documents","Error","No Documents")}function IhsDocClicked(e,t){ga("send","event","Environmental Documents Tab Download","IHS Environmental",t+"|"+e)}function CreateProjectDialog(){var e=$("#divAddToProjectDialog");e.dialog({dialogClass:"addToProjectStyle",title:pdpStrResources.AddToProject,resizable:!1,modal:!0,width:GetResponsiveModalWidth(510),height:GetResponsiveModalHeight(520),autoOpen:!1,buttons:[{id:"btnCancelAtp",class:"btn btn-default",text:pdpStrResources.btnCancel,click:function(){e.dialog("close")}},{id:"btnAddToProject",class:"btn btn-primary",text:pdpStrResources.AddToProject,click:function(){AddToProjectClick()}},{id:"btnCloseAtp",class:"btn btn-default hidden-for-js",text:pdpStrResources.btnClose,click:function(){e.dialog("close")}}]})}function AtpListChange(){var e=$("select#ddlProjects").val();e.toLowerCase()==="newproject"?$("div#project-name").show():($("input#ProjectName").val(""),$("div#project-name").hide())}function AtpQtyChange(){var s,o,n=Number($('input[id="QuantityForAddToProject"]').val()),e=Number($("input:hidden[name=FullReelQtyForAddToProject]").val()),t=Number($("input:hidden[name=MinQtyForAddToProject]").val());IsValid(n)&&IsPositiveInteger(n)&&IsValid(e)&&IsPositiveInteger(e)&&e>1&&IsValid(t)&&IsPositiveInteger(t)&&t>0?($("div#pdp-proj-pack-options").show(),t>1&&t===e?($("div#pdp-proj-pack-full-qty").show(),$("div#pdp-proj-pack-rads").hide()):n%e===0?($("div#pdp-proj-pack-full-qty").show(),$("div#pdp-proj-pack-rads").hide()):($("div#pdp-proj-pack-full-qty").hide(),$("div#pdp-proj-pack-rads").show(),s=$("input:hidden[name=CutTapeRadioTextForAddToProject]").val(),o=$("input:hidden[name=MouseReelRadioTextForAddToProject]").val(),n>e&&(s=$("input:hidden[name=FullReelOrAmmoAndCutTapeTextForAddToProject]").val(),o=$("input:hidden[name=FullReelOrAmmoAndMouseReelTextForAddToProject]").val()),$("span#spanProjPackCutTapeForAddToProject").text(s),$("span#spanProjPackMouseReelForAddToProject").text(o))):$("div#pdp-proj-pack-options").hide()}function NotesDialog(){var e,t,n,s=LoginCheck();if(!s)return!1;e=$("input:hidden[name=MouserPartNumFormattedForInfoActionBar]").val(),t="/Product/Product/NotesDialog?mouserPartNumber="+encodeURIComponent(e),n=$("#divNotesDialog").load(t),n.dialog("open")}function SaveNotesClick(){PdpSpinnerOpen(),$.ajax({url:"/Product/Product/SaveProductNotes",type:"POST",data:$("#formSaveProductNotes").serialize(),success:function(e){$("#formSaveProductNotes").html(e)}}).done(function(){$("#notes-saved-msg, #notes-saved-err").delay(5e3).fadeOut(1e3)});var e=$("input:hidden[name=myNotesTextForInfoActionBar]").val(),t=$("textarea#ProductNoteText").val();IsValid(t)&&t.length>0&&(e+=" (1)"),$("span#spanNotesDialogText").text(e),PdpSpinnerClose()}function CreateNotesDialog(){var e=$("#divNotesDialog");e.dialog({dialogClass:"notesStyle",title:pdpStrResources.MyNotes,resizable:!1,modal:!0,width:GetResponsiveModalWidth(510),height:GetResponsiveModalHeight(400),autoOpen:!1,buttons:[{id:"btnCancelNotes",class:"btn btn-default",text:pdpStrResources.btnCancel,click:function(){e.dialog("close")}},{id:"btnSaveNotes",class:"btn btn-primary",text:pdpStrResources.btnSave,click:function(){SaveNotesClick()}}]})}function RedirectNewTab(e){var t=window.open(e);t?t.focus():alert("Please allow popups from Mouser")}function OpenModal(e){var t=$(window).outerHeight()-200,n=e+(e.indexOf("?")>-1?"&isModalView=true":"?isModalView=true");$("#rohsModal").modal("show"),$.get(n).done(function(e){$(".rohs-modal-content").html(e),$(".rohs-modal-content").find(".modal-body").css("max-height",t+"px"),$("#modalLoadingImg").hide(),$("#rohsModal").trigger("modal:loaded")}).fail(function(){$(".rohs-modal-content").html(""),$("#modalLoadingImg").hide()})}function ShowAlternate(e,t,n){return ga("send","event",{eventCategory:"Alternate Product Click",eventAction:t,eventLabel:n}),tb_remove(),window.location=e,!0}function CollapseSelectModules(){var t=$("a.collapseThis, button.collapseThis"),e=$("div.collapseThis");t.removeClass("collapseThis"),t.addClass("collapsed"),t.prop("aria-expanded",!1),e.removeClass("collapseThis"),e.removeClass("in"),e.attr("style","height: 0px;"),e.prop("aria-expanded",!1)}function SetShowSimilarMessaging(e){e<0?($(".lblShowSimilarProductsFound-fsu").text(""),$(".specs-success-msg").hide(),$(".specs-info-msg").hide(),$(".specs-danger-msg").show(),$("#btnSearchSimilar").prop("disabled",!0),$("#btnSearchSimilar").addClass("disabled"),$("#btnSearchSimilar").attr("aria-disabled","true")):e===0?($(".lblShowSimilarProductsFound-fsu").text(e),$(".specs-info-msg").hide(),$(".specs-success-msg").show(),$(".inShowSimilarProducts").hide(),$(".specs-danger-msg").hide(),$("#btnSearchSimilar").prop("disabled",!0),$("#btnSearchSimilar").addClass("disabled"),$("#btnSearchSimilar").attr("aria-disabled","true"),SendGaForFindSimilar(null)):($(".lblShowSimilarProductsFound-fsu").text(e),$(".specs-info-msg").hide(),$(".specs-success-msg").show(),$(".inShowSimilarProducts").show(),$(".specs-danger-msg").hide(),$("#btnSearchSimilar").prop("disabled",!1),$("#btnSearchSimilar").removeClass("disabled"),$("#btnSearchSimilar").attr("aria-disabled","false"))}function UpdateCadModelDisplay(){if($('[id="lnk_CadModel"]').length===2&&$("img.cad-icon").length>0){$('[id="lnk_CadModel"]')[1].remove();var e=$("img.cad-icon").attr("src");$("img.cad-icon").first().attr("src",e.replace("&lbl=0","&lbl=1").replace("&q3=0","&q3=1")).attr("style","width:auto;max-width:none;height:28px"),$('[id="lnk_CadModel"]').parent("div").parent("div").append('<div class="col-xs-12" style="padding-top:10px;padding-bottom:10px">Download the free <a href="http://mouser.componentsearchengine.com/pcb-libraries.php">Library Loader</a> to convert this file for your ECAD Tool.</div>')}}function FindSimilarUsingLw(e){var t="",s=0,n=null;if($(".find-similar:checked").each(function(e,o){var a=$(o).attr("fieldname"),i=a?.split(":");a&&i?.[0]&&i?.[1]&&(n!==null?i[0]!==n?(t+="||",t+=a):(t+="~~",t+=i[1]):t+=a,s+=1,n=i[0])}),t&&(t+="||"),$("#attributesSelected").html(s.toString()),t===""&&e!=="init"){SetShowSimilarMessaging(-1);return}e!=="init"&&($(".find-similar").is(":visible")&&PdpSpinnerOpen(),t+=$(".product-class-name-hidden").val()+"||",t+=enableInStockDim,LwGetMatchCountFromProductSvc(t,"","",!0),SpecificationSpinnerClose())}function FocusSpecificationCheckbox(){var e=document.querySelectorAll(".find-similar");e.forEach(function(e){e.addEventListener("change",function(){spec_Checkbox_FocusElement=e})})}function LwGetMatchCountFromProductSvc(e,t,n,s){var o=$("#InStock").val()?$("#InStock").val().toUpperCase():"N",i={parameters:{FieldNameAndValues:e}};$.ajax({url:"/productservice.svc/json/LwGetSimilarProductsCount?qs=PleaseLetMeInMouser",type:"POST",dataType:"json",contentType:"application/json; charset=utf-8",data:JSON.stringify(i),success:function(e){var i=parseInt(e);s?(i!==0&&o=="Y"&&(i=i-1),SetShowSimilarMessaging(i)):ga("send","event","PDP Find Similar",t,n,i)},error:function(){s&&SetShowSimilarMessaging(-1)}})}function SendGaForFindSimilar(e){var n,o,c,i="",t="",a=[],r=[],s=[];typeof e!="undefined"&&e!==null&&window.isGA4PDPEnabled&&($('tr[id^="pdp_specs_SpecList"]').each(function(e,t){var n,o,i,c=$(t).find('input[id^="SpecList_chkbox"]').prop("checked");c&&(o='input[id^="SpecList_'+e+'__FieldNameAndValue"]',i=$(t).find(o).val(),n=i.split(":"),a.push(n[0]),r.push(n[1]),s.push(e+1))}),n="",e.toLowerCase()==="toplink"?n="pdp_show_similar_top_link":e.toLowerCase()==="bottomlink"&&(n="pdp_show_similar_bottom_button"),window.dataLayer.push({event:n,event_parametric_names:a.join("|").toLowerCase(),event_parametric_values:r.join("|"),event_parametric_index:s.join("|"),event_parametric_filter_count:s.length.toString()})),$(".find-similar").each(function(e,n){var s=$(n).prop("checked")?"Y":"N";e===1?i=$(n).attr("attrgrpname")+"|"+s:t+=$(n).attr("attrgrpname")+":"+s+"|"}),c=t.endsWith("|")?t.substring(0,t.length-1):t,o=$(".lblShowSimilarProductsFound-fsu:first").text(),o!==""&&ga("send","event","PDP Find Similar",i,c,o)}function BindProductAlternatesEvents(){var e=$("#popoupCompareWithCurrentPart").attr("data-rendertype");$("#popoupCompareWithCurrentPart").on("click",function(){window.isGA4PDPEnabled&&window.dataLayer.push({event:"product_compare_similar_product_modal_opened"})}),ResizeBootstrapCompareProductModal(),$(".compare-product-modal-qty").bind("input qtylink",function(){var n=!1,t=0;$(".compare-product-modal-qty").each(function(){CheckValidQuantityComparePartModalButton($(this).attr("id"),$(this).attr("data-validation-text-span-id"))&&$(this).val()!=""&&t++}),($(".compare-product-modal-qty").length===t||t>0)&&(n=!0),$("#compareProductModalAddToCart").prop("disabled",!n)}),$("#compareProductsModal").on("show.bs.modal",function(){$(this).find('.compare-product-modal-buy-pack-opt[value="CutTape"]').prop("checked",!0),$(this).find(".compare-product-modal-qty").each(function(){$(this).val(""),$(this).removeClass("input-validation-error")}),$(this).find(".compare-product-validation-msg").each(function(){$(this).hide(),$(this).removeClass("field-validation-error")}),$(this).find('div[id^="pdp-product-pack-options"').hide(),$(this).find('div[id^="pdp-buy-pack-full-qty"]').hide(),$(this).find('div[id^="pdp-buy-pack-rads"]').hide(),$(this).find('div[class*="pdp-product-unit-extend-price"').hide(),$("#compareProductModalAddToCart").prop("disabled",!0)})}function ResizeBootstrapCompareProductModal(){$("#compareProductsModal").find(".modal-body").css("max-height",$(window).outerHeight()-170+"px")}function BindProductAddToCompare(){$("#chkAddToCompare").on("click",function(){AddRemoveCompareList()}),$("#btnAddToCompare").on("click",function(){return AddToCompareList(),window.open("/Compare","_self"),!1})}function BindProductInfo(){$("#importantInfoPopupLink").on("click",function(e){return e.preventDefault(),ImportantInfoPopup(e.target.href),!1}),$("#productUpdatePopupLink").on("click",function(e){return e.preventDefault(),ProductUpdatePopup(e.target.href),!1}),BindProductAddToCompare()}function BindProductSpecs(){$("#FindSimilarPnl").length>0&&(FindSimilarUsingLw("init"),$(".find-similar").on("click",function(){FindSimilarUsingLw(null)}))}function BindProductBreadcrumb(){$("#feedbackModal").on("show.bs.modal",function(){typeof grecaptcha!="undefined"&&grecaptcha.reset(),$("#divSubmitFailure").addClass("hidden"),$("#divSubmitSuccess").addClass("hidden"),$("#divMain").removeClass("hidden"),$("#btnFeedbackSubmit").removeClass("hidden"),$(".errorType").prop("checked",!1),$("#FeedbackText").val(""),$("#EmailAddress").val(""),$("#ErrorTypesValidationMessage").addClass("hidden"),$("form").validate().resetForm()}),$(".errorType").on("change",function(){$(".errorType:checkbox:checked").length>0?$("#ErrorTypesValidationMessage").addClass("hidden"):$("#ErrorTypesValidationMessage").removeClass("hidden")}),$("#feedbackForm").on("submit",function(e){e.preventDefault();var n,s,o,i,t=!1;$("#divSubmitFailure").addClass("hidden"),$("#divSubmitSuccess").addClass("hidden"),n=typeof grecaptcha!="undefined"?grecaptcha.getResponse():"success",n===""?$("#CaptchaValidationMessage").removeClass("hidden"):($("#CaptchaValidationMessage").addClass("hidden"),t=!0),t&&($(".errorType:checkbox:checked").length>0?$("#ErrorTypesValidationMessage").addClass("hidden"):($("#ErrorTypesValidationMessage").removeClass("hidden"),t=!1)),t&&$("#feedbackForm").valid()&&(s=JSON.stringify($("input.errorType[type=checkbox]").serializeArray()),o=$("#IsBomRequest").val().toString(),i=$('input[name="__RequestVerificationToken"]',"#feedbackForm").val(),$.ajax({type:"POST",dataType:"json",cache:!1,url:$("#feedbackForm").attr("action"),data:{__RequestVerificationToken:i,productId:encodeURIComponent($("#ProductNumber").val()),errorTypes:encodeURIComponent(s),comments:encodeURIComponent($("#FeedbackText").val()),email:encodeURIComponent($("#EmailAddress").val()),isBomRequest:encodeURIComponent(o),referrerUrl:encodeURIComponent($("#ReferrerUrl").val())},success:function(e){e.success?($("#divMain").addClass("hidden"),$("#divSubmitSuccess").removeClass("hidden"),$("#divSubmitSuccess").html(e.message),$("#btnFeedbackSubmit").addClass("hidden")):($("#divSubmitFailure").removeClass("hidden"),$("#divSubmitFailure").html(e.message))},error:function(e,t,n){$("#divSubmitFailure").removeClass("hidden"),$("#divSubmitFailure").html(n)}}))})}function BindProductDocuments(){$("#DocTypesSelection").on("change",function(){ShowDocs()}),$(".docs-show-all").on("click",function(){DocsShowAll=!1,ShowDocs()}),$(".docs-show-less").on("click",function(){DocsShowAll=!0,ShowDocs()})}function BindProductEnvironmentalDocuments(){$("#collapseEnvDocs").on("show.bs.collapse",function(){LoadEnvironmentalDocuments()}),$("#collapseEnvDocs").on("hide.bs.collapse",function(){ga("send","event","IHS Environmental Documents","Dropdown Interaction","Closed")})}function BindPDPModalsAccessible(){var e=[];$("#packagingModal,#compareProductsModal,#compareProductPackagingModal,#QuickViewPopupModal,#REACHSVHCModal").on("shown.bs.modal",function(t){var n=Array.prototype.slice.call($(t.target).find("a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled])").filter(":visible"));e.push({modal:$(t.target),firstFocusableEl:n[0],lastFocusableEl:n[n.length-1],lastFocusedElement:document.activeElement}),n&&n.length>0&&n[0].focus()}),$("#rohsModal").on("modal:loaded",function(t){var n=Array.prototype.slice.call($(t.target).find("a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled])").filter(":visible"));e.push({modal:$(t.target),firstFocusableEl:n[0],lastFocusableEl:n[n.length-1],lastFocusedElement:document.activeElement}),n&&n.length>0&&n[0].focus()}),$("#packagingModal,#compareProductsModal,#compareProductPackagingModal,#rohsModal, #QuickViewPopupModal,#REACHSVHCModal").on("hidden.bs.modal",function(){var n=e.pop();n&&n.lastFocusedElement&&n.lastFocusedElement.length>0&&n.lastFocusedElement.focus()}),$("#packagingModal,#compareProductsModal,#compareProductPackagingModal,#rohsModal,#QuickViewPopupModal,#REACHSVHCModal").on("keydown",function(t){var n,s=9;if(e.length>0)switch(n=e[e.length-1],t.keyCode){case s:t.shiftKey?document.activeElement===n.firstFocusableEl&&(t.preventDefault(),n.lastFocusableEl.focus()):document.activeElement===n.lastFocusableEl&&(t.preventDefault(),n.firstFocusableEl.focus());break}})}function BindShippingModal(){var e;$("body").on("shown.bs.modal","#shippingInstructionsModal",function(){e=document.activeElement}),$("body").on("hidden.bs.modal","#shippingInstructionsModal",function(){e&&e.focus()})}function BindFactoryPackQtyModal(){var e,t,n;$("body").on("shown.bs.modal","#factoryPackQtyModal",function(){t=document.activeElement;var s=$("#factoryPackQtyModal").find('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]'),s=Array.prototype.slice.call(s);e=s[0],n=s[s.length-1],e.focus()}),$("body").on("hidden.bs.modal","#factoryPackQtyModal",function(){t.length>0&&t.focus()}),$("body").on("keydown","#factoryPackQtyModal",function(t){var s=9;switch(t.keyCode){case s:t.shiftKey?document.activeElement===e&&(t.preventDefault(),n.focus()):document.activeElement===n&&(t.preventDefault(),e.focus())}})}function BindAddToProject(){$("select#ddlProjects").on("change",function(){AtpListChange()}),$("input#QuantityForAddToProject").on("keyup",function(){AtpQtyChange()})}function BindRohsModal(){var e;$("body").on("show.bs.modal","#rohsModal",function(){e=document.activeElement}),$("body").on("modal:loaded","#rohsModal",function(){$("body").addClass("noprint"),$(".rohs-modal-content").addClass("printable")}),$("body").on("hidden.bs.modal","#rohsModal",function(){typeof e!="undefined"&&e.focus(),$("body").removeClass("noprint"),$(".rohs-modal-content").removeClass("printable")})}reachGa4dataAttribute=$("#btnREACHSVHC").attr("data-ReachGa4Val");function BindREACHSVHCModal(){$("#REACHSVHCModal .close").on("click",function(){reachModalClosedByXButton=!0});var t,e=decodeURIComponent(reachGa4dataAttribute);$("#REACHSVHCModal").on("keydown",function(e){if(e.key==="Escape"){reachModalClosedByXButton=!1;var t="reach_modal_closed_esc";n(t),reachIsESCKeyHandled=!0}}),$("body").on("show.bs.modal","#REACHSVHCModal",function(){t=document.activeElement,$("body").addClass("noprint"),$(".reach-svhc-content").addClass("printable"),reachIsESCKeyHandled=!1,e!==null&&e!==""&&eval(e)}),$("body").on("hidden.bs.modal","#REACHSVHCModal",function(){if(reachIsESCKeyHandled==!1){var e=reachModalClosedByXButton?"reach_modal_closed_x":"reach_modal_closed_outside";n(e),reachModalClosedByXButton=!1}typeof t!="undefined"&&t.focus(),$("body").removeClass("noprint"),$(".reach-svhc-content").removeClass("printable")}),$(".modal-footer #REACHSVHCPrintView").on("click",function(){var e="reach_modal_print_view";n(e),window.print()});function n(t){if(e!==null&&e!==""){var n=e.replace('"event":"reach_modal_opened"','"event":"'+t+'"');n&&eval(n)}}}function MoveElementContents(e,t){var n=$("#"+e),s=$("#"+t);IsValid(n)&&IsValid(n.contents())&&IsValid(s)&&n.appendTo(s)}function SetContainerHeight(){var e=0;$("#pdpRightColumn>div").each(function(t,n){e+=$(n).outerHeight(!0)}),$("#pdpMainContentDiv").css("min-height",e)}function MoveNewestProducts(){$(window).width()<992?MoveElementContents("pdpNewestProds","pdpLeftColumn2"):(MoveElementContents("pdpNewestProds","pdpRightColumn"),SetContainerHeight())}function BindEvents(){BindProductAlternatesEvents(),BindProductInfo(),BindProductSpecs(),BindProductBreadcrumb(),BindPDPModalsAccessible(),BindFactoryPackQtyModal(),BindShippingModal(),BindRohsModal(),BindREACHSVHCModal(),BindAddToProject(),BindProductDocuments(),FocusSpecificationCheckbox(),BindProductEnvironmentalDocuments(),$(window).on("resize",function(){MoveNewestProducts(),ResizeBootstrapCompareProductModal()})}function GetUrlVars(){for(var e,t=[],s=window.location.href.slice(window.location.href.indexOf("?")+1).split("&"),n=0;n<s.length;n++)e=s[n].split("="),t.push(e[0]),t[e[0]]=e[1];return t}function RefreshData(e){try{var t,n,r=readCookie("Feature_PDPCaching_Enable"),s=$("input:hidden[name=ProductQs]").val(),o=GetUrlVars().vip==="1"?"true":"false",i=(t=GetUrlVars().countryCode)!==null&&t!==void 0?t:"",a=(n=GetUrlVars().currencyCode)!==null&&n!==void 0?n:"";$("#chkAddToCompare").prop("checked")!==$("#lblCompareProduct").hasClass("hidden")&&CheckProductInCompareSet(),enableNewestData||r==="1"?$.ajax({type:"GET",url:"/Product/Product/GetProductInfoPartialViews?qs="+s+"&isVip="+o+"&countryCode="+i+"¤cyCode="+a,success:function(t){t!==null&&($("#pdpPricingAvailability").replaceWith(t.pricingAndAvailabilityResult),BindProductPricingAvailability(),typeof BindAooPopup!="undefined"&&typeof BindAooPopup=="function"&&BindAooPopup(),BuyQtyChange($('input[id="BuyQty"]').val("")),$(".pdp-customer-part-num").html(t.customerPartNumber),$(".real-time-ship text-right").html(t.shippingCutOffMessage)),e()},error:function(){e()}}):e()}catch{}}function LoadEvents(){try{MoveNewestProducts()}catch{}try{ShowDocs()}catch{}try{CollapseSelectModules()}catch{}try{CreateNotesDialog()}catch{}try{CreateProjectDialog()}catch{}}$(document).ready(function(){RefreshData(function(){populateLwSimilarProducts(function(){displaySimilarProductAvailability()})}),UpdateCadModelDisplay(),LoadEvents();try{BindEvents()}catch{}String.prototype.endsWith||(String.prototype.endsWith=function(e,t){return(t===void 0||t>this.length)&&(t=this.length),this.substring(t-e.length,t)===e})})