1class Dal { 2 populateLabels() { 3 const self = this; 4 let ids = []; 5 let idsCount = {}; 6 let elements = document.querySelectorAll('[data-ajax_target="dal-product-labels"]') 7 elements.forEach(element => { 8 let pid = element.getAttribute("data-label-id"); 9 if(pid && !ids.includes(pid)) { 10 idsCount[pid] = element.getAttribute("data-label-count"); 11 ids.push(pid); 12 } 13 }); 14 self.loadLabels(ids, idsCount); 15 } 16 17 populateDetailLabel() { 18 const self = this; 19 gca.waitForElement("#main-carousel").then(function () { 20 gca.waitForElement('#productGalleryWrapper [data-ajax_target="dal-product-labels"]').then(function () { 21 let target = document.querySelector('#productGalleryWrapper [data-ajax_target="dal-product-labels"]'); 22 if(target) { 23 let pid = target.getAttribute("data-label-id"); 24 let ids = [pid]; 25 let idCount = {}; 26 idCount[pid] = target.getAttribute("data-label-count"); 27 // Clear all before load, to prevent duplicates for same pid already loaded in product lists (on product page). 28 document.querySelectorAll('[data-label-id="' + pid + '"][data-ajax_target="dal-product-labels"]').forEach(el => el.innerHTML = ''); 29 self.loadLabels(ids, idCount); 30 } 31 }) 32 }); 33 } 34 35 loadLabels(ids, idsCount) { 36 if(ids.length > 0) { 37 jQuery.ajax({ 38 url: "/dal-ext-ajax.vm?action=getProductLabels&ids=" + ids, 39 cache: false, 40 type: "get", 41 dataType: "html" 42 }).done(function(data) { 43 let htmlContent = jQuery.parseHTML(data); 44 let labels = $(htmlContent).find(".dal-product-labels"); 45 labels.each(function(i, el) { 46 let countClass = "num_" + idsCount[el.id]; 47 let targets = document.querySelectorAll("div[data-ajax_target='dal-product-labels'][data-label-id='"+el.id+"']"); 48 targets.forEach(target => { 49 el.querySelector(".product-label-special").classList.add(countClass.toString()) 50 target.innerHTML = target.innerHTML + el.innerHTML; 51 }); 52 idsCount[el.id] = Number(idsCount[el.id]) + 1; 53 }) 54 55 }) 56 } 57 } 58 59 clearMultipleToBasketArea() { 60 document.getElementById("quickCartInput").value = ""; 61 } 62 63 autoSelectSingleVariantOption() { 64 if(allSelectors && typeof allSelectors !== 'undefined') { 65 allSelectors.forEach(selector => { 66 if(selector.options.length === 1) { 67 let name = selector.name; 68 let value = selector.options[0].value 69 let optionElement = document.querySelector('[data-selector="' + name + '"][data-option="' + value + '"]' ); 70 optionElement.click(); 71 } 72 }) 73 } 74 } 75 76 search() { 77 const searchQueryValue = Array.from(document.querySelectorAll('input[name="q"]')).find(input => input.value.trim() !== '')?.value || ''; 78 window.location.href = '/search?action=search&q=' + searchQueryValue; 79 } 80} 81 82const dal = new Dal();
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.