1// Toggles the responsive basket table against the full summary while scrolling. The elements come from 2// checkout/basketV3/basketVueTemplate.peb, so they exist wherever basket.js renders - the basket page above all. 3// Used to live in header.js, which the checkout does not load anymore; basketUtils.js is on every page and calls 4// it again after each basket update, so the function belongs next to that call. 5function isScrollingUp() { 6 const elemRectResp = document.querySelector(".V3-basket-table-responsive"); 7 const elemRect = document.querySelector(".full-summary"); 8 if (elemRectResp && elemRect) { 9 const offset = elemRectResp.getBoundingClientRect().top - elemRect.getBoundingClientRect().top; 10 elemRectResp.style.cssText = offset >= 30 11 ? 'visibility:hidden !important; height: 0px' 12 : 'visibility:visible !important; height: fit-content'; 13 } 14} 15document.addEventListener('DOMContentLoaded', function () { 16 isScrollingUp(); 17 window.addEventListener("scroll", isScrollingUp); 18}); 19var VueBasketUtils = { 20 formatPrice : function(price, currency) { 21 let formattedPrice = new Intl.NumberFormat(currency.locale, { minimumFractionDigits: 2, maximumFractionDigits: 2 }).format(price); 22 return formattedPrice + ' ' + currency.symbol; 23 }, 24 getBasePriceUnit: function(unitIdentifier) { 25 if (unitIdentifier === null || unitIdentifier === '1') { 26 return 'St\u00FCck'; 27 } 28 else { 29 return unitIdentifier; 30 } 31 }, 32 getLamp(item) { 33 if (item.deliveryChargeCategory != null && (item.deliveryTimeId != null || item.warehouseDeliverytimes.length > 0)) { 34 if (item.combinedStock > 0 && item.stockrelevant) { 35 return 'item_lamp_green'; 36 } 37 if (item.combinedStock == 1) { 38 return 'item_lamp_yellow'; 39 } 40 if (item.combinedStock <= 0) { 41 return 'item_lamp_red'; 42 } else { 43 return 'item_lamp_green'; 44 } 45 } else { 46 return 'item_lamp_red'; 47 } 48 }, 49 basketMutation : function(query, dispatch, vue, callfront, callback) { 50 let that = this; 51 axios.post('/servlets/addto', `todo=graph&locale=${window.APP_CONFIG.base.curLanguageId}&graphData=${query}`, { headers: {'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'}} ) 52 .then(response => { 53 if (response.status === 200) { 54 if (typeof callfront !== 'undefined' && callfront != null) { 55 if (callfront(response, vue) === 'return') { 56 return; 57 } 58 } 59 if (dispatch.itemId != null) { 60 response.data.data[dispatch.source].itemId = dispatch.itemId; 61 } 62 store.dispatch(dispatch.action, response.data.data[dispatch.source]); 63 if (document.getElementById('shoppingCartBasketSize') !== null) { 64 document.getElementById('shoppingCartBasketSize').innerText = vue.sumItems(); 65 } 66 if (document.getElementById('shoppingCartBasketTotal') !== null) { 67 document.getElementById('shoppingCartBasketTotal').innerText = that.formatPrice(vue.basket.totalCost, vue.basket.currency); 68 } 69 if (typeof callback !== 'undefined' && callback !== null) { 70 for (func of callback) { 71 func(response, vue); 72 } 73 } 74 isScrollingUp(); 75 } 76 }); 77 } 78}
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.