1var dynamicYield = { 2 3 callEvent: function(eventName, params){ 4 var DYhref = '', 5 DYform = ''; 6 if(typeof params == "object"){ 7 DYhref = params.DYhref || ''; 8 DYform = params.DYform || ''; 9 } 10 11 var params = JSON.stringify(params) || ''; 12 // these properties are loaded via action call defined in isml as <span ... data-url> parameter 13 var DYGetAPIProperties = $('#sfraSpan').data('url'); 14 15 $.ajax({ 16 url: DYGetAPIProperties, 17 data: { 18 eventName: eventName, 19 params: params 20 }, 21 success: function(response) { 22 if(response.doCall){ 23 if(DY.API) { 24 DY.API('event', { 25 name: response.eventName, 26 properties: response.properties 27 }); 28 // refreshing DY Static Data - SKUs, without need to page-refresh 29 if(DY.recommendationContext.type == "CART" && response.eventName == "Remove from Cart") { 30 refreshSKUs( response ); 31 } 32 } 33 // in case of async loading 34 else { 35 document.getElementById("DY_api_static").onload = function(){ 36 DY.API('event', { 37 name: response.eventName, 38 properties: response.properties 39 }); 40 41 // refreshing DY Static Data - SKUs, without need to page-refresh 42 if(DY.recommendationContext.type == "CART" && response.eventName == "Remove from Cart") { 43 refreshSKUs( response ); 44 } 45 } 46 } 47 } 48 if(DYhref!=''){ 49 window.location.href = DYhref; 50 } 51 if(DYform!=''){ 52 DYform.trigger('submit'); 53 } 54 }, 55 error : function(e){ 56 console.log(e); 57 } 58 }); 59 } 60} 61 62function refreshSKUs( response ) { 63 64 var newCartIds = []; 65 for(var i=0; i<response.properties.cart.length; i++) { 66 newCartIds.push( response.properties.cart[i].productId ); 67 } 68 DY.API('spa', { 69 context: { 70 type: 'CART', 71 data: newCartIds 72 } 73 }); 74 return; 75}
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.