1(function () { 2 if (window.top === window.self) return; 3 4 const MESSAGE_TYPE = "gm-wordpress-embed"; 5 let frame = 0; 6 7 function markEmbedMode() { 8 document.documentElement.classList.add("gm-embed"); 9 if (document.body) { 10 document.body.classList.add("gm-embed"); 11 } 12 } 13 14 function currentHeight() { 15 const body = document.body; 16 const candidates = body ? Array.from(body.children).filter((element) => { 17 const style = window.getComputedStyle(element); 18 if (style.display === "none" || style.visibility === "hidden") return false; 19 if (style.position === "fixed") return false; 20 return true; 21 }) : []; 22 const contentBottom = candidates.reduce((max, element) => { 23 const rect = element.getBoundingClientRect(); 24 return Math.max(max, rect.bottom + window.scrollY); 25 }, 0); 26 const main = document.querySelector("main"); 27 const mainBottom = main 28 ? main.getBoundingClientRect().bottom + window.scrollY 29 : 0; 30 31 return Math.ceil(Math.max(contentBottom, mainBottom, 0)); 32 } 33 34 function post(reason) { 35 window.cancelAnimationFrame(frame); 36 frame = window.requestAnimationFrame(() => { 37 window.parent.postMessage( 38 { 39 type: MESSAGE_TYPE, 40 reason: String(reason || "update"), 41 href: window.location.href, 42 path: `${window.location.pathname}${window.location.search}${window.location.hash}`, 43 title: document.title || "", 44 height: currentHeight(), 45 }, 46 "*" 47 ); 48 }); 49 } 50 51 function boot() { 52 markEmbedMode(); 53 post("boot"); 54 55 window.addEventListener("load", () => post("load")); 56 window.addEventListener("resize", () => post("resize")); 57 window.addEventListener("pageshow", () => post("pageshow")); 58 59 if ("ResizeObserver" in window && document.body) { 60 const resizeObserver = new ResizeObserver(() => post("resize-observer")); 61 resizeObserver.observe(document.body); 62 if (document.documentElement) resizeObserver.observe(document.documentElement); 63 } 64 65 if ("MutationObserver" in window && document.documentElement) { 66 const mutationObserver = new MutationObserver(() => post("mutation")); 67 mutationObserver.observe(document.documentElement, { 68 childList: true, 69 subtree: true, 70 attributes: true, 71 }); 72 } 73 74 window.setInterval(() => post("interval"), 1200); 75 } 76 77 if (document.readyState === "loading") { 78 document.addEventListener("DOMContentLoaded", boot, { once: true }); 79 } else { 80 boot(); 81 } 82})();
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.