Files
Last update 2 months 4 days
by
Arnaud-Apu-Fanovard
QuickViewModal.js.téléchargement$(document).ready(function(){BindQuickViewPopup()});function BindQuickViewPopup(){var e;$(".OpenQuickViewModalButton").click(function(){var t,n,s,o,i,a,r,c,l,d=$(".OpenQuickViewModalButton").filter(function(){return this.id&&this.id.includes("lnkQuickViewCart")}).length>0;d&&(n=$(this).attr("id"),t=n.split("_")[1],s="cart_product_quickview_open",o=$("#hiddenManufacturer_"+t).val(),i=$("#hiddenBrand_"+t).val(),a=$("#hiddenManufacturerPartNumber_"+t).val(),r=$(this).val(),HandleGA4Push(s,o,i,a,r)),e=$(this),c=$(this).attr("data-href"),$("#QuickViewPopupModal").modal("show"),l=$(".LoadingImgQuickView").html(),$("#quickViewModalContentPlaceholder").html(l),$("#quickViewModalContentPlaceholder").load(c,function(e,t){t=="error"&&$("#quickViewModalContentPlaceholder").html($("#noQuickViewProductFoundError").html()),$("#QuickViewPopupModal").modal("show"),$(".QuickViewBuyButton").click(function(){var e=$(this).attr("data-href");window.location.href=e});var s=$("#QuickViewPopupModal").parents().filter(function(){return this.id&&this.id.includes("CartQuickView")}).length>0;s&&GA4_Cart()})}),$("body").on("hidden.bs.modal",'div[id^="QuickViewPopupModal"]',function(){e&&e.focus()})}function GA4_Cart(){var e=$("#actualMfrName").val(),t=$("#manufacturerName").text(),n=$("#manufacturerNumber").text(),s=$("#mouserNum").text();$("#manufacturerNumber, .pricingTableProductLink").on("click",function(o){o.preventDefault();var i,a="cart_product_quickview_product_click";HandleGA4Push(a,e,t,n,s),i=$(this).attr("href"),window.location.href=i}),$("#QuickViewPopupModal").off("hidden.bs.modal").on("hidden.bs.modal",function(){var o="cart_product_quickview_close";HandleGA4Push(o,e,t,n,s)}),$("#datasheetLink").on("click",function(o){o.preventDefault();var a="cart_product_quickview_datasheet_download",i=$(this).attr("href");HandleGA4Push(a,e,t,n,s,i),window.open(i,"_blank")})}function HandleGA4Push(e,t,n,s,o,i){i===void 0&&(i=null);var a={event:e,event_manufacturer:t?.toLowerCase()||"none",event_brand:n?.trim().toLowerCase()||"none",event_manufacturerpn:s?.trim().toLowerCase()||"none",event_mouserpn:o?.trim().toLowerCase()||"none"};i&&(a.event_datasheet_url=i),dataLayer.push(a)}