1const initializeViews = () => { 2 const viewed_ls = localStorage.getItem("viewed"); 3 const viewed = viewed_ls ? JSON.parse(viewed_ls) : []; 4 const post_id = document.querySelector("#main article").id.replace("post-", ""); 5 6 if (!viewed.includes(post_id)) { 7 viewed.push(post_id); 8 localStorage.setItem("viewed", JSON.stringify(viewed)); 9 10 fetch('/wp-json/generateperf/update_views/', { 11 method: "POST", 12 headers: { 13 'Content-Type': 'application/json' 14 }, 15 body: JSON.stringify({post_id}) 16 }) 17 .then(response => response.json()) 18 .then(data => {}) 19 .catch(error => {}); 20 } 21}; 22 23if (document.readyState !== "loading") { 24 setTimeout(initializeViews, 3000); 25} else { 26 document.addEventListener("DOMContentLoaded", () => setTimeout(initializeViews, 3000)); 27}
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.