1document.addEventListener("DOMContentLoaded", () => { 2 document.querySelectorAll(".wp-block-gutenbergp5-p5js iframe").forEach((frame) => { 3 if (frame.classList.contains("gutenbergp5-noresize")) return; 4 frame.addEventListener('load', function () { 5 p5js__resizeIframe(this); 6 }); 7 }); 8}) 9 10// let's just double it with the good ol' method to make sure it really resizes 11// right (the first method has a consistent bug on chromium-based browsers) 12// For some reason this is resolves the problem for chrome... idk why. 13jQuery(document).ready(function () { 14 let p5Iframes = document.querySelectorAll(".wp-block-gutenbergp5-p5js iframe"); 15 p5Iframes.forEach((frame) => { 16 if (frame.classList.contains("gutenbergp5-noresize")) return; 17 p5js__resizeIframe(frame); 18 }); 19}); 20 21function p5js__resizeIframe(frame) { 22 // get access to the DOM inside the iframe 23 let iframeDocument = frame.contentDocument || frame.contentWindow.document; 24 // resize iframe to fit canvas 25 const canvas = iframeDocument.querySelector("canvas"); 26 if (!canvas) { 27 setTimeout(() => p5js__resizeIframe(frame), 5); 28 return; 29 } 30 frame.width = canvas.style.width; 31 frame.height = canvas.style.height; 32 frame.setAttribute("style", "width:" + canvas.style.width + "; height:" + canvas.style.height + "; overflow: hidden;") 33}
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.