iframe-resizer 5.4.0-beta.12 → 5.4.0-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +1 -1
- package/index.esm.js +1 -1
- package/js/iframeResizer.contentWindow.js +2 -2
- package/js/iframeResizer.contentWindow.js.map +1 -1
- package/js/iframeResizer.contentWindow.min.js +2 -2
- package/js/iframeResizer.contentWindow.min.js.map +1 -1
- package/js/iframeResizer.js +2 -2
- package/js/iframeResizer.js.map +1 -1
- package/js/iframeResizer.min.js +2 -2
- package/js/iframeResizer.min.js.map +1 -1
- package/package.json +4 -4
package/index.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @preserve
|
|
3
3
|
*
|
|
4
|
-
* @module iframe-resizer/legacy 5.4.0-beta.
|
|
4
|
+
* @module iframe-resizer/legacy 5.4.0-beta.13 (cjs) - 2025-03-27
|
|
5
5
|
*
|
|
6
6
|
* @license GPL-3.0 for non-commercial use only.
|
|
7
7
|
* For commercial use, you must purchase a license from
|
package/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @preserve
|
|
3
3
|
*
|
|
4
|
-
* @module iframe-resizer/legacy 5.4.0-beta.
|
|
4
|
+
* @module iframe-resizer/legacy 5.4.0-beta.13 (esm) - 2025-03-27
|
|
5
5
|
*
|
|
6
6
|
* @license GPL-3.0 for non-commercial use only.
|
|
7
7
|
* For commercial use, you must purchase a license from
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @preserve
|
|
3
3
|
*
|
|
4
|
-
* @module iframe-resizer/legacy (child) 5.4.0-beta.
|
|
4
|
+
* @module iframe-resizer/legacy (child) 5.4.0-beta.13 (iife)
|
|
5
5
|
*
|
|
6
6
|
* @license GPL-3.0 for non-commercial use only.
|
|
7
7
|
* For commercial use, you must purchase a license from
|
|
@@ -17,5 +17,5 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
!function(){"use strict";const e="font-weight: normal;",t="font-weight: bold;",n="font-style: italic;",o=e+n,i="default",r={collapsed:!1,defaultEvent:void 0,event:void 0,label:"AutoConsoleGroup",showTime:!0},a={profile:0,profileEnd:0,timeStamp:0,trace:0};const{fromEntries:l,keys:s}=Object,c=e=>t=>[t,function(n){e[t]=n}],d=(e,t)=>l(s(e).map(t));const u=()=>!(typeof window>"u")&&(null==window?void 0:window.matchMedia("(prefers-color-scheme: dark)").matches),m=u()?"color: #A9C7FB;":"color: #135CD2;",f=u()?"color: #E3E3E3;":"color: #1F1F1F;",p="5.4.0-beta.12",h=10,g="data-iframe-size",y="data-iframe-overflowed",v="data-iframe-ignore",b="bottom",z="right",w="resizeParent",$="setOffsetSize",S="resizeObserver",E="overflowObserver",M=(e,t,n,o)=>e.addEventListener(t,n,o||!1),k=["<iy><yi>Puchspk Spjluzl Rlf</><iy><iy>","<iy><yi>Tpzzpun Spjluzl Rlf</><iy><iy>","Aopz spiyhyf pz hchpshisl dpao ivao Jvttlyjphs huk Vwlu-Zvbyjl spjluzlz.<iy><iy><i>Jvttlyjphs Spjluzl</><iy>Mvy jvttlyjphs bzl, <p>pmyhtl-ylzpgly</> ylxbpylz h svd jvza vul aptl spjluzl mll. Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.<iy><iy><i>Vwlu Zvbyjl Spjluzl</><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-jvttlyjphs vwlu zvbyjl wyvqlja aolu fvb jhu bzl pa mvy myll bukly aol alytz vm aol NWS C3 Spjluzl. Av jvumpyt fvb hjjlwa aolzl alytz, wslhzl zla aol <i>spjluzl</> rlf pu <p>pmyhtl-ylzpgly</> vwapvuz av <i>NWSc3</>.<iy><iy>Mvy tvyl pumvythapvu wslhzl zll: <b>oaawz://pmyhtl-ylzpgly.jvt/nws</>","<i>NWSc3 Spjluzl Clyzpvu</><iy><iy>Aopz clyzpvu vm <p>pmyhtl-ylzpgly</> pz ilpun bzlk bukly aol alytz vm aol <i>NWS C3</> spjluzl. Aopz spjluzl hssvdz fvb av bzl <p>pmyhtl-ylzpgly</> pu Vwlu Zvbyjl wyvqljaz, iba pa ylxbpylz fvby wyvqlja av il wbispj, wyvcpkl haaypibapvu huk il spjluzlk bukly clyzpvu 3 vy shaly vm aol NUB Nlulyhs Wbispj Spjluzl.<iy><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-vwlu zvbyjl wyvqlja vy dlizpal, fvb dpss ullk av wbyjohzl h svd jvza vul aptl jvttlyjphs spjluzl.<iy><iy>Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.","<iy><yi>Zvsv spjluzl kvlz uva zbwwvya jyvzz-kvthpu</><iy><iy>Av bzl <p>pmyhtl-ylzpgly</> dpao jyvzz kvthpu pmyhtlz fvb ullk lpaoly aol Wyvmlzzpvuhs vy Ibzpulzz spjluzlz. Mvy klahpsz vu bwnyhkl wypjpun wslhzl jvuahja pumv@pmyhtl-ylzpgly.jvt."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const O=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(k[e]),j=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},P=e=>e,A=e=>Math.round(1e3*e)/1e3,C=e=>e.charAt(0).toUpperCase()+e.slice(1),T=e=>""!=`${e}`&&void 0!==e;function I(e){switch(!0){case!T(e):return"";case T(e.id):return`${e.nodeName}#${e.id}`;case T(e.name):return`${e.nodeName} (${e.name}`;case T(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}let N=!0;const R=(x=function(n={}){const l={},s=[],u={...r,...n};let m;function f(){s.length=0}function p(){delete u.event,f()}const h=()=>!s.some((([e])=>"error"===e||"warn"===e))&&!!u.collapsed;function g(){if(0!==s.length){console[h()?"groupCollapsed":"group"](`%c${u.label}%c ${(e=>{const t=e.event||e.defaultEvent;return t?`${t}`:""})(u)} %c${u.showTime?m:""}`,e,t,o);for(const[e,...t]of s)console[e](...t);console.groupEnd(),p()}else p()}function y(){m=function(){const e=new Date,t=(t,n)=>e[t]().toString().padStart(n,"0");return`@ ${t("getHours",2)}:${t("getMinutes",2)}:${t("getSeconds",2)}.${t("getMilliseconds",3)}`}(),queueMicrotask((()=>queueMicrotask(g)))}function v(e,...t){0===s.length&&y(),s.push([e,...t])}function b(e=i,...t){v("log",`${e}: ${performance.now()-l[e]} ms`,...t)}return{...d(u,c(u)),...d(console,(e=>[e,(...t)=>v(e,...t)])),...d(a,(e=>[e,console[e]])),endAutoGroup:g,purge:f,time:function(e=i){l[e]=performance.now()},timeEnd:function(e=i){b(e),delete l[e]},timeLog:b}},x?.__esModule?x.default:x);var x;const q=R({label:"iframeResizer(child)"});const L=e=>(...t)=>!N||q[e](...t),F=L("log"),B=L("info"),{event:D,assert:W,debug:V,endAutoGroup:H,error:U,purge:Z,warn:J}=q,_=e=>{return q.warn((t=P,e=>window.chrome?t(e.replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m")):t(e.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(e));var t},Q=_,G=(e=>(t,n="renamed to")=>(o,i,r="",a="")=>e(a,`<rb>Deprecated ${t}(${o.replace("()","")})</>\n\nThe <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${i}</>. ${r}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))(((e,t)=>_(t))),X=G("Method"),Y=G("Method","replaced with"),K=G("Option"),ee=requestAnimationFrame,te="--ifr-start",ne="--ifr-end",oe=[],ie=new WeakSet,re=e=>"object"==typeof e&&ie.add(e);let ae={},le=0;const se=setInterval((()=>{if(oe.length<10)return;if(ae.hasTags&&ae.len<25)return;oe.sort();const e=Math.min(oe.reduce(((e,t)=>e+t),0)/oe.length,oe[Math.floor(oe.length/2)]),t=A(e);t>le&&(le=t,D("performanceObserver"),F("Mean time:",A(oe[Math.floor(oe.length/2)])),F("Median time:",A(oe.reduce(((e,t)=>e+t),0)/oe.length)),F("Average time:",t),F("Max time:",A(Math.max(...oe)))),e<=4||(clearInterval(se),_(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${A(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${ae.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function ce(e){e.getEntries().forEach((e=>{if(e.name===ne){const{duration:t}=performance.measure("--ifr-measure",te,ne);ae=e.detail,oe.push(t),oe.length>100&&oe.shift()}}))}function de(){new PerformanceObserver(ce).observe({entryTypes:["mark"]}),re(document.documentElement),re(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",de):de()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},i={height:()=>(J("Custom height calculation function not defined"),st.auto()),width:()=>(J("Custom width calculation function not defined"),ct.auto())},r={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},a={},l="checkVisibility"in window,s="auto",c="[iFrameSizer]",d={max:1,min:1,bodyScroll:1,documentElementScroll:1},u="scroll";let k,T,R,x,L,W=!0,U="",Z=0,G="",oe="",ie=!0,re=!1,ae=!0,le=!1,se=!1,ce=!1,de=1,ue=s,me="",fe=!0,pe="",he={},ge=!1,ye=0,ve=!1,be="",ze=P,we=[],$e="child",Se=null,Ee=!1,Me="",ke=[],Oe=window.parent,je="*",Pe=0,Ae=!1,Ce="",Te=1,Ie=u,Ne=window,Re=()=>{J("onMessage function not defined")},xe=()=>{},qe=null,Le=null;function Fe(){var e,t,n,o;!function(){const e=e=>"true"===e,t=pe.slice(13).split(":");be=t[0],Z=void 0===t[1]?Z:Number(t[1]),re=void 0===t[2]?re:e(t[2]),ge=void 0===t[3]?ge:e(t[3]),W=void 0===t[6]?W:e(t[6]),G=t[7],ue=void 0===t[8]?ue:t[8],U=t[9],oe=t[10],Pe=void 0===t[11]?Pe:Number(t[11]),he.enable=void 0!==t[12]&&e(t[12]),$e=void 0===t[13]?$e:t[13],Ie=void 0===t[14]?Ie:t[14],ve=void 0===t[15]?ve:e(t[15]),k=void 0===t[16]?k:Number(t[16]),T=void 0===t[17]?T:Number(t[17]),ie=void 0===t[18]?ie:e(t[18]),t[19],Ce=t[20]||Ce,ye=void 0===t[21]?ye:Number(t[21])}(),e={id:be,enabled:ge},q.label(`${e.id}`),N=e.enabled,F(`Initialising iframe v${p} ${window.location.href}`),function(){function e(e){F("Reading data from page:",e),Re=e?.onMessage||Re,xe=e?.onReady||xe,"number"==typeof e?.offset&&(K("offset","offsetSize"),ie&&(k=e?.offset),re&&(T=e?.offset)),"number"==typeof e?.offsetSize&&(ie&&(k=e?.offsetSize),re&&(T=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(Me=e.sizeSelector),Object.prototype.hasOwnProperty.call(e,"ignoreSelector")&&(me=e.ignoreSelector),je=e?.targetOrigin||je,ue=e?.heightCalculationMethod||ue,Ie=e?.widthCalculationMethod||Ie}function t(e,t){return"function"==typeof e&&(F(`Setup custom ${t}CalcMethod`),i[t]=e,e="custom"),e}if(1===ye)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),ue=t(ue,"height"),Ie=t(Ie,"width"),B(`Set TargetOrigin for parent: %c${je}`,m))}(),Je(),function(){try{Ee=1===ye||"iframeParentListener"in window.parent}catch(e){F("Cross domain iframe detected")}}(),ye<0?Q(`${O(ye+2)}${O(2)}`):Ce.codePointAt(0)>4||ye<2&&Q(O(3)),Ce&&""!==Ce&&"false"!==Ce?Ce!==p&&_(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${Ce} - Child page: ${p}.\n`):_("<rb>Legacy version detected on parent page</>\n\nDetected legacy version of parent page script. It is recommended to update the parent page to use <b>@iframe-resizer/parent</>.\n\nSee <u>https://iframe-resizer.com/setup/</> for more details.\n"),Ge(),Xe(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(g,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&_("<rb>Deprecated Attributes</>\n \nThe <b>data-iframe-height</> and <b>data-iframe-width</> attributes have been deprecated and replaced with the single <b>data-iframe-size</> attribute. Use of the old attributes will be removed in a future version of <i>iframe-resizer</>.")}(),"BackCompat"===document.compatMode&&_("<rb>Quirks Mode Detected</>\n\nThis iframe is running in the browser's legacy <b>Quirks Mode</>, this may cause issues with the correct operation of <i>iframe-resizer</>. It is recommended that you switch to the modern <b>Standards Mode</>.\n\nFor more information see <u>https://iframe-resizer.com/quirks-mode</>.\n"),De(),1!==ye&&(Ne.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===W?(W=!0,pt("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===W&&(W=!1),yt(0,0,"autoResize",JSON.stringify(W)),W),close(){yt(0,0,"close")},getId:()=>be,getOrigin:()=>(X("getOrigin()","getParentOrigin()"),R),getParentOrigin:()=>R,getPageInfo(e){if("function"==typeof e)return qe=e,yt(0,0,"pageInfo"),void Y("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");qe=null,yt(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIframe.getParentProps(callback) callback not a function");return Le=e,yt(0,0,"parentInfo"),()=>{Le=null,yt(0,0,"parentInfoStop")}},getParentProperties(e){X("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){he.findTarget(e)},reset(){gt("parentIframe.reset")},setOffsetSize(e){k=e,T=e,pt($,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){yt(t,e,"scrollBy")},scrollTo(e,t){yt(t,e,"scrollTo")},scrollToOffset(e,t){yt(t,e,"scrollToOffset")},sendMessage(e,t){yt(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){ue=e,Ge()},setWidthCalculationMethod(e){Ie=e,Xe()},setTargetOrigin(e){F(`Set targetOrigin: %c${e}`,m),je=e},resize(e,t){pt("parentIframe.resize()",`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){X("size()","resize()"),this.resize(e,t)}}),Ne.parentIFrame=Ne.parentIframe),function(){function e(e){yt(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){F(`Add event listener: %c${n}`,m),M(window.document,t,e)}!0===ve&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),he=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function t(t){const n=t.getBoundingClientRect(),o=e();return{x:parseInt(n.left,h)+parseInt(o.x,h),y:parseInt(n.top,h)+parseInt(o.y,h)}}function n(e){function n(e){const n=t(e);F(`Moving to in page link (%c#${o}%c) at x: %c${n.x}%c y: %c${n.y}`,m,f,m,f,m),yt(n.y,n.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?(F(`In page link (#${o}) not found in iFrame, so sending to parent`),yt(0,0,"inPageLink",`#${o}`)):n(r)}function o(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&n(t)}function i(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&M(e,"click",(t=>{t.preventDefault(),n(e.getAttribute("href"))}))}function r(){M(window,"hashchange",o)}function a(){setTimeout(o,128)}function l(){F("Setting up location.hash handlers"),i(),r(),a()}return he.enable?1===ye?_("In page linking requires a Professional or Business license. Please see <u>https://iframe-resizer.com/pricing</> for more details."):l():F("In page linking not enabled"),{findTarget:n}}(),void 0===G&&(G=`${Z}px`),Ue("margin",(n="margin",(o=G).includes("-")&&(J(`Negative CSS value ignored for ${n}`),o=""),o)),Ue("background",U),Ue("padding",oe),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),function(){const e=e=>e.style.setProperty("height","auto","important");e(document.documentElement),e(document.body),F("Set HTML & body height: %cauto !important",m)}(),!0!==W&&F("Auto Resize disabled"),_e({method:t="add",eventType:"After Print",eventName:"afterprint"}),_e({method:t,eventType:"Before Print",eventName:"beforeprint"}),_e({method:t,eventType:"Ready State Change",eventName:"readystatechange"}),function(){const e=new Set;let t=!1,n=0,o=[];const i=t=>{F("Mutations observed:",t.length);for(const n of t){const{addedNodes:t,removedNodes:o}=n;for(const n of t)e.add(n);for(const t of o)e.delete(t)}},r=16,a=2,l=200;let s=1;function c(){D("mutationObserver");const d=performance.now(),u=d-n,f=r*s+++a;if(u>f&&u<l)return F(`MutationObserver delay: %c${u}ms > ${f}ms`,m),setTimeout(c,r*s),void(n=d);s=1,o.forEach(i),o=[],0!==e.size?(Je(),De(),We(e),e.forEach(et),e.clear(),t=!1):t=!1}function d(e){o.push(e),t||(n=performance.now(),t=!0,requestAnimationFrame(c))}function u(){const e=new window.MutationObserver(d),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return F("Setup <body> MutationObserver"),e.observe(t,n),e}u()}(),F("Setup ResizeObserver"),Se=new ResizeObserver(Ye),Se.observe(document.body),Ke.add(document.body),et(document.body),ie!==re&&(F("Setup OverflowObserver"),ze=(e=>{const t=e.side||b,n=e.onChange||P,o=(e,n)=>0===e||e>n[t],i={root:e.root,rootMargin:"0px",threshold:1},r=()=>n(document.querySelectorAll(`[${y}]`)),a=(e,t)=>e.toggleAttribute(y,t),l=new IntersectionObserver((function(e){for(const i of e){const{boundingClientRect:e,rootBounds:r,target:l}=i,s=e[t],c=!((n=l).hidden||null===n.offsetParent||"none"===n.style.display)&&o(s,r);a(l,c)}var n;ee(r)}),i),s=new WeakSet;return function(e){F("Attached overflowObservers");for(const t of e)t.nodeType!==Node.ELEMENT_NODE||s.has(t)||(l.observe(t),s.add(t))}})({onChange:Be,root:document.documentElement,side:ie?b:z})),We(ot(document)()),queueMicrotask(xe),F("Initialization complete"),pt("init","Init message from host page",void 0,void 0,p),document.title&&""!==document.title&&yt(0,0,"title",document.title)}function Be(e){we=e,se=we.length>0,se&&(F("Observed Elements:",e.length),pt(E,"Overflow updated"))}function De(){ke=document.querySelectorAll(`[${g}]`),ce=ke.length>0,F(`Tagged elements found: %c${ce}`,ce?m:f)}function We(e){ce||ze(e)}let Ve=0;function He(){const n=document.querySelectorAll(`*[${v}]`);le=n.length>0,le&&n.length!==Ve&&(function(n){const o=1===n.length?"":"s";J(`%c[${v}]%c found on %c${n.length}%c element${o}`,t,e,t,e)}(n),Ve=n.length)}function Ue(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),B(`Set body ${e}: %c${t}`,m))}function Ze(e,t,n){if(""!==n){F(`${e}: %c${n}`,m);for(const e of document.querySelectorAll(n))F(`Applying ${t} to:`,e),e.toggleAttribute(t,!0)}}function Je(){Ze("sizeSelector",g,Me),Ze("ignoreSelector",v,me)}function _e(e){({add(t){function n(){pt(e.eventName,e.eventType)}a[t]=n,M(window,t,n,{passive:!0})},remove(e){const t=a[e];var n,o;delete a[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),F(`${C(e.method)} event listener: %c${e.eventType}`,m)}function Qe(e,t,n,o){return t!==e&&(e in n||(J(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in r&&_(`<rb>Deprecated ${o}CalculationMethod (${e})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${o} calculation method. It is recommended that you remove this option.`),F(`Set ${o} calculation method: %c${e}`,m)),e}function Ge(){ue=Qe(ue,s,st,"height")}function Xe(){Ie=Qe(Ie,u,ct,"width")}function Ye(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;pt(S,`Element resized <${I(t)}>`)}const Ke=new WeakSet;function et(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!Ke.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(Se.observe(e),Ke.add(e),F(`Attached resizeObserver: %c${I(e)}`,m))}const t=ot(e)();for(const e of t){if(Ke.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(Se.observe(e),Ke.add(e),F(`Attached resizeObserver: %c${I(e)}`,m))}}function tt(e){performance.mark(te);const t=C(e);let n=0,i=document.documentElement,r=ce?0:document.documentElement.getBoundingClientRect().bottom;const a=ce?ke:se?we:ot(document)();let s=a.length;for(const t of a)ce||!l||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,i=t)):s-=1;return B(`${t} position calculated from:`,i),performance.mark(ne,{detail:{Side:t,len:s,hasTags:ce,logging:ge}}),r}const nt=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],ot=e=>()=>{He();const t=["* ","not(head)","not(meta)","not(base)","not(title)","not(script)","not(link)","not(style)","not(map)","not(area)","not(option)","not(optgroup)","not(template)","not(track)","not(wbr)","not(nobr)"];return le&&t.push(`not([${v}])`,`not([${v}] *)`),e.querySelectorAll(t.join(":"))},it={height:0,width:0},rt={height:0,width:0},at=[m,f,m];function lt(e){function t(){return rt[o]=i,it[o]=l,i}const n=e===st,o=n?"height":"width",i=e.boundingClientRect(),r=Math.ceil(i),a=Math.floor(i),l=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),s=`HTML: %c${i}px %cPage: %c${l}px`;let c=0;switch(!0){case!e.enabled():return l;case ce:B("Found element with data-iframe-size attribute"),c=e.taggedElement();break;case!se&&0===rt[o]&&0===it[o]:B(`Initial page size values: ${s}`,...at),c=t();break;case Ae&&i===rt[o]&&l===it[o]:B(`Size unchanged: ${s}`,...at),c=Math.max(i,l);break;case 0===i:B(`Page is hidden: ${s}`,...at),c=l;break;case!se&&i!==rt[o]&&l<=it[o]:B(`New <html> size: ${s} `,...at),B(`Previous <html> size: %c${rt[o]}px`,m),c=t();break;case!n:c=e.taggedElement();break;case!se&&i<rt[o]:B(`<html> size decreased: ${s}`,...at),c=t();break;case l===a||l===r:B(`<html> size equals page size: ${s}`,...at),c=t();break;case i>l:B(`Page size < <html> size: ${s}`,...at),c=t();break;case se:B("Found element overflowing <html> "),c=e.taggedElement();break;default:c=t()}return B(`Content ${o}: %c${c}px`,m),c+=function(e){const t=e.getOffset();return 0!==t&&B(`Page offsetSize: %c${t}px`,m),t}(e),c}const st={enabled:()=>ie,getOffset:()=>k,auto:()=>lt(st),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,h)+parseInt(t.marginBottom,h)},bodyScroll:()=>document.body.scrollHeight,offset:()=>st.bodyOffset(),custom:()=>i.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...nt(st)),min:()=>Math.min(...nt(st)),grow:()=>st.max(),lowestElement:()=>tt(b),taggedElement:()=>tt(b)},ct={enabled:()=>re,getOffset:()=>T,auto:()=>lt(ct),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>i.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...nt(ct)),min:()=>Math.min(...nt(ct)),rightMostElement:()=>tt(z),scroll:()=>Math.max(ct.bodyScroll(),ct.documentElementScroll()),taggedElement:()=>tt(z)},dt=(e,t)=>!(Math.abs(e-t)<=Pe);function ut(e,t,n,o,i){const r=void 0===n?st[ue]():n,a=void 0===o?ct[Ie]():o;switch(!0){case ie&&dt(de,r)||re&&dt(Te,a)||"init"===e:de=r,Te=a;case e===$:yt(de,Te,e,i);break;case!e!==w&&(ie&&ue in d||re&&Ie in d):gt(t);break;case e===S:case e===E:F("No change in content size detected");break;default:B("No change in content size detected")}x=!1}let mt=!1;const ft=j((()=>Q(O(4))));function pt(e,t,n,o,i){L=performance.now(),D(e),W||e===w?document.hidden?F("Page hidden - Ignored resize request"):(mt||(F(`Resize event: %c${t}`,m),x=!0,ut(e,t,n,o,i),requestAnimationFrame((()=>{mt=!1}))),mt=!0):B("Resizing disabled")}function ht(e){de=st[ue](),Te=ct[Ie](),yt(de,Te,e)}function gt(e){const t=ue;ue=s,F(`Reset trigger event: %c${e}`,m),Ae?F("TriggerLock blocked calculation"):(Ae=!0,V("Trigger event lock on"),requestAnimationFrame((()=>{Ae=!1,V("Trigger event lock off")}))),ht("reset"),ue=t}function yt(e,t,o,i,r){ye<-1||(D(o),void 0!==r?F(`Message targetOrigin: %c${r}`,m):r=je,function(){const a=`${be}:${e}:${t}:${o}${void 0===i?"":`:${i}`}`;if(Ee)try{window.parent.iframeParentListener(c+a)}catch(e){if(1!==ye)throw e;return void ft()}else Oe.postMessage(c+a,r);x&&B(function(){const e=A(performance.now()-L);return"init"===o?`Initialised iFrame in %c${e}ms`:`Size calculated in %c${e}ms`}(),m),B("Sending message to host page via "+(Ee?"sameDomain":"postMessage")),B(`%c${a}`,n)}(),H())}function vt(e){const{freeze:t}=Object,{parse:n}=JSON,o=e=>yt(0,0,`${e}Stop`),i={init:function(){pe=e.data,Oe=e.source,R=e.origin,Fe(),ae=!1,setTimeout((()=>{fe=!1}),128)},reset(){fe?F("Page reset ignored by init"):(F("Page size reset by host page"),ht("resetPage"))},resize(){pt(w,"Parent window requested size check")},moveToAnchor(){he.findTarget(a())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=a();F(`PageInfo received from parent: ${e}`),qe?setTimeout((()=>qe(n(e)))):o("pageInfo")},parentInfo(){const e=a();F(`ParentInfo received from parent: ${e}`),Le?setTimeout((()=>Le(t(n(e))))):o("parentInfo")},message(){const e=a();F(`onMessage called from parent: ${e}`),setTimeout((()=>Re(n(e))))}},r=()=>e.data.split("]")[1].split(":")[0],a=()=>e.data.slice(e.data.indexOf(":")+1),l=()=>e.data.split(":")[2]in{true:1,false:1};function s(){const t=r();t in i?i[t]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||l()||J(`Unexpected message (${e.data})`)}c===`${e.data}`.slice(0,13)&&(D(r()),!1!==ae?l()?i.init():F(`Ignored message of type "${r()}". Received before initialization.`):s())}function bt(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?J("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>vt({data:e}))),M(window,"message",vt),M(window,"readystatechange",bt),bt())}()}();
|
|
20
|
+
!function(){"use strict";const e="font-weight: normal;",t="font-weight: bold;",n="font-style: italic;",o=e+n,i="default",r={collapsed:!1,defaultEvent:void 0,event:void 0,label:"AutoConsoleGroup",showTime:!0},a={profile:0,profileEnd:0,timeStamp:0,trace:0};const{fromEntries:l,keys:s}=Object,c=e=>t=>[t,function(n){e[t]=n}],d=(e,t)=>l(s(e).map(t));const u=()=>!(typeof window>"u")&&(null==window?void 0:window.matchMedia("(prefers-color-scheme: dark)").matches),m=u()?"color: #A9C7FB;":"color: #135CD2;",f=u()?"color: #E3E3E3;":"color: #1F1F1F;",p="5.4.0-beta.13",h=10,g="data-iframe-size",y="data-iframe-overflowed",v="data-iframe-ignore",b="bottom",z="right",w="resizeParent",$="setOffsetSize",S="resizeObserver",E="overflowObserver",M=(e,t,n,o)=>e.addEventListener(t,n,o||!1),O=["<iy><yi>Puchspk Spjluzl Rlf</><iy><iy>","<iy><yi>Tpzzpun Spjluzl Rlf</><iy><iy>","Aopz spiyhyf pz hchpshisl dpao ivao Jvttlyjphs huk Vwlu-Zvbyjl spjluzlz.<iy><iy><i>Jvttlyjphs Spjluzl</><iy>Mvy jvttlyjphs bzl, <p>pmyhtl-ylzpgly</> ylxbpylz h svd jvza vul aptl spjluzl mll. Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.<iy><iy><i>Vwlu Zvbyjl Spjluzl</><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-jvttlyjphs vwlu zvbyjl wyvqlja aolu fvb jhu bzl pa mvy myll bukly aol alytz vm aol NWS C3 Spjluzl. Av jvumpyt fvb hjjlwa aolzl alytz, wslhzl zla aol <i>spjluzl</> rlf pu <p>pmyhtl-ylzpgly</> vwapvuz av <i>NWSc3</>.<iy><iy>Mvy tvyl pumvythapvu wslhzl zll: <b>oaawz://pmyhtl-ylzpgly.jvt/nws</>","<i>NWSc3 Spjluzl Clyzpvu</><iy><iy>Aopz clyzpvu vm <p>pmyhtl-ylzpgly</> pz ilpun bzlk bukly aol alytz vm aol <i>NWS C3</> spjluzl. Aopz spjluzl hssvdz fvb av bzl <p>pmyhtl-ylzpgly</> pu Vwlu Zvbyjl wyvqljaz, iba pa ylxbpylz fvby wyvqlja av il wbispj, wyvcpkl haaypibapvu huk il spjluzlk bukly clyzpvu 3 vy shaly vm aol NUB Nlulyhs Wbispj Spjluzl.<iy><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-vwlu zvbyjl wyvqlja vy dlizpal, fvb dpss ullk av wbyjohzl h svd jvza vul aptl jvttlyjphs spjluzl.<iy><iy>Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.","<iy><yi>Zvsv spjluzl kvlz uva zbwwvya jyvzz-kvthpu</><iy><iy>Av bzl <p>pmyhtl-ylzpgly</> dpao jyvzz kvthpu pmyhtlz fvb ullk lpaoly aol Wyvmlzzpvuhs vy Ibzpulzz spjluzlz. Mvy klahpsz vu bwnyhkl wypjpun wslhzl jvuahja pumv@pmyhtl-ylzpgly.jvt."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const j=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(O[e]),k=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},P=e=>e,A=e=>Math.round(1e3*e)/1e3,C=e=>e.charAt(0).toUpperCase()+e.slice(1),T=e=>""!=`${e}`&&void 0!==e;function I(e){switch(!0){case!T(e):return"";case T(e.id):return`${e.nodeName}#${e.id}`;case T(e.name):return`${e.nodeName} (${e.name}`;case T(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}let N=!0;var R;const x=(R=function(n={}){const l={},s=[],u={...r,...n};let m;function f(){s.length=0}function p(){delete u.event,f()}const h=()=>!s.some((([e])=>"error"===e||"warn"===e))&&!!u.collapsed;function g(){if(0!==s.length){console[h()?"groupCollapsed":"group"](`%c${u.label}%c ${(e=>{const t=e.event||e.defaultEvent;return t?`${t}`:""})(u)} %c${u.showTime?m:""}`,e,t,o);for(const[e,...t]of s)console[e](...t);console.groupEnd(),p()}else p()}function y(){m=function(){const e=new Date,t=(t,n)=>e[t]().toString().padStart(n,"0");return`@ ${t("getHours",2)}:${t("getMinutes",2)}:${t("getSeconds",2)}.${t("getMilliseconds",3)}`}(),queueMicrotask((()=>queueMicrotask(g)))}function v(e,...t){0===s.length&&y(),s.push([e,...t])}function b(e=i,...t){v("log",`${e}: ${performance.now()-l[e]} ms`,...t)}return{...d(u,c(u)),...d(console,(e=>[e,(...t)=>v(e,...t)])),...d(a,(e=>[e,console[e]])),endAutoGroup:g,errorBoundary:e=>(...t)=>{let n;try{n=e(...t)}catch(e){v("error",e)}return n},purge:f,time:function(e=i){l[e]=performance.now()},timeEnd:function(e=i){b(e),delete l[e]},timeLog:b}},R?.__esModule?R.default:R)({label:"iframeResizer(child)"});const q=e=>(...t)=>!N||x[e](...t),L=q("log"),B=q("info"),{assert:F,debug:D,endAutoGroup:W,error:V,errorBoundary:H,event:U,purge:Z,warn:J}=x,_=e=>{return x.warn((t=P,e=>window.chrome?t(e.replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m")):t(e.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(e));var t},Q=_,G=(e=>(t,n="renamed to")=>(o,i,r="",a="")=>e(a,`<rb>Deprecated ${t}(${o.replace("()","")})</>\n\nThe <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${i}</>. ${r}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))(((e,t)=>_(t))),X=G("Method"),Y=G("Method","replaced with"),K=G("Option"),ee=requestAnimationFrame,te="--ifr-start",ne="--ifr-end",oe=[],ie=new WeakSet,re=e=>"object"==typeof e&&ie.add(e);let ae={},le=0;const se=setInterval((()=>{if(oe.length<10)return;if(ae.hasTags&&ae.len<25)return;oe.sort();const e=Math.min(oe.reduce(((e,t)=>e+t),0)/oe.length,oe[Math.floor(oe.length/2)]),t=A(e);t>le&&(le=t,U("performanceObserver"),L("Mean time:",A(oe[Math.floor(oe.length/2)])),L("Median time:",A(oe.reduce(((e,t)=>e+t),0)/oe.length)),L("Average time:",t),L("Max time:",A(Math.max(...oe)))),e<=4||(clearInterval(se),_(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${A(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${ae.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function ce(e){e.getEntries().forEach((e=>{if(e.name===ne){const{duration:t}=performance.measure("--ifr-measure",te,ne);ae=e.detail,oe.push(t),oe.length>100&&oe.shift()}}))}function de(){new PerformanceObserver(ce).observe({entryTypes:["mark"]}),re(document.documentElement),re(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",de):de()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},i={height:()=>(J("Custom height calculation function not defined"),ct.auto()),width:()=>(J("Custom width calculation function not defined"),dt.auto())},r={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},a={},l="checkVisibility"in window,s="auto",c="[iFrameSizer]",d={max:1,min:1,bodyScroll:1,documentElementScroll:1},u="scroll";let O,T,R,q,F,V=!0,Z="",G=0,oe="",ie="",re=!0,ae=!1,le=!0,se=!1,ce=!1,de=!1,ue=1,me=s,fe="",pe=!0,he="",ge={},ye=!1,ve=0,be=!1,ze="",we=P,$e=[],Se="child",Ee=null,Me=!1,Oe="",je=[],ke=window.parent,Pe="*",Ae=0,Ce=!1,Te="",Ie=1,Ne=u,Re=window,xe=()=>{J("onMessage function not defined")},qe=()=>{},Le=null,Be=null;function Fe(){var e,t,n,o;!function(){const e=e=>"true"===e,t=he.slice(13).split(":");ze=t[0],G=void 0===t[1]?G:Number(t[1]),ae=void 0===t[2]?ae:e(t[2]),ye=void 0===t[3]?ye:e(t[3]),V=void 0===t[6]?V:e(t[6]),oe=t[7],me=void 0===t[8]?me:t[8],Z=t[9],ie=t[10],Ae=void 0===t[11]?Ae:Number(t[11]),ge.enable=void 0!==t[12]&&e(t[12]),Se=void 0===t[13]?Se:t[13],Ne=void 0===t[14]?Ne:t[14],be=void 0===t[15]?be:e(t[15]),O=void 0===t[16]?O:Number(t[16]),T=void 0===t[17]?T:Number(t[17]),re=void 0===t[18]?re:e(t[18]),t[19],Te=t[20]||Te,ve=void 0===t[21]?ve:Number(t[21])}(),e={id:ze,enabled:ye},x.label(`${e.id}`),N=e.enabled,L(`Initialising iframe v${p} ${window.location.href}`),function(){function e(e){L("Reading data from page:",e),xe=e?.onMessage||xe,qe=e?.onReady||qe,"number"==typeof e?.offset&&(K("offset","offsetSize"),re&&(O=e?.offset),ae&&(T=e?.offset)),"number"==typeof e?.offsetSize&&(re&&(O=e?.offsetSize),ae&&(T=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(Oe=e.sizeSelector),Object.prototype.hasOwnProperty.call(e,"ignoreSelector")&&(fe=e.ignoreSelector),Pe=e?.targetOrigin||Pe,me=e?.heightCalculationMethod||me,Ne=e?.widthCalculationMethod||Ne}function t(e,t){return"function"==typeof e&&(L(`Setup custom ${t}CalcMethod`),i[t]=e,e="custom"),e}if(1===ve)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),me=t(me,"height"),Ne=t(Ne,"width"),B(`Set TargetOrigin for parent: %c${Pe}`,m))}(),_e(),function(){try{Me=1===ve||"iframeParentListener"in window.parent}catch(e){L("Cross domain iframe detected")}}(),ve<0?Q(`${j(ve+2)}${j(2)}`):Te.codePointAt(0)>4||ve<2&&Q(j(3)),Te&&""!==Te&&"false"!==Te?Te!==p&&_(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${Te} - Child page: ${p}.\n`):_("<rb>Legacy version detected on parent page</>\n\nDetected legacy version of parent page script. It is recommended to update the parent page to use <b>@iframe-resizer/parent</>.\n\nSee <u>https://iframe-resizer.com/setup/</> for more details.\n"),Xe(),Ye(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(g,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&_("<rb>Deprecated Attributes</>\n \nThe <b>data-iframe-height</> and <b>data-iframe-width</> attributes have been deprecated and replaced with the single <b>data-iframe-size</> attribute. Use of the old attributes will be removed in a future version of <i>iframe-resizer</>.")}(),"BackCompat"===document.compatMode&&_("<rb>Quirks Mode Detected</>\n\nThis iframe is running in the browser's legacy <b>Quirks Mode</>, this may cause issues with the correct operation of <i>iframe-resizer</>. It is recommended that you switch to the modern <b>Standards Mode</>.\n\nFor more information see <u>https://iframe-resizer.com/quirks-mode</>.\n"),We(),1!==ve&&(Re.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===V?(V=!0,ht("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===V&&(V=!1),vt(0,0,"autoResize",JSON.stringify(V)),V),close(){vt(0,0,"close")},getId:()=>ze,getOrigin:()=>(X("getOrigin()","getParentOrigin()"),R),getParentOrigin:()=>R,getPageInfo(e){if("function"==typeof e)return Le=e,vt(0,0,"pageInfo"),void Y("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");Le=null,vt(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIframe.getParentProps(callback) callback not a function");return Be=e,vt(0,0,"parentInfo"),()=>{Be=null,vt(0,0,"parentInfoStop")}},getParentProperties(e){X("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){ge.findTarget(e)},reset(){yt("parentIframe.reset")},setOffsetSize(e){O=e,T=e,ht($,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){vt(t,e,"scrollBy")},scrollTo(e,t){vt(t,e,"scrollTo")},scrollToOffset(e,t){vt(t,e,"scrollToOffset")},sendMessage(e,t){vt(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){me=e,Xe()},setWidthCalculationMethod(e){Ne=e,Ye()},setTargetOrigin(e){L(`Set targetOrigin: %c${e}`,m),Pe=e},resize(e,t){ht("parentIframe.resize()",`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){X("size()","resize()"),this.resize(e,t)}}),Re.parentIFrame=Re.parentIframe),function(){function e(e){vt(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){L(`Add event listener: %c${n}`,m),M(window.document,t,e)}!0===be&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),ge=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function t(t){const n=t.getBoundingClientRect(),o=e();return{x:parseInt(n.left,h)+parseInt(o.x,h),y:parseInt(n.top,h)+parseInt(o.y,h)}}function n(e){function n(e){const n=t(e);L(`Moving to in page link (%c#${o}%c) at x: %c${n.x}%c y: %c${n.y}`,m,f,m,f,m),vt(n.y,n.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?(L(`In page link (#${o}) not found in iFrame, so sending to parent`),vt(0,0,"inPageLink",`#${o}`)):n(r)}function o(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&n(t)}function i(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&M(e,"click",(t=>{t.preventDefault(),n(e.getAttribute("href"))}))}function r(){M(window,"hashchange",o)}function a(){setTimeout(o,128)}function l(){L("Setting up location.hash handlers"),i(),r(),a()}return ge.enable?1===ve?_("In page linking requires a Professional or Business license. Please see <u>https://iframe-resizer.com/pricing</> for more details."):l():L("In page linking not enabled"),{findTarget:n}}(),void 0===oe&&(oe=`${G}px`),Ze("margin",(n="margin",(o=oe).includes("-")&&(J(`Negative CSS value ignored for ${n}`),o=""),o)),Ze("background",Z),Ze("padding",ie),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),function(){const e=e=>e.style.setProperty("height","auto","important");e(document.documentElement),e(document.body),L("Set HTML & body height: %cauto !important",m)}(),!0!==V&&L("Auto Resize disabled"),Qe({method:t="add",eventType:"After Print",eventName:"afterprint"}),Qe({method:t,eventType:"Before Print",eventName:"beforeprint"}),Qe({method:t,eventType:"Ready State Change",eventName:"readystatechange"}),function(){const e=new Set;let t=!1,n=0,o=[];const i=t=>{L("Mutations observed:",t.length);for(const n of t){const{addedNodes:t,removedNodes:o}=n;for(const n of t)e.add(n);for(const t of o)e.delete(t)}},r=16,a=2,l=200;let s=1;function c(){U("mutationObserver");const d=performance.now(),u=d-n,f=r*s+++a;if(u>f&&u<l)return L(`MutationObserver delay: %c${u}ms > ${f}ms`,m),setTimeout(c,r*s),void(n=d);s=1,o.forEach(i),o=[],0!==e.size?(_e(),We(),Ve(e),e.forEach(tt),e.clear(),t=!1):t=!1}function d(e){o.push(e),t||(n=performance.now(),t=!0,requestAnimationFrame(c))}function u(){const e=new window.MutationObserver(d),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return L("Setup <body> MutationObserver"),e.observe(t,n),e}u()}(),L("Setup ResizeObserver"),Ee=new ResizeObserver(Ke),Ee.observe(document.body),et.add(document.body),tt(document.body),re!==ae&&(L("Setup OverflowObserver"),we=(e=>{const t=e.side||b,n=e.onChange||P,o=(e,n)=>0===e||e>n[t],i=e=>Object.hasOwn(e.dataset,"overflowIgnore"),r={root:e.root,rootMargin:"0px",threshold:1},a=()=>n(document.querySelectorAll(`[${y}]`)),l=(e,t)=>e.toggleAttribute(y,t),s=new IntersectionObserver((function(e){for(const r of e){const{boundingClientRect:e,rootBounds:a,target:s}=r,c=e[t],d=!((n=s).hidden||null===n.offsetParent||"none"===n.style.display||i(s))&&o(c,a);l(s,d)}var n;ee(a)}),r),c=new WeakSet;return function(e){L("Attached overflowObservers");for(const t of e)t.nodeType!==Node.ELEMENT_NODE||c.has(t)||(s.observe(t),c.add(t))}})({onChange:De,root:document.documentElement,side:re?b:z})),Ve(it(document)()),queueMicrotask(qe),L("Initialization complete"),ht("init","Init message from host page",void 0,void 0,p),document.title&&""!==document.title&&vt(0,0,"title",document.title)}function De(e){$e=e,ce=$e.length>0,ce&&(L("Observed Elements:",e.length),ht(E,"Overflow updated"))}function We(){je=document.querySelectorAll(`[${g}]`),de=je.length>0,L(`Tagged elements found: %c${de}`,de?m:f)}function Ve(e){de||we(e)}let He=0;function Ue(){const n=document.querySelectorAll(`*[${v}]`);se=n.length>0,se&&n.length!==He&&(function(n){const o=1===n.length?"":"s";J(`%c[${v}]%c found on %c${n.length}%c element${o}`,t,e,t,e)}(n),He=n.length)}function Ze(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),B(`Set body ${e}: %c${t}`,m))}function Je(e,t,n){if(""!==n){L(`${e}: %c${n}`,m);for(const e of document.querySelectorAll(n))L(`Applying ${t} to:`,e),e.toggleAttribute(t,!0)}}function _e(){Je("sizeSelector",g,Oe),Je("ignoreSelector",v,fe)}function Qe(e){({add(t){function n(){ht(e.eventName,e.eventType)}a[t]=n,M(window,t,n,{passive:!0})},remove(e){const t=a[e];var n,o;delete a[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),L(`${C(e.method)} event listener: %c${e.eventType}`,m)}function Ge(e,t,n,o){return t!==e&&(e in n||(J(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in r&&_(`<rb>Deprecated ${o}CalculationMethod (${e})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${o} calculation method. It is recommended that you remove this option.`),L(`Set ${o} calculation method: %c${e}`,m)),e}function Xe(){me=Ge(me,s,ct,"height")}function Ye(){Ne=Ge(Ne,u,dt,"width")}function Ke(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;ht(S,`Element resized <${I(t)}>`)}const et=new WeakSet;function tt(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!et.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(Ee.observe(e),et.add(e),L(`Attached resizeObserver: %c${I(e)}`,m))}const t=it(e)();for(const e of t){if(et.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(Ee.observe(e),et.add(e),L(`Attached resizeObserver: %c${I(e)}`,m))}}function nt(e){performance.mark(te);const t=C(e);let n=0,i=document.documentElement,r=de?0:document.documentElement.getBoundingClientRect().bottom;const a=de?je:ce?$e:it(document)();let s=a.length;for(const t of a)de||!l||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,i=t)):s-=1;return B(`${t} position calculated from:`,i),performance.mark(ne,{detail:{Side:t,len:s,hasTags:de,logging:ye}}),r}const ot=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],it=e=>()=>{Ue();const t=["* ","not(head)","not(meta)","not(base)","not(title)","not(script)","not(link)","not(style)","not(map)","not(area)","not(option)","not(optgroup)","not(template)","not(track)","not(wbr)","not(nobr)"];return se&&t.push(`not([${v}])`,`not([${v}] *)`),e.querySelectorAll(t.join(":"))},rt={height:0,width:0},at={height:0,width:0},lt=[m,f,m];function st(e){function t(){return at[o]=i,rt[o]=l,i}const n=e===ct,o=n?"height":"width",i=e.boundingClientRect(),r=Math.ceil(i),a=Math.floor(i),l=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),s=`HTML: %c${i}px %cPage: %c${l}px`;let c=0;switch(!0){case!e.enabled():return l;case de:B("Found element with data-iframe-size attribute"),c=e.taggedElement();break;case!ce&&0===at[o]&&0===rt[o]:B(`Initial page size values: ${s}`,...lt),c=t();break;case Ce&&i===at[o]&&l===rt[o]:B(`Size unchanged: ${s}`,...lt),c=Math.max(i,l);break;case 0===i:B(`Page is hidden: ${s}`,...lt),c=l;break;case!ce&&i!==at[o]&&l<=rt[o]:B(`New <html> size: ${s} `,...lt),B(`Previous <html> size: %c${at[o]}px`,m),c=t();break;case!n:c=e.taggedElement();break;case!ce&&i<at[o]:B(`<html> size decreased: ${s}`,...lt),c=t();break;case l===a||l===r:B(`<html> size equals page size: ${s}`,...lt),c=t();break;case i>l:B(`Page size < <html> size: ${s}`,...lt),c=t();break;case ce:B("Found element overflowing <html> "),c=e.taggedElement();break;default:c=t()}return B(`Content ${o}: %c${c}px`,m),c+=function(e){const t=e.getOffset();return 0!==t&&B(`Page offsetSize: %c${t}px`,m),t}(e),c}const ct={enabled:()=>re,getOffset:()=>O,auto:()=>st(ct),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,h)+parseInt(t.marginBottom,h)},bodyScroll:()=>document.body.scrollHeight,offset:()=>ct.bodyOffset(),custom:()=>i.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...ot(ct)),min:()=>Math.min(...ot(ct)),grow:()=>ct.max(),lowestElement:()=>nt(b),taggedElement:()=>nt(b)},dt={enabled:()=>ae,getOffset:()=>T,auto:()=>st(dt),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>i.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...ot(dt)),min:()=>Math.min(...ot(dt)),rightMostElement:()=>nt(z),scroll:()=>Math.max(dt.bodyScroll(),dt.documentElementScroll()),taggedElement:()=>nt(z)},ut=(e,t)=>!(Math.abs(e-t)<=Ae);function mt(e,t,n,o,i){const r=void 0===n?ct[me]():n,a=void 0===o?dt[Ne]():o;switch(!0){case re&&ut(ue,r)||ae&&ut(Ie,a)||"init"===e:ue=r,Ie=a;case e===$:vt(ue,Ie,e,i);break;case!e!==w&&(re&&me in d||ae&&Ne in d):yt(t);break;case e===S:case e===E:L("No change in content size detected");break;default:B("No change in content size detected")}q=!1}let ft=!1;const pt=k((()=>Q(j(4)))),ht=H(((e,t,n,o,i)=>{F=performance.now(),U(e),V||e===w?document.hidden?L("Page hidden - Ignored resize request"):(ft||(L(`Resize event: %c${t}`,m),q=!0,mt(e,t,n,o,i),requestAnimationFrame((()=>{ft=!1}))),ft=!0):B("Resizing disabled")}));function gt(e){ue=ct[me](),Ie=dt[Ne](),vt(ue,Ie,e)}function yt(e){const t=me;me=s,L(`Reset trigger event: %c${e}`,m),Ce?L("TriggerLock blocked calculation"):(Ce=!0,D("Trigger event lock on"),requestAnimationFrame((()=>{Ce=!1,D("Trigger event lock off")}))),gt("reset"),me=t}const vt=H((function(e,t,o,i,r){ve<-1||(U(o),void 0!==r?L(`Message targetOrigin: %c${r}`,m):r=Pe,function(){const a=`${ze}:${e}:${t}:${o}${void 0===i?"":`:${i}`}`;if(Me)try{window.parent.iframeParentListener(c+a)}catch(e){if(1!==ve)throw e;return void pt()}else ke.postMessage(c+a,r);q&&B(function(){const e=A(performance.now()-F);return"init"===o?`Initialised iFrame in %c${e}ms`:`Size calculated in %c${e}ms`}(),m),B("Sending message to host page via "+(Me?"sameDomain":"postMessage")),B(`%c${a}`,n)}(),W())})),bt=H((function(e){const{freeze:t}=Object,{parse:n}=JSON,o=e=>vt(0,0,`${e}Stop`),i={init:function(){he=e.data,ke=e.source,R=e.origin,Fe(),le=!1,setTimeout((()=>{pe=!1}),128)},reset(){pe?L("Page reset ignored by init"):(L("Page size reset by host page"),gt("resetPage"))},resize(){ht(w,"Parent window requested size check")},moveToAnchor(){ge.findTarget(a())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=a();L(`PageInfo received from parent: ${e}`),Le?setTimeout((()=>Le(n(e)))):o("pageInfo")},parentInfo(){const e=a();L(`ParentInfo received from parent: ${e}`),Be?setTimeout((()=>Be(t(n(e))))):o("parentInfo")},message(){const e=a();L(`onMessage called from parent: ${e}`),setTimeout((()=>xe(n(e))))}},r=()=>e.data.split("]")[1].split(":")[0],a=()=>e.data.slice(e.data.indexOf(":")+1),l=()=>e.data.split(":")[2]in{true:1,false:1};function s(){const t=r();t in i?i[t]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||l()||J(`Unexpected message (${e.data})`)}c===`${e.data}`.slice(0,13)&&(U(r()),!1!==le?l()?i.init():L(`Ignored message of type "${r()}". Received before initialization.`):s())}));function zt(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?J("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>bt({data:e,sameDomain:!0}))),M(window,"message",bt),M(window,"readystatechange",zt),zt())}()}();
|
|
21
21
|
//# sourceMappingURL=iframeResizer.contentWindow.js.map
|