1document.addEventListener("DOMContentLoaded", function () { 2 const loadmoreBtn = document.getElementById("loadmore-btn"); 3 4 if (loadmoreBtn) { 5 if (archive_vars.current_page == archive_vars.max_page) { 6 loadmoreBtn.remove(); 7 } 8 9 loadmoreBtn.addEventListener("click", function () { 10 const requestData = { 11 action: "loadmore", 12 query: archive_vars.posts, 13 page: archive_vars.current_page, 14 }; 15 16 if (loadmoreBtn.dataset.type) { 17 requestData.type = loadmoreBtn.dataset.type; 18 } 19 20 const formData = new URLSearchParams(); 21 for (const key in requestData) { 22 formData.append(key, requestData[key]); 23 } 24 25 const xhr = new XMLHttpRequest(); 26 xhr.open("POST", archive_vars.ajaxurl, true); 27 xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 28 29 xhr.onloadstart = function () { 30 loadmoreBtn.setAttribute("disabled", true); 31 }; 32 33 xhr.onload = function () { 34 loadmoreBtn.removeAttribute("disabled"); 35 36 if (xhr.status >= 200 && xhr.status < 300) { 37 const responseData = xhr.responseText; 38 39 if (responseData) { 40 const container = document.getElementById("loadmore-container"); 41 42 if (container) { 43 // Создаем вÑеменнÑй ÑÐ»ÐµÐ¼ÐµÐ½Ñ Ð´Ð»Ñ Ð²ÑÑавки HTML 44 const tempDiv = document.createElement("div"); 45 tempDiv.innerHTML = responseData; 46 47 // ÐобавлÑем вÑе доÑеÑние ÑлеменÑÑ Ð² конÑÐµÐ¹Ð½ÐµÑ 48 while (tempDiv.firstChild) { 49 container.appendChild(tempDiv.firstChild); 50 } 51 } 52 53 archive_vars.current_page++; 54 55 if (archive_vars.current_page == archive_vars.max_page) { 56 loadmoreBtn.remove(); 57 } 58 } else { 59 loadmoreBtn.remove(); 60 } 61 } else { 62 console.error("ÐÑибка загÑÑзки:", xhr.status, xhr.statusText); 63 loadmoreBtn.removeAttribute("disabled"); 64 } 65 }; 66 67 xhr.onerror = function () { 68 console.error("ÐÑибка ÑеÑи пÑи вÑполнении запÑоÑа"); 69 loadmoreBtn.removeAttribute("disabled"); 70 }; 71 72 xhr.send(formData.toString()); 73 }); 74 } 75});
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.