1function media() { 2 const button = document.getElementById("getMedia"); 3 const listContainer = document.getElementById("media-list"); 4 const tableContainer = document.getElementById("media-table"); 5 6 if (!button || !listContainer || !tableContainer) return; 7 8 button.addEventListener("click", (e) => { 9 e.preventDefault(); 10 11 let currentPage = parseInt(button.dataset.number) || 1; 12 currentPage += 1; 13 button.dataset.number = currentPage; 14 15 fetch(window.wp_data.ajax_url, { 16 method: "POST", 17 headers: { 18 "Content-Type": "application/x-www-form-urlencoded", 19 }, 20 body: new URLSearchParams({ 21 action: "load_more_media_posts", 22 number: currentPage, 23 }), 24 }) 25 .then((res) => res.json()) 26 .then((data) => { 27 if (data.success) { 28 if (data.data.list_html) { 29 listContainer.insertAdjacentHTML("beforeend", data.data.list_html); 30 } 31 if (data.data.table_html) { 32 tableContainer.insertAdjacentHTML("beforeend", data.data.table_html); 33 } 34 35 if (!data.data.has_more) { 36 button.style.display = "none"; 37 } 38 } 39 }); 40 }); 41} 42 43$(document).ready(function () { 44 media(); 45});
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.