1 2 try { 3 if (window.eComEventTarget) { 4 window.eComEventTarget.addEventListener('cart:add', function (event) { 5 if (XMLHttpRequest) { 6 var xhr = new XMLHttpRequest(), 7 registerUrl = event.detail.cart.registerSessionUrl; 8 xhr.open('GET', registerUrl, true); 9 10 xhr.addEventListener('load', function () { 11 if (xhr.status > 200 || xhr.status >= 300) { 12 console.warn(xhr.statusText, xhr.responseText); 13 } 14 }); 15 16 xhr.send(); 17 } 18 }) 19 } 20} catch (ex) { 21 console.log(ex); 22} 23 24 25 26 27 try { 28 if (window.eComEventTarget) { 29 window.eComEventTarget.addEventListener('wishlist:add', function (event) { 30 if (XMLHttpRequest) { 31 var xhr = new XMLHttpRequest(), 32 product = event.detail.product, 33 targetUrl = 'https://www.somashop.fi/epages/soma-shop.sf' + '?ViewAction=JSONViewResponse&ChangeAction=JSONAddItemToShoppingList', 34 data = { 35 'ProductGUID': product.productId, 36 'Quantity': product.quantity, 37 'LineItemGUID': event.detail.lineItemId, 38 'CustomizedText': product.customizedText, 39 'LocaleID': event.detail.locale 40 }; 41 42 xhr.open('POST', targetUrl, true); 43 xhr.setRequestHeader('Content-Type', 'application/json') 44 45 xhr.addEventListener('load', function () { 46 if (xhr.status < 200 || xhr.status >= 300) { 47 console.warn(xhr.statusText, xhr.responseText); 48 } else { 49 var response = JSON.parse(xhr.responseText) 50 51 52 if (response.success) { 53 window.eComEventTarget.dispatchEvent(new CustomEvent('wishlist:success-' + response.productId, { 'detail': response })); 54 window.eComEventTarget.dispatchEvent(new CustomEvent('wishlist:success-' + response.lineItemId, { 'detail': response })); 55 } else if (response.reason === 'nouser') { 56 window.eComEventTarget.dispatchEvent(new CustomEvent('wishlist:nouser-' + response.productId, { 'detail': response })); 57 window.eComEventTarget.dispatchEvent(new CustomEvent('wishlist:nouser-' + response.lineItemId, { 'detail': response })); 58 } else { 59 console.warn(xhr.statusText, xhr.responseText); 60 } 61 62 63 } 64 }); 65 xhr.send(JSON.stringify(data)); 66 } 67 }) 68 } 69} catch (ex) { 70 console.log(ex); 71} 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
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.