Files
Last update 2 months 4 days
by
Arnaud-Apu-Fanovard
AooPopupModal.js.téléchargementvar escapeKey=0,jsonResult="";function BindFactoryLeadTimePopover(){$("#factoryLeadTimeMsg").popover(),$(document).on("click",function(e){$('[data-toggle="popover"],[data-original-title]').each(function(){!$(this).is(e.target)&&$(this).has(e.target).length===0&&$(".popover").has(e.target).length===0&&((($(this).popover("hide").data("bs.popover")||{}).inState||{}).click=!1)})}),$(document).on("keyup",function(e){e.which===27&&$("#factoryLeadTimeMsg").popover("hide")})}function bindGa4Click(e){if(typeof ccoStrResources!="undefined"&&ccoStrResources.IsProjectView==="true"){var t=e.parents("td").prev("td").find("input[id$=ga4Data]");t.length&&t.val()&&(jsonResult=JSON.parse(t.val()),GA4DatalayerEvent(jsonResult,"proj_details_backorder_modal_open"))}}function bindGa4CartClick(e){if(typeof ccoStrResources!="undefined"&&ccoStrResources.IsSharedCartView==="true"){var t=e.parents("td").prev("td").find("input[id$=ga4Data]");t.length&&t.val()&&(jsonResult=JSON.parse(t.val()),GA4SharedCartDatalayerEvent(jsonResult,"saved_cart_backorder_modal_open"))}}function BindAooPopup(){$("a[href*='earch/include/aoopopup']").on("click",function(e){e.preventDefault();var t=0,n=0;bindGa4CartClick($(this)),bindGa4Click($(this)),$("div[id$=divLoadProgress]").css("display","block"),$.ajax({type:"GET",dataType:"html",cache:!1,url:"/Search/include/aoopopupAjax?qs="+$(this).attr("data-qs"),success:function(s){if(s){$("#modal").html(s);var a,r,c,l,d=$("#aooPopupViewModel").modal();function u(e){var t=document.getElementById(e);return t?t.value.toLowerCase():""}a=u("AooPopUp-hidden-Manufacturer"),r=u("AooPopUp-hidden-Brand"),c=u("AooPopUp-hidden-MouserPartNumber"),l=u("AooPopUp-hidden-MfrPartNumber"),$("#aooPopupViewModel .close").on("click",function(){AddGA4CartItemEventAooPopup("cart_product_backordered_modal_close",a,r,c,l),GA4SharedCartDatalayerEvent(jsonResult,"saved_cart_backorder_modal_close_x"),t=1,GA4DatalayerEvent(jsonResult,"proj_details_backorder_modal_close_x")}),$("#aooPopupViewModel .btn-link").on("click",function(){AddGA4CartItemEventAooPopup("cart_product_backordered_modal_close",a,r,c,l),GA4SharedCartDatalayerEvent(jsonResult,"saved_cart_backorder_modal_close_link"),n=1,GA4DatalayerEvent(jsonResult,"proj_details_backorder_modal_close_link")}),d.on("hidden.bs.modal",function(){$(this).data("bs.modal",null).remove(),$("#modal").hide(),e.target.focus(),n==0&&t==0&&escapeKey==0&&(AddGA4CartItemEventAooPopup("cart_product_backordered_modal_close",a,r,c,l),GA4SharedCartDatalayerEvent(jsonResult,"saved_cart_backorder_modal_close_outside"),GA4DatalayerEvent(jsonResult,"proj_details_backorder_modal_close_outside")),escapeKey==1&&(AddGA4CartItemEventAooPopup("cart_product_backordered_modal_close",a,r,c,l),GA4SharedCartDatalayerEvent(jsonResult,"saved_cart_backorder_modal_close_esc"),escapeKey=0,GA4DatalayerEvent(jsonResult,"proj_details_backorder_modal_close_esc"))}),d.on("shown.bs.modal",function(){$("div[id$=divLoadProgress]").css("display","none")}),BindFactoryLeadTimePopover(),setModalFocus(d,e.target),$("#modal").show(),d.modal("show")}else $("div[id$=divLoadProgress]").css("display","none")},error:function(){$("div[id$=divLoadProgress]").css("display","none")}})})}$(document).ready(function(){BindAooPopup()});function PrintPaaQuotes(){return dataLayer.push({event:"paa_edit_nav_print_clicked"}),$(".dropdown").removeClass("open"),window.print(),!1}function GA4DatalayerEvent(e,t){typeof ccoStrResources!="undefined"&&ccoStrResources.IsProjectView==="true"&&e&&dataLayer.push({event:t,event_manufacturer:e.event_manufacturer,event_brand:e.event_brand,event_manufacturerpn:e.event_manufacturerpn,event_mouserpn:e.event_mouserpn})}function GA4SharedCartDatalayerEvent(e,t){typeof ccoStrResources!="undefined"&&ccoStrResources.IsSharedCartView==="true"&&e&&dataLayer.push({event:t,event_manufacturer:e.event_manufacturer,event_brand:e.event_brand,event_manufacturerpn:e.event_manufacturerpn,event_mouserpn:e.event_mouserpn})}function ga4BackOrderLink(e,t,n,s){window.location.pathname.toLowerCase()==="/cart/"&&AddGA4CartItemEventAooPopup("cart_product_backordered_modal_open",e,t,n,s)}function AddGA4CartItemEventAooPopup(e,t,n,s,o){window.location.pathname.toLowerCase()==="/cart/"&&(n=n||"none",t=t||"none",dataLayer.push({event:e,event_manufacturer:t,event_brand:n,event_manufacturerpn:o,event_mouserpn:s}))}