@iframe-resizer/child 6.0.0-beta.0 → 6.0.0-beta.1
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/README.md +1 -1
- package/iframe-resizer.child.d.ts +5 -1
- package/index.cjs.js +19 -28
- package/index.cjs.js.map +1 -1
- package/index.esm.js +731 -761
- package/index.esm.js.map +1 -1
- package/index.umd.js +21 -30
- package/index.umd.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,7 +28,11 @@ declare module '@iframe-resizer/child' {
|
|
|
28
28
|
/**
|
|
29
29
|
* Called before new size is set. Return a number to modify the new size.
|
|
30
30
|
*/
|
|
31
|
-
onBeforeResize?(
|
|
31
|
+
onBeforeResize?(
|
|
32
|
+
newSize: number,
|
|
33
|
+
event: string,
|
|
34
|
+
direction: 'height' | 'width',
|
|
35
|
+
): number
|
|
32
36
|
|
|
33
37
|
/**
|
|
34
38
|
* Receive message posted from the parent page with the iframe.iframeResizer.sendMessage() method.
|
package/index.cjs.js
CHANGED
|
@@ -1,52 +1,43 @@
|
|
|
1
|
-
"use strict";const
|
|
2
|
-
`,
|
|
1
|
+
"use strict";const r=require("auto-console-group"),C="6.0.0-beta.1",Fe="iframeResizer",pe=":",$n="[iFrameResizerChild]Ready",Ln="autoResize",An="beforeUnload",kn="close",Nn="inPageLink",ye="init",Ne="message",Gn="mouseenter",Cn="mouseleave",kt="pageHide",Nt="pageInfo",Gt="parentInfo",Pn="pageInfoStop",jn="parentInfoStop",Dn="scrollBy",_n="scrollTo",Ct="scrollToOffset",xn="title",ne=10,Q=1,ve="data-iframe-size",Pt="data-iframe-overflowed",J="data-iframe-ignore",be="height",jt="width",Te="offset",Re="offsetSize",Be=`
|
|
2
|
+
`,K="string",A="number",Fn="boolean",Bn="object",ze="function",Un="undefined",Wn="false",Vn="null",$="auto",Dt="readystatechange",_t="bottom",xt="right",Ge="autoResizeEnabled",at=Symbol("sizeChanged"),Ue="manualResize",We="parentResize",He={[Ue]:1,[We]:1},Ft="setOffsetSize",Bt="resizeObserver",Ve="overflowObserver",Ut="mutationObserver",Wt="visibilityObserver",qn="font-weight: bold;",qe="none",lt="No change in content size detected",le="[iFrameSizer]",Vt=le.length,Zn=$,qt=128,Zt=new Set(["head","body","meta","base","title","script","link","style","map","area","option","optgroup","template","track","wbr","nobr"]),Qn=e=>(t,n="renamed to")=>(o,s,u="",l="")=>e(l,`<rb>Deprecated ${t}(${o.replace("()","")})</>
|
|
3
3
|
|
|
4
|
-
The <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${
|
|
5
|
-
`,rb:"\x1B[31;1m",bb:"\x1B[34;1m",b:"\x1B[1m",i:"\x1B[3m",u:"\x1B[4m","/":"\x1B[m"},
|
|
4
|
+
The <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${s}</>. ${u}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`),Yn=e=>typeof e===K,we=(e,...t)=>setTimeout(()=>e(...t),0),Qt=e=>{let t=!1;return function(...n){return t?void 0:(t=!0,e.apply(this,n))}},de=e=>e,dt=1e3,G=e=>Math.round(e*dt)/dt,Yt=e=>e.charAt(0).toUpperCase()+e.slice(1),x=e=>`${e}`!=""&&e!==void 0,Jn=e=>e(),Kn=e=>e.toLowerCase();function Xn(e){switch(!0){case!x(e):return"";case x(e.id):return`${e.nodeName}#${e.id}`;case x(e.name):return`${e.nodeName} (${e.name}`;case x(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}const eo=e=>e?.__esModule?e.default:e,E=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${Yt(t)}`)},Jt={br:`
|
|
5
|
+
`,rb:"\x1B[31;1m",bb:"\x1B[34;1m",b:"\x1B[1m",i:"\x1B[3m",u:"\x1B[4m","/":"\x1B[m"},to=Object.keys(Jt),no=new RegExp(`<(${to.join("|")})>`,"gi"),oo=(e,t)=>Jt[t]??"",so=e=>e.replace(no,oo),ro=e=>e.replaceAll("<br>",Be).replaceAll(/<\/?[^>]+>/gi,""),io=e=>t=>e(Yn(t)?window.chrome?so(t):ro(t):t);let Ze=!0,Ce=Fe;const co=eo(r),Y=co({label:`${Fe}(child)`,expand:!1});function ao(e){Ce=e.id||Fe,Y.label(`${Ce}`),Y.expand(e.expand),Ze=e.enabled}const Kt=e=>(...t)=>Ze?Y[e](...t):!0,a=Kt("log"),d=a,ue=Kt("debug");function lo(e,t){console.info(`${Ce} %ciframe-resizer ${e}`,Ze||t<1?qn:r.NORMAL)}const{assert:wi,endAutoGroup:j,error:Xt,errorBoundary:Qe,event:h,label:Ii,purge:Oi,warn:P}=Y,uo=io(de),p=(...e)=>Y.warn(...e.map(uo)),Ye=Qn((e,t)=>p(t)),en=Ye("Method"),fo=Ye("Method","replaced with"),mo=Ye("Option"),Je=[];function tn(e,t){a(`${e} event listener: %c${t}`,r.HIGHLIGHT)}const nn=(e,t,n,o)=>{e.removeEventListener(t,n,o),tn("Removed",t)},k=(e,t,n,o=!1)=>{e.addEventListener(t,n,o),Je.push(()=>nn(e,t,n,o)),tn("Added",t)},i={applySelectors:null,firstRun:!0,hasTags:!1,hasOverflow:!1,height:0,isHidden:!1,initLock:!0,inPageLinks:{},origin:void 0,hasOverflowUpdated:!0,overflowedNodeSet:new Set,sameOrigin:!1,taggedElements:[],target:window?.parent,timerActive:!1,totalTime:0,triggerLocked:!1,width:0,win:window,onPageInfo:null,onParentInfo:null};let ut=!1;const ft=e=>e.postMessage($n,window?.iframeResizer?.targetOrigin||"*");function mt(){if(document.readyState==="loading"||!i.firstRun||ut)return;const{parent:e,top:t}=window;h("ready"),a("Sending%c ready%c to parent from",r.HIGHLIGHT,r.FOREGROUND,window.location.href),ft(e),e!==t&&ft(t),ut=!0}const ht="iframeResize",ho=e=>le===`${e.data}`.slice(0,Vt),go=()=>ht in window||window.jQuery!==void 0&&ht in window.jQuery.prototype,po=e=>e.data.split(pe)[2]in{true:1,false:1},yo=()=>[document.documentElement,document.body],vo=["min-height","min-width","max-height","max-width"],gt=new Set,bo=e=>!!e&&e!=="0px"&&e!==$&&e!==qe,on=e=>e.tagName?e.tagName.toLowerCase():"unknown",sn=(e,t)=>window.getComputedStyle(e).getPropertyValue(t),zo=(e,t)=>bo(sn(e,t));function wo(e,t){const n=e.style[t];return n?{source:"an inline style attribute",value:n}:null}function Io({href:e}){gt.has(e)||(a("Unable to access stylesheet:",e),gt.add(e))}function Oo(e,t){for(const n of document.styleSheets)try{for(const o of n.cssRules||[])if(o.selectorText&&e.matches(o.selectorText)){const s=o.style[t];if(s)return{source:n.ownerNode.tagName==="STYLE"?"an inline <style> block":`stylesheet (${n.href})`,value:s}}}catch{Io(n)}return{source:"cross-origin stylesheet",value:sn(e,t)}}const Eo=(e,t)=>wo(e,t)||Oo(e,t),So=(e,t)=>{const{source:n,value:o}=Eo(e,t),s=on(e);p(`The <b>${t}</> CSS property is set to <b>${o}</> on the <b><${s}></> element via ${n}. This may cause issues with the correct operation of <i>iframe-resizer</>.
|
|
6
6
|
|
|
7
|
-
If you wish to restrict the size of the iframe, then you should set this property on the iframe element itself, not the content inside it.`)};function
|
|
7
|
+
If you wish to restrict the size of the iframe, then you should set this property on the iframe element itself, not the content inside it.`)};function To(){for(const e of yo())for(const t of vo)a(`Checking <${on(e)}> for blocking CSS: ${t}`),zo(e,t)&&So(e,t)}const Ro=({calculateWidth:e,calculateHeight:t})=>e===t,c={autoResize:!0,bodyBackground:"",bodyMargin:0,bodyMarginStr:"",bodyPadding:"",calculateHeight:!0,calculateWidth:!1,heightCalcMode:$,ignoreSelector:"",inPageLinks:!1,logging:!1,logExpand:!1,mode:0,mouseEvents:!1,offsetHeight:0,offsetWidth:0,parentId:void 0,sizeSelector:"",targetOrigin:"*",tolerance:0,widthCalcMode:$,onBeforeResize:void 0,onMessage:()=>{P("onMessage function not defined")},onReady:()=>{}},M=[r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT],ce={height:0,width:0},_={height:0,width:0};function D(e,t,n){return _[e]=t,ce[e]=n,t}function Ho(e){const t=e.getOffset();return t!==0&&d(`Page offsetSize: %c${t}px`,r.HIGHLIGHT),t}const Mo=e=>e.documentElementScroll()+Math.max(0,e.getOffset());function rn(e){const{hasOverflow:t,hasTags:n,triggerLocked:o}=i,s=e.label,u=s===be,l=e.boundingClientRect(),m=Math.ceil(l),b=Math.floor(l),f=Mo(e),z=`HTML: %c${l}px %cPage: %c${f}px`;let g;switch(!0){case!e.enabled():return Math.max(f,Q);case n:d("Found element with data-iframe-size attribute"),g=e.taggedElement();break;case(!t&&i.firstRun&&_[s]===0&&ce[s]===0):d(`Initial page size values: ${z}`,...M),g=D(s,l,f);break;case(o&&l===_[s]&&f===ce[s]):d(`Size unchanged: ${z}`,...M),g=Math.max(l,f);break;case(l===0&&f!==0):d(`Page is hidden: ${z}`,...M),g=f;break;case(!t&&l!==_[s]&&f<=ce[s]):d(`New <html> size: ${z} `,...M),d(`Previous <html> size: %c${_[s]}px`,r.HIGHLIGHT),g=D(s,l,f);break;case!u:g=e.taggedElement();break;case(!t&&l<_[s]):d(`<html> size decreased: ${z}`,...M),g=D(s,l,f);break;case(f===b||f===m):d(`<html> size equals page size: ${z}`,...M),g=D(s,l,f);break;case l>f:d(`Page size < <html> size: ${z}`,...M),g=D(s,l,f);break;case t:d("Found elements possibly overflowing <html> "),g=e.taggedElement();break;default:d(`Using <html> size: ${z}`,...M),g=D(s,l,f)}return d(`Content ${s}: %c${g}px`,r.HIGHLIGHT),g+=Ho(e),Math.max(g,Q)}const $o=1e3,Lo=5*$o,Ao=4,ko=10,No=100,Ke="--ifr-start",fe="--ifr-end",cn="--ifr-measure",v=[];let ae={},pt=0,Pe;function an(){try{performance.clearMarks(Ke),performance.clearMarks(fe),performance.clearMeasures(cn)}catch{}}function Go(){Pe=setInterval(()=>{if(v.length<ko||ae.hasTags&&ae.len<25)return;v.sort();const e=Math.min(v.reduce((n,o)=>n+o,0)/v.length,v[Math.floor(v.length/2)]),t=G(e);t>pt&&(pt=t,h("performanceObserver"),a("Mean time:",G(v[Math.floor(v.length/2)])),a("Median time:",G(v.reduce((n,o)=>n+o,0)/v.length)),a("Average time:",t),a("Max time:",G(Math.max(...v)))),an(),!(e<=Ao)&&(clearInterval(Pe),p(`<rb>Performance Warning</>
|
|
8
8
|
|
|
9
|
-
Calculating the page size is taking an excessive amount of time (${
|
|
9
|
+
Calculating the page size is taking an excessive amount of time (${G(e)}ms).
|
|
10
10
|
|
|
11
|
-
To improve performance add the <b>data-iframe-size</> attribute to the ${
|
|
11
|
+
To 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</>.`))},Lo)}function Co(e){e.getEntries().forEach(t=>{if(t.name===fe)try{const{duration:n}=performance.measure(cn,Ke,fe);ae=t.detail,v.push(n),v.length>No&&v.shift()}catch{}})}function Po(){d("Attached%c PerformanceObserver%c to page",r.HIGHLIGHT,r.FOREGROUND);const e=new PerformanceObserver(Co);return e.observe({entryTypes:["mark"]}),Go(),{disconnect:()=>{an(),clearInterval(Pe),e.disconnect(),d("Detached%c PerformanceObserver",r.HIGHLIGHT)}}}const jo=e=>`:not(${e})`,Do=`* ${Array.from(Zt).map(jo).join("")}`,Xe=e=>e.querySelectorAll(Do);function _o(){const{hasOverflow:e,hasTags:t,overflowedNodeSet:n,taggedElements:o}=i;return t?o:e?Array.from(n):Xe(document.documentElement)}function xo(e,t){const n=`margin-${t}`;let o,s=document.documentElement,u=i.hasTags?Q:document.documentElement.getBoundingClientRect().bottom;for(const l of e)o=l.getBoundingClientRect()[t]+parseFloat(getComputedStyle(l).getPropertyValue(n)),o>u&&(u=o,s=l);return{maxEl:s,maxVal:u}}function ln(e){performance.mark(Ke);const t=Yt(e),{logging:n}=c,{hasTags:o}=i,s=_o(),{maxEl:u,maxVal:l}=xo(s,e);return d(`${t} position calculated from:`,u),d(`Checked %c${s.length}%c elements`,r.HIGHLIGHT,r.FOREGROUND),performance.mark(fe,{detail:{hasTags:o,len:s.length,logging:n,Side:t}}),l}const Ie={label:be,enabled:()=>c.calculateHeight,getOffset:()=>c.offsetHeight,auto:()=>rn(Ie),boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),documentElementScroll:()=>document.documentElement.scrollHeight,taggedElement:()=>ln(_t)},Oe={label:jt,enabled:()=>c.calculateWidth,getOffset:()=>c.offsetWidth,auto:()=>rn(Oe),boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),documentElementScroll:()=>document.documentElement.scrollWidth,taggedElement:()=>ln(xt)};function dn(e,t){const{label:n}=t;return e&&e!==$&&p(`<rb>Ignored ${n}CalculationMethod (${e})</>
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
license: 'xxxx',
|
|
15
|
-
${e}CalculationMethod: '${Ee}',
|
|
16
|
-
}
|
|
17
|
-
`;function qo(e,t){const n=i.version?"remove this option.":Vo(e);g(`<rb>Deprecated ${e}CalculationMethod (${t})</>
|
|
13
|
+
This version of <i>iframe-resizer</> auto detects the most suitable ${n} calculation method. The <b>${n}CalculationMethod</> option is no longer supported and has been ignored.
|
|
18
14
|
|
|
19
|
-
|
|
20
|
-
`)
|
|
15
|
+
To remove this warning, delete the <b>${n}CalculationMethod</> option from your parent page config and/or the <i>window.iframeResizer</> config on the child page.
|
|
16
|
+
`),a(`Set ${n} calculation method: %c${$}`,r.HIGHLIGHT),$}function Fo(){c.heightCalcMode=dn(c.heightCalcMode,Ie)}function Bo(){c.widthCalcMode=dn(c.widthCalcMode,Oe)}function Uo(){try{i.sameOrigin=c.mode===1||"iframeParentListener"in window.parent}catch{a("Cross domain iframe detected")}}const Wo=`<rb>Deprecated Attributes</>
|
|
21
17
|
|
|
22
|
-
The <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</>.`;function
|
|
18
|
+
The <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</>.`;function Vo(){let e=!1;const t=n=>document.querySelectorAll(`[${n}]`).forEach(o=>{o.toggleAttribute(ve,!0),o.removeAttribute(n),e=!0});t("data-iframe-height"),t("data-iframe-width"),e&&p(Wo)}let yt=0;function qo(e){const t=e.length===1?"":"s";P(`%c[${J}]%c found on %c${e.length}%c element${t}`,r.BOLD,r.NORMAL,r.BOLD,r.NORMAL)}function Zo(){const e=document.querySelectorAll(`*[${J}]`),t=e.length>0;return t&&e.length!==yt&&(qo(e),yt=e.length),t}const me=e=>{if(!e)return"";let t=-559038744,n=1103547984;for(let o,s=0;s<e.length;s++)o=e.codePointAt(s),t=Math.imul(t^o,2246822519),n=Math.imul(n^o,3266489917);return t^=Math.imul(t^n>>>15,1935289751),n^=Math.imul(n^t>>>15,3405138345),t^=n>>>16,n^=t>>>16,(2097152*(n>>>0)+(t>>>11)).toString(36)},H=e=>e.replace(/[A-Za-z]/g,t=>String.fromCodePoint((t<="Z"?90:122)>=(t=t.codePointAt(0)+19)?t:t-26)),Qo=new Date,un=e=>new Set(Array.from({length:9},e)),Yo=e=>[e[0],...e.slice(1).map(t=>`${t} - lewpylk`),`${e[4]} - lewpylk`,...e.slice(1)],F=["spjluzl","rlf","clyzpvu","rlf2","nlaMbssFlhy"],Jo=["<yi>Puchspk Spjluzl Rlf</><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.","Pu whnl spurpun ylxbpylz h Wyvmlzzpvuhs vy Ibzpulzz spjluzl. Wslhzl zll <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</> mvy tvyl klahpsz.","<yi>Clyzpvu 5 rlf klaljalk</><iy><iy>Av bwnyhkl av <i>Clyzpvu 6</> vm <p>pmyhtl-ylzpgly</> fvb jhu bzl aol mpyza 11 johyhjalyz vm fvb spjlujl rlf av nla h 60% kpzjvbua ha <ii>oaaw://pmyhtl-ylzpgly.jvt</>.","<yi>Clyzpvu 5 rlf klaljalk</><iy><iy>Av bwnyhkl av clyzpvu 6 vm<p>pmyhtl-ylzpgly</> wslhzl kvdusvhk aol shalza rlf myvt sltvu-zxbllgf.jvt.","<yi>VLT rlf lewpylk</><iy><iy>Wslhzl kvdusvhk aol shalza rlf myvt sltvu-zxbllgf.jvt."],Ko=Yo(["NWSc3","zvsv","wyv","ibzpulzz","VLT"]),vt=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5","1foobarqaz","2b5sdlfhbev","zo4ui3arjo","oclbb4thgl","igb1wzrjqr"].map((e,t)=>[e,Math.max(0,t-1)])),Xo=new Set([1,6]),fn=Qo[H(F[4])](),es=un((e,t)=>me(`${fn+t}`)),ts=un((e,t)=>me(`${fn-++t}`)),ns=e=>es.has(e)?9:ts.has(e)?5:-2,et=e=>Xo.has(e),B=e=>H(Jo[e]),os=e=>H(Ko[e]),bt=e=>H(F[e]),zt=e=>{const t=e[H(F[0])]||e[H(F[1])]||e[H(F[2])]||e[H(F[3])];if(!t)return-1;const n=t.split("-");let o=(function(s="",u=""){let l=-2;const m=me(H(s));return m in vt&&(l=vt[m]),l===9?ns(u):l})(...n);return o===0||(s=>s[2]===me(s[0]+s[1]))(n)||(o=-2),o};function ss({key:e,key2:t,mode:n,version:o}){const s=n,u=zt({key:e}),l=zt({key2:t});if(c.mode=n=Math.max(u,l),n<0){if(n=Math.min(u,l),p(`${B(n+2)}${B(2)}`),x(o))throw i.firstRun=!1,B(n+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"")}else(!x(o)||s>-1&&n>s)&&(sessionStorage.getItem("ifr")!==C&&lo(`v${C} (${os(n)})`,n),n<2&&p(B(3)),sessionStorage.setItem("ifr",C))}const rs="BackCompat",is=`<rb>Quirks Mode Detected</>
|
|
23
19
|
|
|
24
20
|
This 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</>.
|
|
25
21
|
|
|
26
22
|
For more information see <u>https://iframe-resizer.com/quirks-mode</>.
|
|
27
|
-
`;function
|
|
23
|
+
`;function cs(){document.compatMode===rs&&p(is)}const as="complete";let wt=!1;function mn(e){document.readyState===as?we(e):wt||k(document,Dt,()=>mn(e)),wt=!0}const ls=()=>{d(`Set targetOrigin for parent: %c${c.targetOrigin}`,r.HIGHLIGHT),c.autoResize!==!0&&a("Auto Resize disabled")};function hn(){i.taggedElements=document.querySelectorAll(`[${ve}]`),i.hasTags=i.taggedElements.length>0,a(`Tagged elements found: %c${i.hasTags}`,r.HIGHLIGHT)}const ds=`<rb>Legacy version detected on parent page</>
|
|
28
24
|
|
|
29
25
|
Detected legacy version of parent page script. It is recommended to update the parent page to use <b>@iframe-resizer/parent</>.
|
|
30
26
|
|
|
31
27
|
See <u>https://iframe-resizer.com/setup/</> for more details.
|
|
32
|
-
`,
|
|
28
|
+
`,us=e=>`<b>Version mismatch</>
|
|
33
29
|
|
|
34
30
|
The parent and child pages are running different versions of <i>iframe resizer</>.
|
|
35
31
|
|
|
36
|
-
Parent page: ${e} - Child page: ${
|
|
37
|
-
`;function
|
|
32
|
+
Parent page: ${e} - Child page: ${C}.
|
|
33
|
+
`;function fs({version:e}){!e||e===""||e===Wn?p(ds):e!==C&&p(us(e))}const ms=Qt(()=>p(B(4)));function hs(e){if(!i.timerActive)return;const t=G(performance.now()-i.totalTime),n=e===ye?`Initialised iframe in %c${t}ms`:`Size calculated in %c${t}ms`;a(n,r.HIGHLIGHT)}function gs(e){return e===void 0?e=c.targetOrigin:a(`Message targetOrigin: %c${e}`,r.HIGHLIGHT),e}function ps(e,t){const{mode:n}=c,{sameOrigin:o,target:s}=i;if(o)try{window.parent.iframeParentListener(le+e)}catch(u){if(et(n))ms();else throw u;return!1}else s.postMessage(le+e,gs(t));return!0}function gn(e,t,n,o,s){const{parentId:u}=c,{sameOrigin:l}=i,m=`${e}:${t}`,b=`${u}:${m}:${n}${o===void 0?"":`:${o}`}`;c.mode<-1||!ps(b,s)||(hs(n),d(`Sending message to parent page via ${l?"sameOrigin":"postMessage"}: %c%c${b}`,r.ITALIC,r.HIGHLIGHT))}const y=Qe((e,t,n,o,s)=>{h(n),gn(e,t,n,o,s),j()}),ys=e=>y(0,0,e.type,`${e.screenY}:${e.screenX}`);function It(e,t){a(`Add event listener: %c${t}`,r.HIGHLIGHT),k(window.document,e,ys)}function vs({mouseEvents:e}){e===!0&&(It(Gn,"Mouse Enter"),It(Cn,"Mouse Leave"))}const bs=()=>y(0,0,An);function zs({persisted:e}){e||bs(),h(kt),d("Page persisted:",e),!e&&Je.forEach(Jn)}const ws=()=>k(window,Kn(kt),zs),Ot=(e,t)=>!(Math.abs(e-t)<=c.tolerance);function Is(e,t){const{calculateHeight:n,calculateWidth:o}=c,{height:s,width:u}=i;return n&&Ot(s,e)||o&&Ot(u,t)}function Os(e,t,n){const o=c.onBeforeResize(e,t,n);if(o===void 0)throw new TypeError("No value returned from onBeforeResize(), expected a numeric value");if(Number.isNaN(o))throw new TypeError(`Invalid value returned from onBeforeResize(): ${o}, expected Number`);if(o<Q)throw new RangeError(`Out of range value returned from onBeforeResize(): ${o}, must be at least ${Q}`);return o}const pn=(e,t)=>(n,o)=>{const s=e[n]();return e.enabled()&&c.onBeforeResize!==void 0?Os(s,o,t):s},Es=pn(Ie,be),Ss=pn(Oe,jt);function Ts(e,t,n,o){const{heightCalcMode:s,widthCalcMode:u}=c,l=n??Es(s,e),m=o??Ss(u,e),b=Is(l,m)?at:e;switch(a(`Resize event: %c${t}`,r.HIGHLIGHT),b){case ye:case Ge:case at:case Ue:case We:i.height=l,i.width=m;case Ft:return i;case Ve:case Ut:case Bt:case Wt:{a(lt);break}default:d(lt)}return null}let oe=!1,Me=!1,V=null;function Rs(e,t,n,o,s){const{autoResize:u}=c,{isHidden:l}=i;switch(h(e),!0){case(l===!0&&!(e in He)):{if(Me===!0)break;a("Iframe hidden - Ignored resize request"),Me=!0,oe=!1,cancelAnimationFrame(V),V=null;break}case(oe===!0&&e!==Ve&&!(e in He)):{a("Resize already pending - Ignored resize request");break}case(!u&&!(e in He)):{d("Resizing disabled");break}default:{Me=!1,oe=!0,i.totalTime=performance.now(),i.timerActive=!0;const m=Ts(e,t,n,o);m&&gn(m.height,m.width,e,s),V||(V=requestAnimationFrame(()=>{oe=!1,V=null,h("requestAnimationFrame"),ue(`Reset sendPending: %c${e}`,r.HIGHLIGHT)})),i.timerActive=!1}}j()}const S=Qe(Rs);function Et({eventType:e,eventName:t}){k(window,t,()=>S(t,e),{passive:!0})}function Hs(){Et({eventType:"After Print",eventName:"afterprint"}),Et({eventType:"Before Print",eventName:"beforeprint"})}function Ms(){if(i.triggerLocked){a("TriggerLock blocked calculation");return}i.triggerLocked=!0,ue("Trigger event lock on"),requestAnimationFrame(()=>{i.triggerLocked=!1,ue("Trigger event lock off")})}function yn(e){const{heightCalcMode:t,widthCalcMode:n}=c,o=Ie[t](),s=Oe[n]();a(`Reset trigger event: %c${e}`,r.HIGHLIGHT),y(o,s,e)}function $s(e){const t=c.heightCalcMode;a(`Reset trigger event: %c${e}`,r.HIGHLIGHT),c.heightCalcMode=Zn,Ms(),yn("reset"),c.heightCalcMode=t}const Ls=`Auto Resize can not be changed when <b>direction</> is set to '${qe}'.`;function As(e){E(e,Fn,"parentIframe.autoResize(enable) enable");const{autoResize:t,calculateHeight:n,calculateWidth:o}=c;return o===!1&&n===!1?(h(Ge),p(Ls),!1):(e===!0&&t===!1?(c.autoResize=!0,queueMicrotask(()=>S(Ge,"Auto Resize enabled"))):e===!1&&t===!0&&(c.autoResize=!1),y(0,0,Ln,JSON.stringify(c.autoResize)),c.autoResize)}function ks(e){E(e,K,"parentIframe.moveToAnchor(anchor) anchor"),i.inPageLinks.findTarget(e)}function Ns(e){E(e,A,"parentIframe.setOffsetSize(offset) offset"),c.offsetHeight=e,c.offsetWidth=e,S(Ft,`parentIframe.setOffsetSize(${e})`)}function Gs(){return h("getOrigin"),en("getOrigin()","getParentOrigin()"),i.origin}const Cs=()=>i.origin;function Ps(e){E(e,K,"parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),a(`Set targetOrigin: %c${e}`,r.HIGHLIGHT),c.targetOrigin=e}function js(e){if(typeof e===ze){i.onPageInfo=e,y(0,0,Nt),fo("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");return}i.onPageInfo=null,y(0,0,Pn)}function vn(e){return E(e,ze,"parentIframe.getParentProps(callback) callback"),i.onParentInfo=e,y(0,0,Gt),()=>{i.onParentInfo=null,y(0,0,jn)}}function Ds(e){en("getParentProperties()","getParentProps()"),vn(e)}const _s=e=>`<rb>Deprecated API object name</>
|
|
38
34
|
The <b>window.parentIFrame</> object has been renamed to <b>window.parentIframe</>. Please update your code as the old object will be removed in a future version.
|
|
39
35
|
|
|
40
36
|
Called property: '${String(e)}'
|
|
41
|
-
`;function
|
|
42
|
-
`,n),j()}),t}function
|
|
43
|
-
`,t),t},
|
|
44
|
-
|
|
45
|
-
The use of <b>${e}CalculationMethod</> as a function is deprecated and will be removed in a future version of <i>iframe-resizer</>. Please use the new <b>onBeforeResize</> event handler instead.
|
|
46
|
-
|
|
47
|
-
See <u>https://iframe-resizer.com/api/child</> for more details.
|
|
48
|
-
`;function Nt(e,t){return typeof e!==ne?e:(g(ni(t)),t===ee?O.custom=e:E.custom=e,ti)}const ct=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},Ne=ct(ne),ce=ct(C),ae=ct(te),oi=e=>e!==null&&typeof e===Vn&&!Array.isArray(e);function ri(e){const{calculateHeight:t,calculateWidth:n}=i;let o,r;return typeof e?.offset===C&&(go(Re,He),t&&(o=ce(e,Re)),n&&(r=ce(e,Re))),typeof e?.offsetSize===C&&(t&&(o=ce(e,He)),n&&(r=ce(e,He))),{offsetHeight:o,offsetWidth:r}}function si(e){a("Reading data from page:",Object.keys(e));const{offsetHeight:t,offsetWidth:n}=ri(e);return{offsetHeight:t,offsetWidth:n,ignoreSelector:ae(e,"ignoreSelector"),key2:ae(e,nr(0)),sizeSelector:ae(e,"sizeSelector"),targetOrigin:ae(e,"targetOrigin"),heightCalcMode:Nt(e?.heightCalculationMethod,ee),widthCalcMode:Nt(e?.widthCalculationMethod,Bt),onBeforeResize:Ne(e,"onBeforeResize"),onMessage:Ne(e,"onMessage"),onReady:Ne(e,"onReady")}}function ii(){const{mode:e}=i;if(e===1)return{};const t=window.iframeResizer||window.iFrameResizer;return oi(t)?si(t):{}}const ci=e=>e==="true",Hn=e=>t=>t===void 0?void 0:e(t),k=Hn(ci),Z=Hn(Number),ai=e=>({parentId:e[0],bodyMargin:Z(e[1]),calculateWidth:k(e[2]),logging:k(e[3]),autoResize:k(e[6]),bodyMarginStr:e[7],heightCalcMode:e[8],bodyBackground:e[9],bodyPadding:e[10],tolerance:Z(e[11]),inPageLinks:k(e[12]),widthCalcMode:e[14],mouseEvents:k(e[15]),offsetHeight:Z(e[16]),offsetWidth:Z(e[17]),calculateHeight:k(e[18]),key:e[19],version:e[20],mode:Z(e[21]),logExpand:k(e[23])});function li(e){const{mode:t}=i;e.forEach(n=>{try{n()}catch(o){if(t<0)throw o;g(`<rb>Error in setup function</>
|
|
37
|
+
`;function xs(e){const t=new Set;return new Proxy(e,{get(n,o){t.has(o)||(p(_s(o)),t.add(o));const s=n[o],u=Object.getOwnPropertyDescriptor(n,o);return u&&!u.configurable&&!u.writable?s:typeof s=="function"?s.bind(n):s}})}function Fs(e,t){e!==void 0&&E(e,A,"parentIframe.resize(customHeight, customWidth) customHeight"),t!==void 0&&E(t,A,"parentIframe.resize(customHeight, customWidth) customWidth");const n=`${e||""}${t?`,${t}`:""}`;S(Ue,`parentIframe.resize(${n})`,e,t)}const tt=e=>(t,n)=>{E(t,A,`parentIframe.${e}(x, y) x`),E(n,A,`parentIframe.${e}(x, y) y`),y(n,t,e)},Bs=tt(Dn),Us=tt(_n),Ws=tt(Ct);function Vs(e,t){t&&E(t,K,"parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),y(0,0,Ne,JSON.stringify(e),t)}const qs=()=>y(0,0,kn),Zs=()=>c.parentId,Qs=()=>$s("parentIframe.reset"),Ys=()=>P("parentIframe.size() has been renamed parentIframe.resize()");function Js(){const{win:e}=i;c.mode!==1&&(e.parentIframe=Object.freeze({autoResize:As,close:qs,getId:Zs,getOrigin:Gs,getParentOrigin:Cs,getPageInfo:js,getParentProps:vn,getParentProperties:Ds,moveToAnchor:ks,reset:Qs,setOffsetSize:Ns,scrollBy:Bs,scrollTo:Us,scrollToOffset:Ws,sendMessage:Vs,setTargetOrigin:Ps,resize:Fs,size:Ys}),e.parentIFrame=xs(e.parentIframe))}const X=(e="")=>t=>n=>{n.size>0&&ue(`${t}Observer ${e}:`,...Array.from(n).flatMap(o=>[Be,o]))},Ks=(e="")=>t=>n=>{n.size>0&&Xt(`${t}Observer ${e}:`,...Array.from(n).flatMap(o=>[Be,o]))},bn=X("attached to"),zn=Ks("already attached"),Xs=X("detached from"),Ee=(e,t=!0)=>n=>{n>0&&d(`${t?"At":"De"}tached %c${e}Observer%c ${t?"to":"from"} %c${n}%c element${n===1?"":"s"}`,r.HIGHLIGHT,r.NORMAL,r.HIGHLIGHT,r.NORMAL)},wn=(e,t,n,o)=>{const s=Xs(e);return u=>{const l=new Set;let m=0;for(const b of u)n.has(b)&&(t.unobserve(b),n.delete(b),l.add(b),m+=1);s(l),o(m),l.clear()}},St=16,Tt=2,er=200,nt="Mutation",I=new Set,L=new Set,je=new Set,he=[],tr={attributes:!0,attributeFilter:[J,ve],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};let $e=1,ot,De=!1,_e=0;const nr=X("added")(nt),or=X("removed (page)")(nt),sr=X("removed (added)")(nt),In=e=>e.nodeType!==Node.ELEMENT_NODE||Zt.has(e.tagName.toLowerCase());function rr(e){const t=e.addedNodes;for(const n of t)In(n)||I.add(n)}function ir(e){const t=e.removedNodes;for(const n of t)In(n)||(I.has(n)?(I.delete(n),je.add(n)):L.add(n))}const cr=e=>{d("Mutations:",e);for(const t of e)rr(t),ir(t);nr(I),or(L),sr(je),je.clear()};function ar(){L.size>0&&a(`Detected %c${L.size} %cremoved element${L.size>1?"s":""}`,r.HIGHLIGHT,r.FOREGROUND),I.size>0&&a(`Found %c${I.size} %cnew element${I.size>1?"s":""}`,r.HIGHLIGHT,r.FOREGROUND)}const lr=e=>()=>{const t=performance.now(),n=t-_e,o=St*$e+++Tt;if(n>o&&n<er){h("mutationThrottled"),d("Update delayed due to heavy workload on the callStack"),d(`EventLoop busy time: %c${G(n)}ms %c> Max wait: %c${o-Tt}ms`,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT),setTimeout(ot,St*$e),_e=t;return}$e=1,he.forEach(cr),he.length=0,De=!1,ar(),e({addedNodes:I,removedNodes:L}),I.clear(),L.clear()};function dr(e){he.push(e),!De&&(_e=performance.now(),De=!0,requestAnimationFrame(ot))}function ur(e){const t=new window.MutationObserver(dr),n=document.body||document.documentElement;return ot=lr(e),t.observe(n,tr),d("Attached%c MutationObserver%c to body",r.HIGHLIGHT,r.FOREGROUND),{...t,disconnect:()=>{I.clear(),L.clear(),he.length=0,t.disconnect(),d("Detached%c MutationObserver",r.HIGHLIGHT)}}}const fr={characterData:!0,childList:!0,subtree:!0};function mr(e){const t=document.querySelector("title")??document.head??document.documentElement,n=new MutationObserver(e);return n.observe(t,fr),d("Attached%c TitleObserver%c to head",r.HIGHLIGHT,r.FOREGROUND),setTimeout(e),{disconnect:()=>{n.disconnect(),d("Detached%c TitleObserver",r.HIGHLIGHT)}}}function hr(e){const t=new IntersectionObserver(o=>e(o.at(-1)?.isIntersecting??!1),{threshold:0}),n=document.documentElement;return t.observe(n),d("Attached%c VisibilityObserver%c to page",r.HIGHLIGHT,r.FOREGROUND),{disconnect:()=>{t.disconnect(),d("Detached%c VisibilityObserver",r.HIGHLIGHT)}}}let Rt=new Set;function gr(e){const t=new Set,n=new Set;for(const o of e)o.closest(`[${J}]`)?n.add(o):t.add(o);return n.size>0&&queueMicrotask(()=>{h("overflowIgnored"),d(`Ignoring elements with [data-iframe-ignore] > *:
|
|
38
|
+
`,n),j()}),t}function On(){const e=document.querySelectorAll(`[${Pt}]`),t=gr(e);let n=!1;return typeof Set.prototype.symmetricDifference===ze&&(n=t.symmetricDifference(Rt).size>0),Rt=t,i.overflowedNodeSet=t,i.hasOverflow=t.size>0,{hasOverflowUpdated:n,overflowedNodeSet:t}}const O={},En=e=>{const t=new Set;for(const n of e){t.add(n);for(const o of Xe(n))t.add(o)}return d(`Inspecting:
|
|
39
|
+
`,t),t},pr=e=>{if(e.size===0)return;h("addObservers");const t=En(e);O.overflow.attachObservers(t),O.resize.attachObserverToNonStaticElements(t),j()},yr=e=>{if(e.size===0)return;h("removeObservers");const t=En(e);O.overflow.detachObservers(t),O.resize.detachObservers(t),j()};function vr({addedNodes:e,removedNodes:t}){h("contentMutated"),i.applySelectors(),hn(),On(),j(),yr(t),pr(e)}function br(e){vr(e),S(Ut,"Mutation Observed")}const ee="Overflow",zr=Ee(ee),wr=Ee(ee,!1),Ir=bn(ee),Or=zn(ee),Er=e=>e.hidden||e.offsetParent===null||e.style.display===qe,Sr=(e,t)=>{const n=t.side,o={root:t.root,rootMargin:"0px",threshold:1},s=window?.requestAnimationFrame||de,u=(w=!1)=>e(w),l=(w,T)=>w===0||w>T[n],m=(w,T)=>w.toggleAttribute(Pt,T);function b(w){for(const T of w){const{boundingClientRect:U,rootBounds:W,target:R}=T;if(!W)continue;const Hn=U[n],Mn=l(Hn,W)&&!Er(R);m(R,Mn)}s(u)}const f=new IntersectionObserver(b,o),z=new WeakSet;function g(w){const T=new Set,U=new Set;let W=0;for(const R of w)if(R.nodeType===Node.ELEMENT_NODE){if(z.has(R)){T.add(R);continue}f.observe(R),z.add(R),U.add(R),W+=1}Or(T),Ir(U),zr(W),U.clear(),T.clear()}return{attachObservers:g,detachObservers:wn(ee,f,z,wr),disconnect:()=>{f.disconnect(),d("Detached%c OverflowObserver",r.HIGHLIGHT)}}};function Tr(){const{hasOverflow:e}=i,{hasOverflowUpdated:t,overflowedNodeSet:n}=On();switch(!0){case!t:return;case n.size>1:d("Overflowed Elements:",n);break;case e:break;default:d("No overflow detected")}S(Ve,"Overflow updated")}function Rr(e){const t={root:document.documentElement,side:c.calculateHeight?_t:xt};return O.overflow=Sr(Tr,t),O.overflow.attachObservers(e),O.overflow}const te="Resize",Hr=Ee(te),Mr=Ee(te,!1),$r=bn(te),Lr=zn(te),ge=new WeakSet,Le=new Set,Ae=new Set;let Z;function Ar(e){let t=0;for(const n of e){if(n.nodeType!==Node.ELEMENT_NODE)continue;const o=getComputedStyle(n)?.position;if(!(o===""||o==="static")){if(ge.has(n)){Le.add(n);continue}Z.observe(n),ge.add(n),Ae.add(n),t+=1}}Lr(Le),$r(Ae),Hr(t),Ae.clear(),Le.clear()}const kr=e=>(Z=new ResizeObserver(e),Z.observe(document.body),ge.add(document.body),d("Attached%c ResizeObserver%c to body",r.HIGHLIGHT,r.FOREGROUND),{attachObserverToNonStaticElements:Ar,detachObservers:wn(te,Z,ge,Mr),disconnect:()=>{Z.disconnect(),d("Detached%c ResizeObserver",r.HIGHLIGHT)}});function Nr(e){if(!Array.isArray(e)||e.length===0)return;const t=e[0].target;S(Bt,`Element resized <${Xn(t)}>`)}function Gr(e){return O.resize=kr(Nr),O.resize.attachObserverToNonStaticElements(e),O.resize}let Ht;function Cr(){const e=document.title;e!==Ht&&(Ht=e,a(`Title: %c${e}`,r.HIGHLIGHT),e&&y(0,0,xn,e))}function Pr(e){a(`Visible: %c${e}`,r.HIGHLIGHT),i.isHidden=!e,S(Wt,"Visibility changed")}function jr(e){Je.push(...e.map(t=>t.disconnect))}function Dr(){h("attachObservers");const e=Xe(document.documentElement),t=[ur(br),Rr(e),Po(),Gr(e),mr(Cr),hr(Pr)];jr(t)}const Mt=(e,t,n)=>{if(n!==""){a(`${e}: %c${n}`,r.HIGHLIGHT);for(const o of document.querySelectorAll(n))a(`Applying ${t} to:`,o),o.toggleAttribute(t,!0)}};function _r({sizeSelector:e,ignoreSelector:t}){return()=>{Mt("sizeSelector",ve,e),Mt("ignoreSelector",J,t)}}function xr(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}function Fr(e,t){return t.includes("-")&&(P(`Negative CSS value ignored for ${e}`),t=""),t}function xe(e,t){t===void 0||t===""||t===Vn||(document.body.style.setProperty(e,t),d(`Set body ${e}: %c${t}`,r.HIGHLIGHT))}function Br({bodyMarginStr:e,bodyMargin:t}){e===void 0&&(e=`${t}px`),xe("margin",Fr("margin",e))}const Ur=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function Wr(e){const t=e.getBoundingClientRect(),n=Ur();return{x:parseInt(t.left,ne)+parseInt(n.x,ne),y:parseInt(t.top,ne)+parseInt(n.y,ne)}}function Vr(e,t){const n=Wr(t);a(`Moving to in page link (%c#${e}%c) at x: %c${n.x}%c y: %c${n.y}`,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT),y(n.y,n.x,Ct)}function st(e){const t=e.split("#")[1]||e,n=decodeURIComponent(t),o=document.getElementById(n)||document.getElementsByName(n)[0];if(o!==void 0){Vr(t,o);return}a(`In page link (#${t}) not found in iframe, so sending to parent`),y(0,0,Nn,`#${t}`)}function Sn(){const{hash:e,href:t}=window.location;e!==""&&e!=="#"&&st(t)}function qr(){for(const e of document.querySelectorAll('a[href^="#"]'))e.getAttribute("href")!=="#"&&k(e,"click",t=>{t.preventDefault(),st(e.getAttribute("href"))})}function Zr(){k(window,"hashchange",Sn)}function Qr(){setTimeout(Sn,qt)}function Yr(){a("Setting up location.hash handlers"),qr(),Zr(),Qr(),i.inPageLinks={findTarget:st}}function Jr(e){const{mode:t}=c;e?et(t)?p(B(5)):Yr():a("In page linking not enabled")}const Kr="important";function Xr(){const e=t=>t.style.setProperty(be,$,Kr);e(document.documentElement),e(document.body),a("Set HTML & body height: %cauto !important",r.HIGHLIGHT)}const rt=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},ke=rt(ze),se=rt(A),re=rt(K),ei=e=>e!==null&&typeof e===Bn&&!Array.isArray(e);function ti(e){const{calculateHeight:t,calculateWidth:n}=c;let o,s;return typeof e?.offset===A&&(mo(Te,Re),t&&(o=se(e,Te)),n&&(s=se(e,Te))),typeof e?.offsetSize===A&&(t&&(o=se(e,Re)),n&&(s=se(e,Re))),{offsetHeight:o,offsetWidth:s}}function ni(e){a("Reading data from page:",Object.keys(e));const{offsetHeight:t,offsetWidth:n}=ti(e);return{offsetHeight:t,offsetWidth:n,ignoreSelector:re(e,"ignoreSelector"),[bt(3)]:re(e,bt(0)),sizeSelector:re(e,"sizeSelector"),targetOrigin:re(e,"targetOrigin"),onBeforeResize:ke(e,"onBeforeResize"),onMessage:ke(e,"onMessage"),onReady:ke(e,"onReady")}}function oi(){const{mode:e}=c;if(et(e))return{};const t=window.iframeResizer||window.iFrameResizer;return ei(t)?ni(t):{}}const si=e=>e==="true",Tn=e=>t=>t===void 0?void 0:e(t),N=Tn(si),q=Tn(Number),ri=e=>({parentId:e[0],bodyMargin:q(e[1]),calculateWidth:N(e[2]),logging:N(e[3]),autoResize:N(e[6]),bodyMarginStr:e[7],heightCalcMode:e[8],bodyBackground:e[9],bodyPadding:e[10],tolerance:q(e[11]),inPageLinks:N(e[12]),widthCalcMode:e[14],mouseEvents:N(e[15]),offsetHeight:q(e[16]),offsetWidth:q(e[17]),calculateHeight:N(e[18]),key:e[19],version:e[20],mode:q(e[21]),logExpand:N(e[23])});function ii(e){const{mode:t}=c;e.forEach(n=>{try{n()}catch(o){if(t<0)throw o;p(`<rb>Error in setup function</>
|
|
49
40
|
<i>iframe-resizer</> detected an error during setup.
|
|
50
41
|
|
|
51
|
-
Please report the following error message at <u>https://github.com/davidjbradshaw/iframe-resizer/issues</>`),
|
|
42
|
+
Please report the following error message at <u>https://github.com/davidjbradshaw/iframe-resizer/issues</>`),Xt(o)}})}function $t(e){for(const[t,n]of Object.entries(e))n!==void 0&&(c[t]=n)}function ci({logExpand:e,logging:t,parentId:n}){ao({id:n,enabled:t,expand:e}),h("initReceived"),a(`Initialising iframe v${C} ${window.location.href}`)}function ai(e){h("ready"),mn(Qt(e)),a("Initialization complete",(({key:t,key2:n,...o})=>o)(c))}function li({bodyBackground:e,bodyPadding:t,inPageLinks:n,onReady:o}){const s=Ro(c),u=[()=>fs(c),()=>ss(c),Zo,Uo,Fo,Bo,Vo,cs,hn,ls,s?de:To,()=>Br(c),()=>xe("background",e),()=>xe("padding",t),s?de:Xr,xr,i.applySelectors,()=>Jr(n),Hs,()=>vs(c),ws,()=>Js(),()=>S(ye,"Init message from host page",void 0,void 0,`${C}:${c.mode}`),Dr,j];ii(u),ai(o)}function di(e){i.firstRun&&($t(ri(e)),ci(c),$t(oi()),i.applySelectors=_r(c),li(c))}function ui(e){if(document.readyState==="loading"){a("Page not ready, ignoring init message");return}const t=e.data.slice(Vt).split(pe);i.target=e.source,i.origin=e.origin,di(t),i.firstRun=!1,setTimeout(()=>{i.initLock=!1},qt)}const{freeze:fi}=Object,{parse:it}=JSON,ct=e=>fi(it(e)),Rn=e=>y(0,0,`${e}Stop`),Se=e=>e.data.slice(e.data.indexOf(pe)+1),mi=e=>po(e)?ye:e.data.split("]")[1].split(pe)[0];function hi(e){const t=Se(e);a("onMessage called from parent:%c",r.HIGHLIGHT,ct(t)),we(c.onMessage,it(t))}function gi(e){const{onPageInfo:t}=i,n=Se(e);a("PageInfo received from parent:",ct(n)),t?we(t,it(n)):Rn(Nt)}function pi(e){const{onParentInfo:t}=i,n=ct(Se(e));a("ParentInfo received from parent:",n),t?we(t,n):Rn(Gt)}function yi(){if(i.initLock){a("Page reset ignored by init");return}a("Page size reset by host page"),yn("resetPage")}function vi(){a("Resize requested by host page"),S(We,"Parent window requested size check")}const Lt=e=>i.inPageLinks.findTarget(Se(e)),At={init:ui,reset:yi,resize:vi,moveToAnchor:Lt,inPageLink:Lt,pageInfo:gi,parentInfo:pi,message:hi};function bi(e){const{firstRun:t}=i,n=mi(e);switch(h(n),!0){case n in At:At[n](e);break;case(t&&go()):P(`Ignored message of type "${n}". Received before initialization.`);break;default:P(`Unexpected message (${e.data}), this is likely due to a newer version of iframe-resizer running on the parent page.`)}}const ie=Qe(e=>{ho(e)&&bi(e)});function zi(){if("iframeChildListener"in window){P("Already setup");return}window.iframeChildListener=t=>setTimeout(()=>ie({data:t,sameOrigin:!0})),h("listen"),k(window,Ne,ie),k(document,Dt,mt),mt();function e(t){return ie(t),i.win}try{top?.document?.getElementById("banner")&&(i.win={},window.mockMsgListener=e,nn(window,Ne,ie),typeof window.define=="function"&&window.define([],()=>e))}catch{}}typeof window!==Un&&zi();
|
|
52
43
|
//# sourceMappingURL=index.cjs.js.map
|