iframe-resizer 5.4.0-beta.9 → 5.4.1-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/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
package/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @preserve
|
|
3
3
|
*
|
|
4
|
-
* @module iframe-resizer/legacy (child) 5.4.
|
|
4
|
+
* @module iframe-resizer/legacy (child) 5.4.1-beta.1 (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.9",h=10,g="data-iframe-size",y="data-iframe-overflowed",v="data-iframe-ignore",b="bottom",z="right",w="resizeParent",$="setOffsetSize",S=(e,t,n,o)=>e.addEventListener(t,n,o||!1),E=["<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 M=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(E[e]),O=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},j=e=>e,k=e=>Math.round(1e3*e)/1e3,P=e=>e.charAt(0).toUpperCase()+e.slice(1),A=e=>""!=`${e}`&&void 0!==e;function C(e){switch(!0){case!A(e):return"";case A(e.id):return`${e.nodeName}#${e.id}`;case A(e.name):return`${e.nodeName} (${e.name}`;case A(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}let T=!0;const I=(N=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}},N?.__esModule?N.default:N);var N;const R=I({label:"iframeResizer(child)"});const x=e=>(...t)=>!T||R[e](...t),q=x("log"),L=x("info"),{event:F,assert:B,debug:D,endAutoGroup:W,error:V,purge:H,warn:U}=R,Z=(...e)=>{return R.warn((t=j,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},J=Z,_=(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)=>Z(...t))),Q=_("Method"),G=_("Method","replaced with"),X=_("Option"),Y=requestAnimationFrame,K="--ifr-start",ee="--ifr-end",te=[],ne=new WeakSet,oe=e=>"object"==typeof e&&ne.add(e);let ie={},re=0;const ae=setInterval((()=>{if(te.length<10)return;if(ie.hasTags&&ie.len<25)return;te.sort();const e=Math.min(te.reduce(((e,t)=>e+t),0)/te.length,te[Math.floor(te.length/2)]),t=k(e);t>re&&(re=t,F("performanceObserver"),q("Mean time:",k(te[Math.floor(te.length/2)])),q("Median time:",k(te.reduce(((e,t)=>e+t),0)/te.length)),q("Average time:",t),q("Max time:",k(Math.max(...te)))),e<=4||(clearInterval(ae),Z(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${k(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${ie.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function le(e){e.getEntries().forEach((e=>{if(e.name===ee){const{duration:t}=performance.measure("--ifr-measure",K,ee);ie=e.detail,te.push(t),te.length>100&&te.shift()}}))}function se(){new PerformanceObserver(le).observe({entryTypes:["mark"]}),oe(document.documentElement),oe(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",se):se()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},i={height:()=>(U("Custom height calculation function not defined"),at.auto()),width:()=>(U("Custom width calculation function not defined"),lt.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 E,A,I,N,x,B=!0,V="",H=0,_="",te="",ne=!0,oe=!1,ie=!0,re=!1,ae=!1,le=!1,se=1,ce=s,de="",ue=!0,me="",fe={},pe=!1,he=0,ge=!1,ye="",ve=j,be=[],ze="child",we=null,$e=!1,Se="",Ee=[],Me=window.parent,Oe="*",je=0,ke=!1,Pe="",Ae=1,Ce=u,Te=window,Ie=()=>{U("onMessage function not defined")},Ne=()=>{},Re=null,xe=null;function qe(){var e,t,n,o;!function(){const e=e=>"true"===e,t=me.slice(13).split(":");ye=t[0],H=void 0===t[1]?H:Number(t[1]),oe=void 0===t[2]?oe:e(t[2]),pe=void 0===t[3]?pe:e(t[3]),B=void 0===t[6]?B:e(t[6]),_=t[7],ce=void 0===t[8]?ce:t[8],V=t[9],te=t[10],je=void 0===t[11]?je:Number(t[11]),fe.enable=void 0!==t[12]&&e(t[12]),ze=void 0===t[13]?ze:t[13],Ce=void 0===t[14]?Ce:t[14],ge=void 0===t[15]?ge:e(t[15]),E=void 0===t[16]?E:Number(t[16]),A=void 0===t[17]?A:Number(t[17]),ne=void 0===t[18]?ne:e(t[18]),t[19],Pe=t[20]||Pe,he=void 0===t[21]?he:Number(t[21])}(),e={id:ye,enabled:pe},R.label(`${e.id}`),T=e.enabled,q(`Initialising iframe v${p} ${window.location.href}`),function(){function e(e){q("Reading data from page:",e),Ie=e?.onMessage||Ie,Ne=e?.onReady||Ne,"number"==typeof e?.offset&&(X("offset","offsetSize"),ne&&(E=e?.offset),oe&&(A=e?.offset)),"number"==typeof e?.offsetSize&&(ne&&(E=e?.offsetSize),oe&&(A=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(Se=e.sizeSelector),Object.prototype.hasOwnProperty.call(e,"ignoreSelector")&&(de=e.ignoreSelector),Oe=e?.targetOrigin||Oe,ce=e?.heightCalculationMethod||ce,Ce=e?.widthCalculationMethod||Ce}function t(e,t){return"function"==typeof e&&(q(`Setup custom ${t}CalcMethod`),i[t]=e,e="custom"),e}if(1===he)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),ce=t(ce,"height"),Ce=t(Ce,"width"),L(`Set TargetOrigin for parent: %c${Oe}`,m))}(),Ue(),function(){try{$e=1===he||"iframeParentListener"in window.parent}catch(e){q("Cross domain iframe detected")}}(),he<0?J(`${M(he+2)}${M(2)}`):Pe.codePointAt(0)>4||he<2&&J(M(3)),Pe&&""!==Pe&&"false"!==Pe?Pe!==p&&Z(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${Pe} - Child page: ${p}.\n`):Z("<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"),_e(),Qe(),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&&Z("<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&&Z("<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"),Fe(),1!==he&&(Te.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===B?(B=!0,ut("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===B&&(B=!1),pt(0,0,"autoResize",JSON.stringify(B)),B),close(){pt(0,0,"close")},getId:()=>ye,getOrigin:()=>(Q("getOrigin()","getParentOrigin()"),I),getParentOrigin:()=>I,getPageInfo(e){if("function"==typeof e)return Re=e,pt(0,0,"pageInfo"),void G("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");Re=null,pt(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIframe.getParentProps(callback) callback not a function");return xe=e,pt(0,0,"parentInfo"),()=>{xe=null,pt(0,0,"parentInfoStop")}},getParentProperties(e){Q("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){fe.findTarget(e)},reset(){ft("parentIframe.reset")},setOffsetSize(e){E=e,A=e,ut($,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){pt(t,e,"scrollBy")},scrollTo(e,t){pt(t,e,"scrollTo")},scrollToOffset(e,t){pt(t,e,"scrollToOffset")},sendMessage(e,t){pt(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){ce=e,_e()},setWidthCalculationMethod(e){Ce=e,Qe()},setTargetOrigin(e){q(`Set targetOrigin: %c${e}`,m),Oe=e},resize(e,t){ut(w,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){Q("size()","resize()"),this.resize(e,t)}}),Te.parentIFrame=Te.parentIframe),function(){function e(e){pt(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){q(`Add event listener: %c${n}`,m),S(window.document,t,e)}!0===ge&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),fe=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);q(`Moving to in page link (%c#${o}%c) at x: %c${n.x}%c y: %c${n.y}`,m,f,m,f,m),pt(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?(q(`In page link (#${o}) not found in iFrame, so sending to parent`),pt(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")&&S(e,"click",(t=>{t.preventDefault(),n(e.getAttribute("href"))}))}function r(){S(window,"hashchange",o)}function a(){setTimeout(o,128)}function l(){q("Setting up location.hash handlers"),i(),r(),a()}return fe.enable?1===he?Z("In page linking requires a Professional or Business license. Please see <u>https://iframe-resizer.com/pricing</> for more details."):l():q("In page linking not enabled"),{findTarget:n}}(),void 0===_&&(_=`${H}px`),Ve("margin",(n="margin",(o=_).includes("-")&&(U(`Negative CSS value ignored for ${n}`),o=""),o)),Ve("background",V),Ve("padding",te),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),q("Set HTML & body height: %cauto !important",m)}(),!0!==B&&q("Auto Resize disabled"),Ze({method:t="add",eventType:"After Print",eventName:"afterprint"}),Ze({method:t,eventType:"Before Print",eventName:"beforeprint"}),Ze({method:t,eventType:"Ready State Change",eventName:"readystatechange"}),function(){const e=new Set;let t=!1,n=0,o=[];const i=t=>{q("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(){F("mutationObserver");const d=performance.now(),u=d-n,f=r*s+++a;if(u>f&&u<l)return q(`MutationObserver delay: %c${u}ms > ${f}ms`,m),setTimeout(c,r*s),void(n=d);s=1,o.forEach(i),o=[],0!==e.size?(Ue(),Fe(),Be(e),e.forEach(Ye),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 q("Setup <body> MutationObserver"),e.observe(t,n),e}u()}(),q("Setup ResizeObserver"),we=new ResizeObserver(Ge),we.observe(document.body),Xe.add(document.body),Ye(document.body),ne!==oe&&(q("Setup OverflowObserver"),ve=(e=>{const t=e.side||b,n=e.onChange||j,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;Y(r)}),i),s=new WeakSet;return function(e){q("Attached overflowObservers");for(const t of e)t.nodeType!==Node.ELEMENT_NODE||s.has(t)||(l.observe(t),s.add(t))}})({onChange:Le,root:document.documentElement,side:ne?b:z})),Be(tt(document)()),queueMicrotask(Ne),q("Initialization complete"),ut("init","Init message from host page",void 0,void 0,p),document.title&&""!==document.title&&pt(0,0,"title",document.title)}function Le(e){be=e,ae=be.length>0,ae&&(q("Observed Elements:",e.length),ut("overflowObserver","Overflow updated"))}function Fe(){Ee=document.querySelectorAll(`[${g}]`),le=Ee.length>0,q(`Tagged elements found: %c${le}`,le?m:f)}function Be(e){le||ve(e)}let De=0;function We(){const n=document.querySelectorAll(`*[${v}]`);re=n.length>0,re&&n.length!==De&&(function(n){const o=1===n.length?"":"s";U(`%c[${v}]%c found on %c${n.length}%c element${o}`,t,e,t,e)}(n),De=n.length)}function Ve(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),L(`Set body ${e}: %c${t}`,m))}function He(e,t,n){if(""!==n){q(`${e}: %c${n}`,m);for(const e of document.querySelectorAll(n))q(`Applying ${t} to:`,e),e.toggleAttribute(t,!0)}}function Ue(){He("sizeSelector",g,Se),He("ignoreSelector",v,de)}function Ze(e){({add(t){function n(){ut(e.eventName,e.eventType)}a[t]=n,S(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),q(`${P(e.method)} event listener: %c${e.eventType}`,m)}function Je(e,t,n,o){return t!==e&&(e in n||(U(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in r&&Z(`<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.`),q(`Set ${o} calculation method: %c${e}`,m)),e}function _e(){ce=Je(ce,s,at,"height")}function Qe(){Ce=Je(Ce,u,lt,"width")}function Ge(e){Array.isArray(e)&&0!==e.length&&ut("resizeObserver",`Element resized <${C(e[0].target)}>`)}const Xe=new WeakSet;function Ye(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!Xe.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(we.observe(e),Xe.add(e),q(`Attached resizeObserver: %c${C(e)}`,m))}const t=tt(e)();for(const e of t){if(Xe.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(we.observe(e),Xe.add(e),q(`Attached resizeObserver: %c${C(e)}`,m))}}function Ke(e){performance.mark(K);const t=P(e);let n=0,i=document.documentElement,r=le?0:document.documentElement.getBoundingClientRect().bottom;const a=le?Ee:ae?be:tt(document)();let s=a.length;for(const t of a)le||!l||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,i=t)):s-=1;return L(`${t} position calculated from:`,i),performance.mark(ee,{detail:{Side:t,len:s,hasTags:le,logging:pe}}),r}const et=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],tt=e=>()=>{We();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 re&&t.push(`not([${v}])`,`not([${v}] *)`),e.querySelectorAll(t.join(":"))},nt={height:0,width:0},ot={height:0,width:0},it=[m,f,m];function rt(e){function t(){return ot[o]=i,nt[o]=l,i}const n=e===at,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 le:L("Found element with data-iframe-size attribute"),c=e.taggedElement();break;case!ae&&0===ot[o]&&0===nt[o]:L(`Initial page size values: ${s}`,...it),c=t();break;case ke&&i===ot[o]&&l===nt[o]:L(`Size unchanged: ${s}`,...it),c=Math.max(i,l);break;case 0===i:L(`Page is hidden: ${s}`,...it),c=l;break;case!ae&&i!==ot[o]&&l<=nt[o]:L(`New <html> size: ${s} `,...it),L(`Previous <html> size: %c${ot[o]}px`,m),c=t();break;case!n:c=e.taggedElement();break;case!ae&&i<ot[o]:L(`<html> size decreased: ${s}`,...it),c=t();break;case l===a||l===r:L(`<html> size equals page size: ${s}`,...it),c=t();break;case i>l:L(`Page size < <html> size: ${s}`,...it),c=t();break;case ae:L("Found element overflowing <html> "),c=e.taggedElement();break;default:c=t()}return L(`Content ${o}: %c${c}px`,m),c+=function(e){const t=e.getOffset();return 0!==t&&L(`Page offsetSize: %c${t}px`,m),t}(e),c}const at={enabled:()=>ne,getOffset:()=>E,auto:()=>rt(at),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,h)+parseInt(t.marginBottom,h)},bodyScroll:()=>document.body.scrollHeight,offset:()=>at.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(...et(at)),min:()=>Math.min(...et(at)),grow:()=>at.max(),lowestElement:()=>Ke(b),taggedElement:()=>Ke(b)},lt={enabled:()=>oe,getOffset:()=>A,auto:()=>rt(lt),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(...et(lt)),min:()=>Math.min(...et(lt)),rightMostElement:()=>Ke(z),scroll:()=>Math.max(lt.bodyScroll(),lt.documentElementScroll()),taggedElement:()=>Ke(z)},st=(e,t)=>!(Math.abs(e-t)<=je);let ct=!1;const dt=O((()=>J(M(4))));function ut(e,t,n,o,i){x=performance.now(),F(e),B||e===w?document.hidden?q("Page hidden - Ignored resize request"):(ct||(q(`Resize event: %c${t}`,m),N=!0,function(e,t,n,o,i){const r=void 0===n?at[ce]():n,a=void 0===o?lt[Ce]():o;ne&&st(se,r)||oe&&st(Ae,a)||"init"===e?(se=r,Ae=a,pt(se,Ae,e,i)):!e!==w&&(ne&&ce in d||oe&&Ce in d)?ft(t):e===$?pt(se,Ae,e):(q("No change in content size detected"),N=!1)}(e,t,n,o,i),requestAnimationFrame((()=>{ct=!1}))),ct=!0):L("Resizing disabled")}function mt(e){se=at[ce](),Ae=lt[Ce](),pt(se,Ae,e)}function ft(e){const t=ce;ce=s,q(`Reset trigger event: %c${e}`,m),ke?q("TriggerLock blocked calculation"):(ke=!0,D("Trigger event lock on"),requestAnimationFrame((()=>{ke=!1,D("Trigger event lock off")}))),mt("reset"),ce=t}function pt(e,t,o,i,r){he<-1||(F(o),void 0!==r?q(`Message targetOrigin: %c${r}`,m):r=Oe,function(){const a=`${ye}:${e}:${t}:${o}${void 0===i?"":`:${i}`}`;if($e)try{window.parent.iframeParentListener(c+a)}catch(e){if(1!==he)throw e;return void dt()}else Me.postMessage(c+a,r);N&&L(function(){const e=k(performance.now()-x);return"init"===o?`Initialised iFrame in %c${e}ms`:`Size calculated in %c${e}ms`}(),m),N=!1,L("Sending message to host page via "+($e?"sameDomain":"postMessage")),L(`%c${a}`,n)}(),W())}function ht(e){const{freeze:t}=Object,{parse:n}=JSON,o=e=>pt(0,0,`${e}Stop`),i={init:function(){me=e.data,Me=e.source,I=e.origin,qe(),ie=!1,setTimeout((()=>{ue=!1}),128)},reset(){ue?q("Page reset ignored by init"):(q("Page size reset by host page"),mt("resetPage"))},resize(){ut(w,"Parent window requested size check")},moveToAnchor(){fe.findTarget(a())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=a();q(`PageInfo received from parent: ${e}`),Re?setTimeout((()=>Re(n(e)))):o("pageInfo")},parentInfo(){const e=a();q(`ParentInfo received from parent: ${e}`),xe?setTimeout((()=>xe(t(n(e))))):o("parentInfo")},message(){const e=a();q(`onMessage called from parent: ${e}`),setTimeout((()=>Ie(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()||U(`Unexpected message (${e.data})`)}c===`${e.data}`.slice(0,13)&&(F(r()),!1!==ie?l()?i.init():q(`Ignored message of type "${r()}". Received before initialization.`):s())}function gt(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?U("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>ht({data:e}))),S(window,"message",ht),S(window,"readystatechange",gt),gt())}()}();
|
|
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=>[e,console[e]],d=e=>t=>[t,function(n){e[t]=n}],u=(e,t)=>l(s(e).map(t));const m=()=>!(typeof window>"u")&&(null==window?void 0:window.matchMedia("(prefers-color-scheme: dark)").matches),f=m()?"color: #A9C7FB;":"color: #135CD2;",p=m()?"color: #E3E3E3;":"color: #1F1F1F;",h="5.4.1-beta.1",g=10,y="data-iframe-size",v="data-iframe-overflowed",b="data-iframe-ignore",z="bottom",w="right",$="resizeParent",S="setOffsetSize",M="resizeObserver",O="overflowObserver",E="mutationObserver",k=(e,t,n,o)=>e.addEventListener(t,n,o||!1),j=["<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 P=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(j[e]),A=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},C=e=>e,T=e=>Math.round(1e3*e)/1e3,I=e=>e.charAt(0).toUpperCase()+e.slice(1),N=e=>""!=`${e}`&&void 0!==e;function R(e){switch(!0){case!N(e):return"";case N(e.id):return`${e.nodeName}#${e.id}`;case N(e.name):return`${e.nodeName} (${e.name}`;case N(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}let x=!0;var q;const L=(q=function(n={}){const l={},s={},m=[],f={...r,...n};let p;function h(){m.length=0}function g(){delete f.event,h()}const y=()=>!m.some((([e])=>"error"===e||"warn"===e))&&!!f.collapsed;function v(){if(0!==m.length){console[y()?"groupCollapsed":"group"](`%c${f.label}%c ${(e=>{const t=e.event||e.defaultEvent;return t?`${t}`:""})(f)} %c${f.showTime?p:""}`,e,t,o);for(const[e,...t]of m)console[e](...t);console.groupEnd(),g()}else g()}function b(){p=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(v)))}function z(e,...t){0===m.length&&b(),m.push([e,...t])}function w(e=i,...t){z("log",`${e}: ${performance.now()-l[e]} ms`,...t)}return{...u(f,d(f)),...u(console,(e=>[e,(...t)=>z(e,...t)])),...u(a,c),count:function(e=i){s[e]?s[e]+=1:s[e]=1,z("log",`${e}: ${s[e]}`)},countReset:function(e=i){delete s[e]},endAutoGroup:v,errorBoundary:e=>(...t)=>{let n;try{n=e(...t)}catch(e){z("error",e)}return n},purge:h,time:function(e=i){l[e]=performance.now()},timeEnd:function(e=i){w(e),delete l[e]},timeLog:w}},q?.__esModule?q.default:q)({label:"iframeResizer(child)"});const B=e=>(...t)=>!x||L[e](...t),F=B("log"),D=B("info"),{assert:W,debug:V,endAutoGroup:H,error:U,errorBoundary:Z,event:J,purge:_,warn:Q}=L,G=e=>{return L.warn((t=C,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},X=G,Y=(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)=>G(t))),K=Y("Method"),ee=Y("Method","replaced with"),te=Y("Option"),ne=requestAnimationFrame,oe="--ifr-start",ie="--ifr-end",re=[],ae=new WeakSet,le=e=>"object"==typeof e&&ae.add(e);let se={},ce=0;const de=setInterval((()=>{if(re.length<10)return;if(se.hasTags&&se.len<25)return;re.sort();const e=Math.min(re.reduce(((e,t)=>e+t),0)/re.length,re[Math.floor(re.length/2)]),t=T(e);t>ce&&(ce=t,J("performanceObserver"),F("Mean time:",T(re[Math.floor(re.length/2)])),F("Median time:",T(re.reduce(((e,t)=>e+t),0)/re.length)),F("Average time:",t),F("Max time:",T(Math.max(...re)))),e<=4||(clearInterval(de),G(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${T(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${se.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function ue(e){e.getEntries().forEach((e=>{if(e.name===ie){const{duration:t}=performance.measure("--ifr-measure",oe,ie);se=e.detail,re.push(t),re.length>100&&re.shift()}}))}function me(){new PerformanceObserver(ue).observe({entryTypes:["mark"]}),le(document.documentElement),le(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",me):me()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},i={height:()=>(Q("Custom height calculation function not defined"),ut.auto()),width:()=>(Q("Custom width calculation function not defined"),mt.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 m,j,N,q,B,W=!0,U="",_=0,Y="",re="",ae=!0,le=!1,se=!0,ce=!1,de=!1,ue=!1,me=1,fe=s,pe="",he=!0,ge="",ye={},ve=!1,be=0,ze=!1,we="",$e=C,Se=[],Me="child",Oe=null,Ee=!1,ke="",je=[],Pe=window.parent,Ae="*",Ce=0,Te=!1,Ie="",Ne=1,Re=u,xe=window,qe=()=>{Q("onMessage function not defined")},Le=()=>{},Be=null,Fe=null;function De(){var e,t,n,o;!function(){const e=e=>"true"===e,t=ge.slice(13).split(":");we=t[0],_=void 0===t[1]?_:Number(t[1]),le=void 0===t[2]?le:e(t[2]),ve=void 0===t[3]?ve:e(t[3]),W=void 0===t[6]?W:e(t[6]),Y=t[7],fe=void 0===t[8]?fe:t[8],U=t[9],re=t[10],Ce=void 0===t[11]?Ce:Number(t[11]),ye.enable=void 0!==t[12]&&e(t[12]),Me=void 0===t[13]?Me:t[13],Re=void 0===t[14]?Re:t[14],ze=void 0===t[15]?ze:e(t[15]),m=void 0===t[16]?m:Number(t[16]),j=void 0===t[17]?j:Number(t[17]),ae=void 0===t[18]?ae:e(t[18]),t[19],Ie=t[20]||Ie,be=void 0===t[21]?be:Number(t[21])}(),e={id:we,enabled:ve},L.label(`${e.id}`),x=e.enabled,F(`Initialising iframe v${h} ${window.location.href}`),function(){function e(e){F("Reading data from page:",e),qe=e?.onMessage||qe,Le=e?.onReady||Le,"number"==typeof e?.offset&&(te("offset","offsetSize"),ae&&(m=e?.offset),le&&(j=e?.offset)),"number"==typeof e?.offsetSize&&(ae&&(m=e?.offsetSize),le&&(j=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(ke=e.sizeSelector),Object.prototype.hasOwnProperty.call(e,"ignoreSelector")&&(pe=e.ignoreSelector),Ae=e?.targetOrigin||Ae,fe=e?.heightCalculationMethod||fe,Re=e?.widthCalculationMethod||Re}function t(e,t){return"function"==typeof e&&(F(`Setup custom ${t}CalcMethod`),i[t]=e,e="custom"),e}if(1===be)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),fe=t(fe,"height"),Re=t(Re,"width"),D(`Set TargetOrigin for parent: %c${Ae}`,f))}(),Ge(),function(){try{Ee=1===be||"iframeParentListener"in window.parent}catch(e){F("Cross domain iframe detected")}}(),be<0?X(`${P(be+2)}${P(2)}`):Ie.codePointAt(0)>4||be<2&&X(P(3)),Ie&&""!==Ie&&"false"!==Ie?Ie!==h&&G(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${Ie} - Child page: ${h}.\n`):G("<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"),Ke(),et(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(y,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&G("<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&&G("<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"),He(),1!==be&&(xe.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===W?(W=!0,yt("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===W&&(W=!1),zt(0,0,"autoResize",JSON.stringify(W)),W),close(){zt(0,0,"close")},getId:()=>we,getOrigin:()=>(K("getOrigin()","getParentOrigin()"),N),getParentOrigin:()=>N,getPageInfo(e){if("function"==typeof e)return Be=e,zt(0,0,"pageInfo"),void ee("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");Be=null,zt(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIframe.getParentProps(callback) callback not a function");return Fe=e,zt(0,0,"parentInfo"),()=>{Fe=null,zt(0,0,"parentInfoStop")}},getParentProperties(e){K("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){ye.findTarget(e)},reset(){bt("parentIframe.reset")},setOffsetSize(e){m=e,j=e,yt(S,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){zt(t,e,"scrollBy")},scrollTo(e,t){zt(t,e,"scrollTo")},scrollToOffset(e,t){zt(t,e,"scrollToOffset")},sendMessage(e,t){zt(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){fe=e,Ke()},setWidthCalculationMethod(e){Re=e,et()},setTargetOrigin(e){F(`Set targetOrigin: %c${e}`,f),Ae=e},resize(e,t){yt("parentIframe.resize()",`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){K("size()","resize()"),this.resize(e,t)}}),xe.parentIFrame=xe.parentIframe),function(){function e(e){zt(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){F(`Add event listener: %c${n}`,f),k(window.document,t,e)}!0===ze&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),ye=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,g)+parseInt(o.x,g),y:parseInt(n.top,g)+parseInt(o.y,g)}}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}`,f,p,f,p,f),zt(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`),zt(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")&&k(e,"click",(t=>{t.preventDefault(),n(e.getAttribute("href"))}))}function r(){k(window,"hashchange",o)}function a(){setTimeout(o,128)}function l(){F("Setting up location.hash handlers"),i(),r(),a()}return ye.enable?1===be?G("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===Y&&(Y=`${_}px`),_e("margin",(n="margin",(o=Y).includes("-")&&(Q(`Negative CSS value ignored for ${n}`),o=""),o)),_e("background",U),_e("padding",re),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",f)}(),!0!==W&&F("Auto Resize disabled"),Xe({method:t="add",eventType:"After Print",eventName:"afterprint"}),Xe({method:t,eventType:"Before Print",eventName:"beforeprint"}),Xe({method:t,eventType:"Ready State Change",eventName:"readystatechange"}),function(){const e=new Set,t=[];let n=!1,o=0;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(e){Ge(),Ue(e),e.forEach(ot),e.clear()}function d(){J("mutationObserver");const u=performance.now(),m=u-o,p=r*s+++a;if(m>p&&m<l)return F(`MutationObserver delay: %c${m}ms > ${p}ms`,f),setTimeout(d,r*s),void(o=u);s=1,t.forEach(i),t.length=0,e.size>0&&c(e),He(),We(),n=!1,yt(E,"Mutation Observed")}function u(e){t.push(e),n||(o=performance.now(),n=!0,requestAnimationFrame(d))}function m(){const e=new window.MutationObserver(u),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}m()}(),F("Setup ResizeObserver"),Oe=new ResizeObserver(tt),Oe.observe(document.body),nt.add(document.body),ot(document.body),ae!==le&&(F("Setup OverflowObserver"),$e=(e=>{const t=e.side||z,n=e.onChange||C,o=(e,n)=>0===e||e>n[t],i={root:e.root,rootMargin:"0px",threshold:1},r=(e=!1)=>n(e),a=(e,t)=>e.toggleAttribute(v,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),c&&F("Overflowed:",l)}var n;ne(r)}),i),s=new WeakSet;return function(){const e=new window.MutationObserver((()=>{D("Detected changes in element attributes"),r(!0)})),t=document.querySelector("body"),n={attributes:!0,attributeFilter:[b],subtree:!0};F("Setup OverflowMutationObserver"),e.observe(t,n)}(),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:Ve,root:document.documentElement,side:ae?z:w})),Ue(at(document)()),queueMicrotask(Le),F("Initialization complete"),yt("init","Init message from host page",void 0,void 0,h),document.title&&""!==document.title&&zt(0,0,"title",document.title)}function We(){Se=document.querySelectorAll(`[${v}]:not([${b}]):not([${b}] *)`),de=Se.length>0}function Ve(e){We(),(de||e)&&(F("Observed Elements:",Se.length),yt(O,"Overflow updated"))}function He(){je=document.querySelectorAll(`[${y}]`),ue=je.length>0,F(`Tagged elements found: %c${ue}`,ue?f:p)}function Ue(e){ue||$e(e)}let Ze=0;function Je(){const n=document.querySelectorAll(`*[${b}]`);ce=n.length>0,ce&&n.length!==Ze&&(function(n){const o=1===n.length?"":"s";Q(`%c[${b}]%c found on %c${n.length}%c element${o}`,t,e,t,e)}(n),Ze=n.length)}function _e(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),D(`Set body ${e}: %c${t}`,f))}function Qe(e,t,n){if(""!==n){F(`${e}: %c${n}`,f);for(const e of document.querySelectorAll(n))F(`Applying ${t} to:`,e),e.toggleAttribute(t,!0)}}function Ge(){Qe("sizeSelector",y,ke),Qe("ignoreSelector",b,pe)}function Xe(e){({add(t){function n(){yt(e.eventName,e.eventType)}a[t]=n,k(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(`${I(e.method)} event listener: %c${e.eventType}`,f)}function Ye(e,t,n,o){return t!==e&&(e in n||(Q(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in r&&G(`<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}`,f)),e}function Ke(){fe=Ye(fe,s,ut,"height")}function et(){Re=Ye(Re,u,mt,"width")}function tt(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;yt(M,`Element resized <${R(t)}>`)}const nt=new WeakSet;function ot(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!nt.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(Oe.observe(e),nt.add(e),F(`Attached resizeObserver: %c${R(e)}`,f))}const t=at(e)();for(const e of t){if(nt.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(Oe.observe(e),nt.add(e),F(`Attached resizeObserver: %c${R(e)}`,f))}}function it(e){performance.mark(oe);const t=I(e);let n=0,i=document.documentElement,r=ue?0:document.documentElement.getBoundingClientRect().bottom;const a=ue?je:de?Se:at(document)();let s=a.length;for(const t of a)ue||!l||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,i=t)):s-=1;return D(`${t} position calculated from:`,i),performance.mark(ie,{detail:{Side:t,len:s,hasTags:ue,logging:ve}}),r}const rt=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],at=e=>()=>{Je();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 ce&&t.push(`not([${b}])`,`not([${b}] *)`),e.querySelectorAll(t.join(":"))},lt={height:0,width:0},st={height:0,width:0},ct=[f,p,f];function dt(e){function t(){return st[o]=i,lt[o]=l,i}const n=e===ut,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 ue:D("Found element with data-iframe-size attribute"),c=e.taggedElement();break;case!de&&0===st[o]&&0===lt[o]:D(`Initial page size values: ${s}`,...ct),c=t();break;case Te&&i===st[o]&&l===lt[o]:D(`Size unchanged: ${s}`,...ct),c=Math.max(i,l);break;case 0===i:D(`Page is hidden: ${s}`,...ct),c=l;break;case!de&&i!==st[o]&&l<=lt[o]:D(`New <html> size: ${s} `,...ct),D(`Previous <html> size: %c${st[o]}px`,f),c=t();break;case!n:c=e.taggedElement();break;case!de&&i<st[o]:D(`<html> size decreased: ${s}`,...ct),c=t();break;case l===a||l===r:D(`<html> size equals page size: ${s}`,...ct),c=t();break;case i>l:D(`Page size < <html> size: ${s}`,...ct),c=t();break;case de:D("Found element overflowing <html> "),c=e.taggedElement();break;default:D(`Using <html> size: ${s}`,...ct),c=t()}return D(`Content ${o}: %c${c}px`,f),c+=function(e){const t=e.getOffset();return 0!==t&&D(`Page offsetSize: %c${t}px`,f),t}(e),c}const ut={enabled:()=>ae,getOffset:()=>m,auto:()=>dt(ut),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,g)+parseInt(t.marginBottom,g)},bodyScroll:()=>document.body.scrollHeight,offset:()=>ut.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(...rt(ut)),min:()=>Math.min(...rt(ut)),grow:()=>ut.max(),lowestElement:()=>it(z),taggedElement:()=>it(z)},mt={enabled:()=>le,getOffset:()=>j,auto:()=>dt(mt),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(...rt(mt)),min:()=>Math.min(...rt(mt)),rightMostElement:()=>it(w),scroll:()=>Math.max(mt.bodyScroll(),mt.documentElementScroll()),taggedElement:()=>it(w)},ft=(e,t)=>!(Math.abs(e-t)<=Ce);function pt(e,t,n,o,i){const r=void 0===n?ut[fe]():n,a=void 0===o?mt[Re]():o;switch(!0){case ae&&ft(me,r)||le&&ft(Ne,a)||"init"===e:me=r,Ne=a;case e===S:zt(me,Ne,e,i);break;case!e!==$&&(ae&&fe in d||le&&Re in d):bt(t);break;case e===M:case e===O:case e===E:F("No change in content size detected");break;default:D("No change in content size detected")}q=!1}let ht=!1;const gt=A((()=>X(P(4)))),yt=Z(((e,t,n,o,i)=>{B=performance.now(),J(e),W||e===$?document.hidden?F("Page hidden - Ignored resize request"):(ht||(F(`Resize event: %c${t}`,f),q=!0,pt(e,t,n,o,i),requestAnimationFrame((()=>{ht=!1}))),ht=!0):D("Resizing disabled")}));function vt(e){me=ut[fe](),Ne=mt[Re](),zt(me,Ne,e)}function bt(e){const t=fe;fe=s,F(`Reset trigger event: %c${e}`,f),Te?F("TriggerLock blocked calculation"):(Te=!0,V("Trigger event lock on"),requestAnimationFrame((()=>{Te=!1,V("Trigger event lock off")}))),vt("reset"),fe=t}const zt=Z((function(e,t,o,i,r){be<-1||(J(o),void 0!==r?F(`Message targetOrigin: %c${r}`,f):r=Ae,function(){const a=`${we}:${e}:${t}:${o}${void 0===i?"":`:${i}`}`;if(Ee)try{window.parent.iframeParentListener(c+a)}catch(e){if(1!==be)throw e;return void gt()}else Pe.postMessage(c+a,r);q&&D(function(){const e=T(performance.now()-B);return"init"===o?`Initialised iFrame in %c${e}ms`:`Size calculated in %c${e}ms`}(),f),D("Sending message to host page via "+(Ee?"sameDomain":"postMessage")),D(`%c${a}`,n)}(),H())})),wt=Z((function(e){const{freeze:t}=Object,{parse:n}=JSON,o=e=>zt(0,0,`${e}Stop`),i={init:function(){ge=e.data,Pe=e.source,N=e.origin,De(),se=!1,setTimeout((()=>{he=!1}),128)},reset(){he?F("Page reset ignored by init"):(F("Page size reset by host page"),vt("resetPage"))},resize(){yt($,"Parent window requested size check")},moveToAnchor(){ye.findTarget(a())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=a();F(`PageInfo received from parent: ${e}`),Be?setTimeout((()=>Be(n(e)))):o("pageInfo")},parentInfo(){const e=a();F(`ParentInfo received from parent: ${e}`),Fe?setTimeout((()=>Fe(t(n(e))))):o("parentInfo")},message(){const e=a();F(`onMessage called from parent: ${e}`),setTimeout((()=>qe(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()||Q(`Unexpected message (${e.data})`)}c===`${e.data}`.slice(0,13)&&(J(r()),!1!==se?l()?i.init():F(`Ignored message of type "${r()}". Received before initialization.`):s())}));function $t(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?Q("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>wt({data:e,sameDomain:!0}))),k(window,"message",wt),k(window,"readystatechange",$t),$t())}()}();
|
|
21
21
|
//# sourceMappingURL=iframeResizer.contentWindow.js.map
|