|
|
| Line 1: |
Line 1: |
| /* Any JavaScript here will be loaded for all users on every page load. */ | | /* Any JavaScript here will be loaded for all users on every page load. */ |
|
| |
|
| |
| (function(){
| |
| const SEL='#Iframe1,iframe[data-src*="/jonesfamilyfarmsrecordings"],iframe[src*="/jonesfamilyfarmsrecordings"]';
| |
| function setH(i,h){const px=Math.max(200,Math.floor(h||0))+'px';if(i.style.height!==px)i.style.height=px;i.removeAttribute('height');i.setAttribute('scrolling','no');}
| |
| function measure(i){try{const d=i.contentDocument||i.contentWindow?.document;if(!d)return false;const f=()=>{const b=d.body,e=d.documentElement;const h=Math.max(b.scrollHeight,b.offsetHeight,e.clientHeight,e.scrollHeight,e.offsetHeight);setH(i,h);};const r=new ResizeObserver(f);r.observe(d.documentElement);r.observe(d.body);i.addEventListener('load',f);window.addEventListener('resize',f);f();return true;}catch{return false;}}
| |
| function cross(i){window.addEventListener('message',e=>{const d=e.data;if(!d||typeof d!=='object')return;if(d.type==='wikiphone:height'&&typeof d.height==='number')setH(i,d.height);});const ping=()=>{try{i.contentWindow?.postMessage({type:'wikiphone:getHeight'},'*');}catch{}};i.addEventListener('load',()=>{setH(i,400);let n=0;const t=setInterval(()=>{ping();if(++n>=20)clearInterval(t);},500);});setInterval(ping,1500);}
| |
| function style(i){i.style.display='block';i.style.width='100vw';i.style.maxWidth='100%';i.style.marginLeft='calc(-50vw + 50%)';i.style.border='0';i.style.overflow='hidden';i.setAttribute('scrolling','no');i.removeAttribute('height');i.removeAttribute('width');}
| |
| function wire(i){if(i.__wired)return;i.__wired=true;style(i);const mo=new MutationObserver(()=>{if(i.getAttribute('src')||i.getAttribute('data-src'))style(i);});mo.observe(i,{attributes:true});const ok=measure(i);if(!ok)cross(i);let t=0;const tick=setInterval(()=>{style(i);if(i.getAttribute('src'))clearInterval(tick);if(++t>60)clearInterval(tick);},250);}
| |
| function find(){document.querySelectorAll(SEL).forEach(wire);}
| |
| if(document.readyState==='loading'){document.addEventListener('DOMContentLoaded',find);}else{find();}
| |
| const obs=new MutationObserver(find);obs.observe(document.documentElement,{childList:true,subtree:true});
| |
| })();
| |
/* Any JavaScript here will be loaded for all users on every page load. */