1(function($) { 2 $(window).on('CACHE_DATA_READY', function () { 3 4 let replacements = { 5 product: getUrlParameter('product'), 6 store: getUrlParameter('store'), 7 state: '' 8 }; 9 10 const updateText = (text) => { 11 12 if (!text) { 13 return text; 14 } 15 16 Object.entries(replacements).forEach(([key, value]) => { 17 if(key === 'product') { 18 const products = allProducts.products; 19 const productInfo = products.find((product) => product.name == value); 20 if(productInfo) { 21 value = productInfo.displayName; 22 } 23 } 24 else if(key === 'store') { 25 const locations = JSON.parse(sessionStorage.getItem('ls.allLocations')); 26 if(locations) { 27 const locationInfo = locations.find((location) => location.uniqueName == value); 28 if(locationInfo) { 29 value = locationInfo.name; 30 replacements.state = locationInfo?.address?.city+ ' '+ locationInfo?.address?.state; 31 } 32 } 33 } 34 if (value) { 35 text = text.replaceAll(`{${key}}`, value); 36 } 37 38 }); 39 40 return text; 41 }; 42 43 // Update title 44 document.title = updateText(document.title); 45 46 // Meta selectors 47 [ 48 'meta[name="description"]', 49 'meta[property="og:title"]', 50 'meta[property="og:description"]', 51 'meta[name="twitter:description"]', 52 'meta[name="twitter:title"]' 53 ].forEach(selector => { 54 55 const $el = $(selector); 56 57 if (!$el.length) { 58 return; 59 } 60 61 const content = $el.attr('content'); 62 63 $el.attr('content', updateText(content)); 64 65 }); 66 67 }); 68})(jQuery);
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.