1function ajaxLoad(url, selector) { 2 let section = document.querySelector(selector); 3 if(!section) return; 4 section.classList.add('requesting'); 5 6 7 fetch(url) 8 .then(response => response.text()) 9 .then(data => { 10 const parser = new DOMParser(); 11 const htmlDoc = parser.parseFromString(data, 'text/html'); 12 13 const newContent = htmlDoc.querySelector(selector); 14 const currentList = document.querySelector(selector); 15 if (newContent && currentList) { 16 currentList.innerHTML = newContent.innerHTML; 17 } 18 19 section.classList.remove('requesting'); 20 }); 21} 22function packageAjaxLoad(url, selector, selectors) 23{ 24 let section = document.querySelector(selector); 25 if(!section) return; 26 section.classList.add('requesting'); 27 28 document.querySelector(selector).scrollIntoView({ 29 behavior: 'smooth', 30 block: 'start' 31 }); 32 33 return new Promise((resolve, reject) => { 34 fetch(url) 35 .then(response => response.text()) 36 .then(data => { 37 const parser = new DOMParser(); 38 const htmlDoc = parser.parseFromString(data, 'text/html'); 39 40 selectors.forEach(selector => { 41 const newEl = htmlDoc.querySelector(selector); 42 const currentEl = document.querySelector(selector); 43 if (newEl && currentEl) { 44 currentEl.innerHTML = newEl.innerHTML; 45 } 46 }); 47 48 section.classList.remove('requesting'); 49 resolve(); 50 }); 51 }); 52} 53function ajaxMore(url, selector, itemsSelector) { 54 let section = document.querySelector(selector); 55 if(!section) return; 56 section.classList.add('requesting'); 57 58 59 fetch(url) 60 .then(response => response.text()) 61 .then(data => { 62 const parser = new DOMParser(); 63 const htmlDoc = parser.parseFromString(data, 'text/html'); 64 65 const newItems = htmlDoc.querySelectorAll(itemsSelector); 66 const fragment = document.createDocumentFragment(); 67 68 newItems.forEach(item => { 69 fragment.appendChild(item); 70 }); 71 72 section.appendChild(fragment); 73 74 const newContent = htmlDoc.querySelector('[data-page]'); 75 const currentContent = document.querySelector('[data-page]'); 76 if (newContent && currentContent) { 77 currentContent.outerHTML = newContent.outerHTML; 78 } 79 else { 80 currentContent.remove(); 81 } 82 83 //window.lazyLoading(); 84 section.classList.remove('requesting'); 85 }); 86}
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.