@iframe-resizer/child 5.0.0-alpha.4 → 5.0.0-alpha.5
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 +4 -2
- package/index.cjs.js +4 -4
- package/index.esm.js +4 -4
- package/index.umd.js +4 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
This package is an alpha release of version 5 of _iframe-resizer_ for the production version see the [iframe-resizer](https://www.npmjs.com/package/iframe-resizer) package.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
This version has an unstable API and should not be used on production sites.
|
|
8
|
+
|
|
9
|
+
Alpha version 5 docs: http://iframe-resizer.com/.
|
|
8
10
|
|
|
9
11
|
---
|
|
10
12
|
|
|
11
|
-
_iframe-resizer version 5.0.0-alpha.
|
|
13
|
+
_iframe-resizer version 5.0.0-alpha.5 2024-04-17 - 12:08:38.460Z_
|
package/index.cjs.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @preserve
|
|
3
3
|
*
|
|
4
|
-
* @module iframe-resizer/child 5.0.0-alpha.
|
|
4
|
+
* @module iframe-resizer/child 5.0.0-alpha.5 (cjs) - 2024-04-17
|
|
5
5
|
*
|
|
6
6
|
* @license GPL-3.0 for non-commercial use only.
|
|
7
7
|
* For commercial use, you must purchase a license from
|
|
8
|
-
*
|
|
8
|
+
* http://iframe-resizer.com/pricing
|
|
9
9
|
*
|
|
10
10
|
* @desciption Keep same and cross domain iFrames sized to their content
|
|
11
11
|
*
|
|
12
12
|
* @author David J. Bradshaw <dave@bradshaw.net>
|
|
13
13
|
*
|
|
14
|
-
* @see {@link
|
|
14
|
+
* @see {@link http://iframe-resizer.com}
|
|
15
15
|
*
|
|
16
16
|
* @copyright (c) 2013 - 2024, David J. Bradshaw. All rights reserved.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
"use strict";const e=10,t="data-iframe-size",n=(e,t,n,o)=>e.addEventListener(t,n,o||!1),o=(e,t,n)=>e.removeEventListener(t,n,!1),i={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},a={height:()=>(ee("Custom height calculation function not defined"),Se.auto()),width:()=>(ee("Custom width calculation function not defined"),Oe.auto())},r={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,documentElementBoundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},c=128,s={},d="checkVisibility"in window,l="auto",m="[iFrameSizer]",u=m.length,f={max:1,min:1,bodyScroll:1,documentElementScroll:1},h=["body"],g="scroll";let p=!0,w="",y=0,v="",b=null,$="",E=!0,S=!1,O=null,z=!0,M=!1,C=1,T=l,I=!0,P="",x={},N=!0,R=!1,A=!1,B="",L=0,k=0,H="child",F=null,q=!1,D=window.parent,U="*",W=0,V=!1,j=1,J=g,Q=window,X=()=>{ee("onMessage function not defined")},Y=()=>{},G=null,K=null;const Z=e=>""!=`${e}`&&void 0!==e;const _=(...e)=>[`${m}[${B}]`,...e].join(" "),ee=(...e)=>console?.warn(_(...e)),te=(...e)=>console?.warn(window.chrome?_(...e):_(...e).replaceAll(/\u001B\[[\d;]*m/gi,""));function ne(){!function(){try{q="iframeParentListener"in window.parent}catch(e){}}(),function(){const e=e=>"true"===e,t=P.slice(u).split(":");B=t[0],y=void 0===t[1]?y:Number(t[1]),S=void 0===t[2]?S:e(t[2]),R=void 0===t[3]?R:e(t[3]),p=void 0===t[6]?p:e(t[6]),v=t[7],T=void 0===t[8]?T:t[8],w=t[9],$=t[10],W=void 0===t[11]?W:Number(t[11]),x.enable=void 0!==t[12]&&e(t[12]),H=void 0===t[13]?H:t[13],J=void 0===t[14]?J:t[14],A=void 0===t[15]?A:e(t[15]),L=void 0===t[16]?L:Number(t[16]),k=void 0===t[17]?k:Number(t[17]),E=void 0===t[18]?E:e(t[18])}(),function(){function e(){const e=window.iFrameResizer;X=e?.onMessage||X,Y=e?.onReady||Y,L=e?.offsetHeight||L,k=e?.offsetWidth||k,U=e?.targetOrigin||U,T=e?.heightCalculationMethod||T,J=e?.widthCalculationMethod||J}function t(e,t){return"function"==typeof e&&(a[t]=e,e="custom"),e}"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),T=t(T,"height"),J=t(J,"width"))}(),function(){void 0===v&&(v=`${y}px`);oe("margin",function(e,t){t.includes("-")&&(ee(`Negative CSS value ignored for ${e}`),t="");return t}("margin",v))}(),oe("background",w),oe("padding",$),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)}(),se(),de(),function(){let e=!1;const n=n=>document.querySelectorAll(`[${n}]`).forEach((o=>{e=!0,o.removeAttribute(n),o.setAttribute(t,null)}));n("data-iframe-height"),n("data-iframe-width"),e&&te("\n[31;1mDeprecated Attributes[m\n \nThe [1mdata-iframe-height[m and [1mdata-iframe-width[m attributes have been deprecated and replaced with the single [1mdata-iframe-size[m attribute. Use of the old attributes will be removed in a future version of [3miframe-resizer[m.")}(),document.querySelectorAll(`[${t}]`).length>0&&("auto"===T&&(T="autoOverflow"),"auto"===J&&(J="autoOverflow")),re(),Q.parentIFrame={autoResize:e=>(!0===e&&!1===p?(p=!0,le()):!1===e&&!0===p&&(p=!1,ae("remove"),F?.disconnect(),b?.disconnect()),Pe(0,0,"autoResize",JSON.stringify(p)),p),close(){Pe(0,0,"close")},getId:()=>B,getPageInfo(e){if("function"==typeof e)return G=e,Pe(0,0,"pageInfo"),void te("\n[31;1mDeprecated Method (getPageInfo()[m\n \nThe [1mgetPageInfo()[m method has been deprecated and replaced with [1mgetParentInfo()[m. Use of this method will be removed in a future version of [3miframe-resizer[m.\n");G=null,Pe(0,0,"pageInfoStop")},getParentInfo(e){if("function"==typeof e)return K=e,void Pe(0,0,"parentInfo");K=null,Pe(0,0,"parentInfoStop")},moveToAnchor(e){x.findTarget(e)},reset(){Ie()},scrollTo(e,t){Pe(t,e,"scrollTo")},scrollToOffset(e,t){Pe(t,e,"scrollToOffset")},sendMessage(e,t){Pe(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){T=e,se()},setWidthCalculationMethod(e){J=e,de()},setTargetOrigin(e){U=e},size(e,t){Me("size",`parentIFrame.size(${e||""}${t?`,${t}`:""})`,e,t)}},function(){if(!0!==A)return;function e(e){Pe(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,o){n(window.document,t,e)}t("mouseenter"),t("mouseleave")}(),le(),x=function(){const t=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function o(n){const o=n.getBoundingClientRect(),i=t();return{x:parseInt(o.left,e)+parseInt(i.x,e),y:parseInt(o.top,e)+parseInt(i.y,e)}}function i(e){function t(e){const t=o(e);Pe(t.y,t.x,"scrollToOffset")}const n=e.split("#")[1]||e,i=decodeURIComponent(n),a=document.getElementById(i)||document.getElementsByName(i)[0];void 0===a?Pe(0,0,"inPageLink",`#${n}`):t(a)}function a(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&i(t)}function r(){function e(e){function t(e){e.preventDefault(),i(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&n(e,"click",t)}document.querySelectorAll('a[href^="#"]').forEach(e)}function s(){n(window,"hashchange",a)}function d(){setTimeout(a,c)}function l(){r(),s(),d()}x.enable&&l();return{findTarget:i}}(),Me("init","Init message from host page"),Y(),N=!1}function oe(e,t){void 0!==t&&""!==t&&"null"!==t&&document.body.style.setProperty(e,t)}function ie(e){({add(t){function o(){Me(e.eventName,e.eventType)}s[t]=o,n(window,t,o,{passive:!0})},remove(e){const t=s[e];delete s[e],o(window,e,t)}})[e.method](e.eventName)}function ae(e){ie({method:e,eventType:"After Print",eventName:"afterprint"}),ie({method:e,eventType:"Before Print",eventName:"beforeprint"}),ie({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}function re(){const e=document.querySelectorAll(`[${t}]`);M=e.length>0,O=M?e:ve(document)()}function ce(e,t,n,o){return t!==e&&(e in n||(ee(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in r&&te(`\n[31;1mDeprecated ${o}CalculationMethod (${e})[m\n\nThis version of [3miframe-resizer[m can auto detect the most suitable ${o} calculation method. It is recommended that you remove this option.`)),e}function se(){T=ce(T,l,Se,"height")}function de(){J=ce(J,g,Oe,"width")}function le(){!0===p&&(ae("add"),b=function(){function e(e){e.forEach(pe),re()}function t(){const t=new window.MutationObserver(e),n=document.querySelector("body"),o={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return t.observe(n,o),t}const n=t();return{disconnect(){n.disconnect()}}}(),F=new ResizeObserver(me),ge(window.document))}function me(e){Me("resizeObserver",`resizeObserver: ${function(e){switch(!0){case!Z(e):return"";case Z(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case Z(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(Z(e.className)?`.${e.className}`:"")}}(e[0].target)}`)}const ue=e=>{const t=getComputedStyle(e);return""!==t?.position&&"static"!==t?.position},fe=()=>[...ve(document)()].filter(ue);function he(e){e&&F.observe(e)}function ge(e){[...fe(),...h.flatMap((t=>e.querySelector(t)))].forEach(he)}function pe(e){"childList"===e.type&&ge(e.target)}function we(e){const t=(n=e).charAt(0).toUpperCase()+n.slice(1);var n;let o,a=0,r=O.length,c=0,s=performance.now();O.forEach((t=>{M||!d||t.checkVisibility(i)?(a=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),a>c&&(c=a,o=t)):r-=1})),s=performance.now()-s;const l=`\nParsed ${r} element${r=""} in ${s.toPrecision(3)}ms\n${t} ${M?"tagged ":""}element found at: ${c}px\nPosition calculated from HTML element: ${function(e){const t=e?.outerHTML?.toString();return t?t.length<30?t:`${t.slice(0,30).replaceAll("\n"," ")}...`:e}(o)}`;return s<1.1||N||M||te(`\n[31;1mPerformance Warning[m\n\nCalculateing the page size took an excessive amount of time. To improve performace add the [1mdata-iframe-size[m attribute to the ${e} element on the page.\n${l}`),c}const ye=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.documentElementBoundingClientRect()],ve=e=>()=>e.querySelectorAll("* :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)");const be={height:0,width:0},$e={height:0,width:0};function Ee(e,t){function n(){return $e[i]=a,be[i]=s,a}const o=e===Se,i=o?"height":"width",a=e.documentElementBoundingClientRect(),r=Math.ceil(a),c=Math.floor(a),s=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e);switch(!0){case!e.enabled():return s;case!t&&0===$e[i]&&0===be[i]:if(e.taggedElement(!0)<=r)return n();break;case V&&a===$e[i]&&s===be[i]:return Math.max(a,s);case 0===a:return s;case!t&&a!==$e[i]&&s<=be[i]:case!t&&a<$e[i]:case s===c||s===r:case a>s:return n();case!t:!function({ceilBoundingSize:e,dimension:t,isHeight:n,scrollSize:o}){const i=n?"bottom":"right";te(`\n[31;1mDetected content overflowing html element[m\n \nThis causes [3miframe-resizer[m to fall back to checking the position of every element on the page in order to calculate the correct dimensions of the iframe. Inspecting the size, ${i} margin, and position of every visable HTML element will have a performace impact on more complex pages. \n\nTo fix this issue, and remove this warning, you can either ensure the content of the page does not overflow the [1m<HTML>[m element or alternatively you can add the attribute [1mdata-iframe-size[m to the elements on the page that you want [3miframe-resizer[m to use when calculating the dimensions of the iframe. \n \nWhen present the [3m${i} margin of the ${n?"lowest":"right most"} element[m with a [1mdata-iframe-size[m attribute will be used to set the ${t} of the iframe.\n \n(Page size: ${o} > document size: ${e})`),n?T="autoOverflow":J="autoOverflow"}({ceilBoundingSize:r,dimension:i,isHeight:o,scrollSize:s})}return Math.max(e.taggedElement(),n())}const Se={enabled:()=>E,getOffset:()=>L,type:"height",auto:()=>Ee(Se,!1),autoOverflow:()=>Ee(Se,!0),bodyOffset:()=>{const{body:t}=document,n=getComputedStyle(t);return t.offsetHeight+parseInt(n.marginTop,e)+parseInt(n.marginBottom,e)},bodyScroll:()=>document.body.scrollHeight,offset:()=>Se.bodyOffset(),custom:()=>a.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().bottom,max:()=>Math.max(...ye(Se)),min:()=>Math.min(...ye(Se)),grow:()=>Se.max(),lowestElement:()=>we("bottom"),taggedElement:()=>we("bottom")},Oe={enabled:()=>S,getOffset:()=>k,type:"width",auto:()=>Ee(Oe,!1),autoOverflow:()=>Ee(Oe,!0),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>a.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().right,max:()=>Math.max(...ye(Oe)),min:()=>Math.min(...ye(Oe)),rightMostElement:()=>we("right"),scroll:()=>Math.max(Oe.bodyScroll(),Oe.documentElementScroll()),taggedElement:()=>we("right")};function ze(e,t,n,o){let i,a;!function(){const e=(e,t)=>!(Math.abs(e-t)<=W);return i=Math.ceil(void 0===n?Se[T]():n),a=Math.ceil(void 0===o?Oe[J]():o),E&&e(C,i)||S&&e(j,a)}()&&"init"!==e?!(e in{init:1,size:1})&&(E&&T in f||S&&J in f)&&Ie():(Ce(),C=i,j=a,Pe(C,j,e))}function Me(e,t,n,o){document.hidden||ze(e,0,n,o)}function Ce(){V||(V=!0,requestAnimationFrame((()=>{V=!1})))}function Te(e){C=Se[T](),j=Oe[J](),Pe(C,j,e)}function Ie(e){const t=T;T=l,Ce(),Te("reset"),T=t}function Pe(e,t,n,o,i){void 0!==i||(i=U),function(){const a=`${B}:${`${e+L}:${t+k}`}:${n}${void 0===o?"":`:${o}`}`;q?window.parent.iframeParentListener(m+a):D.postMessage(m+a,i)}()}function xe(e){const t={init:function(){P=e.data,D=e.source,ne(),z=!1,setTimeout((()=>{I=!1}),c)},reset(){I||Te("resetPage")},resize(){Me("resizeParent")},moveToAnchor(){x.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();G?G(JSON.parse(e)):Pe(0,0,"pageInfoStop")},parentInfo(){const e=o();K?K(Object.freeze(JSON.parse(e))):Pe(0,0,"parentInfoStop")},message(){const e=o();X(JSON.parse(e))}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,a=()=>e.data.split(":")[2]in{true:1,false:1};m===`${e.data}`.slice(0,u)&&(!1!==z?a()&&t.init():function(){const o=n();o in t?t[o]():i()||a()||ee(`Unexpected message (${e.data})`)}())}function Ne(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}function Re(e){return xe(e),Q}"undefined"!=typeof window&&(window.iframeChildListener=e=>xe({data:e,sameDomian:!0}),n(window,"message",xe),n(window,"readystatechange",Ne),Ne());try{top?.document?.getElementById("banner")&&(Q={},window.mockMsgListener=Re,o(window,"message",xe),define([],(()=>Re)))}catch(e){}
|
|
20
|
+
"use strict";const e=10,t="data-iframe-size",n=(e,t,n,o)=>e.addEventListener(t,n,o||!1),o=(e,t,n)=>e.removeEventListener(t,n,!1),i={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},a={height:()=>(ne("Custom height calculation function not defined"),Me.auto()),width:()=>(ne("Custom width calculation function not defined"),Ce.auto())},l={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,documentElementBoundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},r=128,c={},s="checkVisibility"in window,u="auto",d="[iFrameSizer]",m=d.length,f={max:1,min:1,bodyScroll:1,documentElementScroll:1},h=["body"],p="scroll";let y,g=!0,v="",b=0,w="",z=null,S="",$=!0,j=!1,E=null,O=!0,M=!1,C=1,A=u,T=!0,I="",P={},N=!0,x=!1,R=0,k=!1,B="",L=0,W=0,H="child",q=null,F=!1,D=window.parent,U="*",V=0,J=!1,Z=1,Q=p,Y=window,X=()=>{ne("onMessage function not defined")},G=()=>{},K=null,_=null;const ee=e=>""!=`${e}`&&void 0!==e;const te=(...e)=>[`${d}[${B}]`,...e].join(" "),ne=(...e)=>console?.warn(te(...e)),oe=(...e)=>console?.warn(((...e)=>window.chrome?te(...e).replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m"):te(...e).replaceAll(/\u001B\[[\d;]*m/gi,""))(...e)),ie=e=>oe(e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))));function ae(){!function(){try{F="iframeParentListener"in window.parent}catch(e){}}(),function(){const e=e=>"true"===e,t=I.slice(m).split(":");B=t[0],b=void 0===t[1]?b:Number(t[1]),j=void 0===t[2]?j:e(t[2]),x=void 0===t[3]?x:e(t[3]),g=void 0===t[6]?g:e(t[6]),w=t[7],A=void 0===t[8]?A:t[8],v=t[9],S=t[10],V=void 0===t[11]?V:Number(t[11]),P.enable=void 0!==t[12]&&e(t[12]),H=void 0===t[13]?H:t[13],Q=void 0===t[14]?Q:t[14],k=void 0===t[15]?k:e(t[15]),L=void 0===t[16]?L:Number(t[16]),W=void 0===t[17]?W:Number(t[17]),$=void 0===t[18]?$:e(t[18]),y=t[19]}(),function(){function e(){const e=window.iFrameResizer;X=e?.onMessage||X,G=e?.onReady||G,L=e?.offsetHeight||L,W=e?.offsetWidth||W,U=e?.targetOrigin||U,A=e?.heightCalculationMethod||A,Q=e?.widthCalculationMethod||Q}function t(e,t){return"function"==typeof e&&(a[t]=e,e="custom"),e}"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),A=t(A,"height"),Q=t(Q,"width"))}(),R=["1jqr0si6pnt","1p37k9w4kov"].indexOf(y),-1===R&&""!==y&&(R=-2),function(){void 0===w&&(w=`${b}px`);le("margin",function(e,t){t.includes("-")&&(ne(`Negative CSS value ignored for ${e}`),t="");return t}("margin",w))}(),le("background",v),le("padding",S),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)}(),R<0?ie(`${fe[R+2]}${fe[2]}`):R<2&&ie(fe[3]),de(),me(),function(){let e=!1;const n=n=>document.querySelectorAll(`[${n}]`).forEach((o=>{e=!0,o.removeAttribute(n),o.setAttribute(t,null)}));n("data-iframe-height"),n("data-iframe-width"),e&&oe("\n<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</>.")}(),document.querySelectorAll(`[${t}]`).length>0&&("auto"===A&&(A="autoOverflow"),"auto"===Q&&(Q="autoOverflow")),se(),Y.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===g?(g=!0,he()):!1===e&&!0===g&&(g=!1,ce("remove"),q?.disconnect(),z?.disconnect()),xe(0,0,"autoResize",JSON.stringify(g)),g),close(){xe(0,0,"close")},getId:()=>B,getPageInfo(e){if("function"==typeof e)return K=e,xe(0,0,"pageInfo"),void oe("\n<rb>Deprecated Method (getPageInfo()</>\n \nThe <b>getPageInfo()</> method has been deprecated and replaced with <b>getParentInfo()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n");K=null,xe(0,0,"pageInfoStop")},getParentInfo(e){if("function"==typeof e)return _=e,void xe(0,0,"parentInfo");_=null,xe(0,0,"parentInfoStop")},moveToAnchor(e){P.findTarget(e)},reset(){Ne()},scrollTo(e,t){xe(t,e,"scrollTo")},scrollToOffset(e,t){xe(t,e,"scrollToOffset")},sendMessage(e,t){xe(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){A=e,de()},setWidthCalculationMethod(e){Q=e,me()},setTargetOrigin(e){U=e},size(e,t){Te("size",`parentIFrame.size(${e||""}${t?`,${t}`:""})`,e,t)}}),Y.parentIFrame=Y.parentIframe,function(){if(!0!==k)return;function e(e){xe(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,o){n(window.document,t,e)}t("mouseenter"),t("mouseleave")}(),he(),P=function(){const t=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function o(n){const o=n.getBoundingClientRect(),i=t();return{x:parseInt(o.left,e)+parseInt(i.x,e),y:parseInt(o.top,e)+parseInt(i.y,e)}}function i(e){function t(e){const t=o(e);xe(t.y,t.x,"scrollToOffset")}const n=e.split("#")[1]||e,i=decodeURIComponent(n),a=document.getElementById(i)||document.getElementsByName(i)[0];void 0===a?xe(0,0,"inPageLink",`#${n}`):t(a)}function a(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&i(t)}function l(){function e(e){function t(e){e.preventDefault(),i(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&n(e,"click",t)}document.querySelectorAll('a[href^="#"]').forEach(e)}function c(){n(window,"hashchange",a)}function s(){setTimeout(a,r)}function u(){l(),c(),s()}P.enable&&u();return{findTarget:i}}(),Te("init","Init message from host page"),G(),N=!1}function le(e,t){void 0!==t&&""!==t&&"null"!==t&&document.body.style.setProperty(e,t)}function re(e){({add(t){function o(){Te(e.eventName,e.eventType)}c[t]=o,n(window,t,o,{passive:!0})},remove(e){const t=c[e];delete c[e],o(window,e,t)}})[e.method](e.eventName)}function ce(e){re({method:e,eventType:"After Print",eventName:"afterprint"}),re({method:e,eventType:"Before Print",eventName:"beforeprint"}),re({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}function se(){const e=document.querySelectorAll(`[${t}]`);M=e.length>0,E=M?e:$e(document)()}function ue(e,t,n,o){return t!==e&&(e in n||(ne(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in l&&oe(`\n<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.`)),e}function de(){A=ue(A,u,Me,"height")}function me(){Q=ue(Q,p,Ce,"width")}const fe=["<iy><yi>Puchspk Spjluzl Rlf</><iy><iy>","<iy><yi>Tpzzpun Spjluzl Rlf</><iy><iy>","Aopz spiyhyf pz hchpshisl dpao ivao Jvttlyjphs huk Vwlu-Zvbylz spjluzlz.<iy><iy><i>Jvttlyjphs Spjluzl</><iy>Mvy jvttlyjphs bzl, <p>pmyhtl-ylzpgly</> ylxbpylz h svd jvza vul aptul spjluzl mll. Mvy tvyl pumvythapvu cpzpa <b>oaaw://pmyhtl-ylzpgly.jvt/wypjpun</>.<iy><iy><i>Vwlu Zvbyjl Spjluzl</><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-jvtlyjphs vwlu zvbyjl wyvqlja, fvb jhu bzl pa mvy myll bukly aol alytz vm aol NWS C3 Spjluzl. Av jvumpyt fvb hjjlwa aolzl alytz, wslhzl zla aol <i>spjlujl</> rlf pu pmyhtlYlzpgl vwapvuz av <i>'NWS-C3'</>.<iy><iy>Mvy tvyl pumvythapvu vu aol Nub Wbispj Spjluzl <iy><b>oaaw://pmyhtl-ylzpgly.jvt/vwlu-zvbyjl-spjluzl</>","<i>NWS-C3 Spjluzl Clyzpvu</><iy><iy>Aopz clyzpvu vm <p>pmyhtl-ylzpgly</> pz ilpun bzlk bukly aol alytz vm aol <i>NWS C3</> spjluzl. Pm fvb hyl bzpun aopz spiyhyf pu h jvttlyjphs wyvqlja, fvb dpss ullk av wbyjohzl h svd jvza vul aptl spjluzl. Mvy tvyl pumvythapvu cpzpa <b>oaaw://pmyhtl-ylzpgly.jvt/wypjpun</>."];function he(){!0===g&&(ce("add"),z=function(){function e(e){e.forEach(we),se()}function t(){const t=new window.MutationObserver(e),n=document.querySelector("body"),o={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return t.observe(n,o),t}const n=t();return{disconnect(){n.disconnect()}}}(),q=new ResizeObserver(pe),be(window.document))}function pe(e){Te("resizeObserver",`resizeObserver: ${function(e){switch(!0){case!ee(e):return"";case ee(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case ee(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(ee(e.className)?`.${e.className}`:"")}}(e[0].target)}`)}const ye=e=>{const t=getComputedStyle(e);return""!==t?.position&&"static"!==t?.position},ge=()=>[...$e(document)()].filter(ye);function ve(e){e&&q.observe(e)}function be(e){[...ge(),...h.flatMap((t=>e.querySelector(t)))].forEach(ve)}function we(e){"childList"===e.type&&be(e.target)}function ze(e){const t=(n=e).charAt(0).toUpperCase()+n.slice(1);var n;let o,a=0,l=E.length,r=0,c=performance.now();E.forEach((t=>{M||!s||t.checkVisibility(i)?(a=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),a>r&&(r=a,o=t)):l-=1})),c=performance.now()-c;const u=`\nParsed ${l} element${l=""} in ${c.toPrecision(3)}ms\n${t} ${M?"tagged ":""}element found at: ${r}px\nPosition calculated from HTML element: ${function(e){const t=e?.outerHTML?.toString();return t?t.length<30?t:`${t.slice(0,30).replaceAll("\n"," ")}...`:e}(o)}`;return c<1.1||N||M||oe(`\n<rb>Performance Warning</>\n\nCalculateing the page size took an excessive amount of time. To improve performace add the <b>data-iframe-size</> attribute to the ${e} element on the page.\n${u}`),r}const Se=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.documentElementBoundingClientRect()],$e=e=>()=>e.querySelectorAll("* :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)");const je={height:0,width:0},Ee={height:0,width:0};function Oe(e,t){function n(){return Ee[i]=a,je[i]=c,a}const o=e===Me,i=o?"height":"width",a=e.documentElementBoundingClientRect(),l=Math.ceil(a),r=Math.floor(a),c=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e);switch(!0){case!e.enabled():return c;case!t&&0===Ee[i]&&0===je[i]:if(e.taggedElement(!0)<=l)return n();break;case J&&a===Ee[i]&&c===je[i]:return Math.max(a,c);case 0===a:return c;case!t&&a!==Ee[i]&&c<=je[i]:case!t&&a<Ee[i]:case c===r||c===l:case a>c:return n();case!t:!function({ceilBoundingSize:e,dimension:t,isHeight:n,scrollSize:o}){const i=n?"bottom":"right";oe(`\n<rb>Detected content overflowing html element</>\n \nThis causes <i>iframe-resizer</> to fall back to checking the position of every element on the page in order to calculate the correct dimensions of the iframe. Inspecting the size, ${i} margin, and position of every visable HTML element will have a performace impact on more complex pages. \n\nTo fix this issue, and remove this warning, you can either ensure the content of the page does not overflow the <b><HTML></> element or alternatively you can add the attribute <b>data-iframe-size</> to the elements on the page that you want <i>iframe-resizer</> to use when calculating the dimensions of the iframe. \n \nWhen present the <i>${i} margin of the ${n?"lowest":"right most"} element</> with a <b>data-iframe-size</> attribute will be used to set the ${t} of the iframe.\n \n(Page size: ${o} > document size: ${e})`),n?A="autoOverflow":Q="autoOverflow"}({ceilBoundingSize:l,dimension:i,isHeight:o,scrollSize:c})}return Math.max(e.taggedElement(),n())}const Me={enabled:()=>$,getOffset:()=>L,type:"height",auto:()=>Oe(Me,!1),autoOverflow:()=>Oe(Me,!0),bodyOffset:()=>{const{body:t}=document,n=getComputedStyle(t);return t.offsetHeight+parseInt(n.marginTop,e)+parseInt(n.marginBottom,e)},bodyScroll:()=>document.body.scrollHeight,offset:()=>Me.bodyOffset(),custom:()=>a.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().bottom,max:()=>Math.max(...Se(Me)),min:()=>Math.min(...Se(Me)),grow:()=>Me.max(),lowestElement:()=>ze("bottom"),taggedElement:()=>ze("bottom")},Ce={enabled:()=>j,getOffset:()=>W,type:"width",auto:()=>Oe(Ce,!1),autoOverflow:()=>Oe(Ce,!0),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>a.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().right,max:()=>Math.max(...Se(Ce)),min:()=>Math.min(...Se(Ce)),rightMostElement:()=>ze("right"),scroll:()=>Math.max(Ce.bodyScroll(),Ce.documentElementScroll()),taggedElement:()=>ze("right")};function Ae(e,t,n,o){let i,a;!function(){const e=(e,t)=>!(Math.abs(e-t)<=V);return i=Math.ceil(void 0===n?Me[A]():n),a=Math.ceil(void 0===o?Ce[Q]():o),$&&e(C,i)||j&&e(Z,a)}()&&"init"!==e?!(e in{init:1,size:1})&&($&&A in f||j&&Q in f)&&Ne():(Ie(),C=i,Z=a,xe(C,Z,e))}function Te(e,t,n,o){document.hidden||Ae(e,0,n,o)}function Ie(){J||(J=!0,requestAnimationFrame((()=>{J=!1})))}function Pe(e){C=Me[A](),Z=Ce[Q](),xe(C,Z,e)}function Ne(e){const t=A;A=u,Ie(),Pe("reset"),A=t}function xe(e,t,n,o,i){R<0||(void 0!==i||(i=U),function(){const a=`${B}:${`${e+L}:${t+W}`}:${n}${void 0===o?"":`:${o}`}`;F?window.parent.iframeParentListener(d+a):D.postMessage(d+a,i)}())}function Re(e){const t={init:function(){I=e.data,D=e.source,ae(),O=!1,setTimeout((()=>{T=!1}),r)},reset(){T||Pe("resetPage")},resize(){Te("resizeParent")},moveToAnchor(){P.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();K?K(JSON.parse(e)):xe(0,0,"pageInfoStop")},parentInfo(){const e=o();_?_(Object.freeze(JSON.parse(e))):xe(0,0,"parentInfoStop")},message(){const e=o();X(JSON.parse(e))}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,a=()=>e.data.split(":")[2]in{true:1,false:1};d===`${e.data}`.slice(0,m)&&(!1!==O?a()&&t.init():function(){const o=n();o in t?t[o]():i()||a()||ne(`Unexpected message (${e.data})`)}())}function ke(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}function Be(e){return Re(e),Y}"undefined"!=typeof window&&(window.iframeChildListener=e=>Re({data:e,sameDomian:!0}),n(window,"message",Re),n(window,"readystatechange",ke),ke());try{top?.document?.getElementById("banner")&&(Y={},window.mockMsgListener=Be,o(window,"message",Re),define([],(()=>Be)))}catch(e){}
|
package/index.esm.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @preserve
|
|
3
3
|
*
|
|
4
|
-
* @module iframe-resizer/child 5.0.0-alpha.
|
|
4
|
+
* @module iframe-resizer/child 5.0.0-alpha.5 (esm) - 2024-04-17
|
|
5
5
|
*
|
|
6
6
|
* @license GPL-3.0 for non-commercial use only.
|
|
7
7
|
* For commercial use, you must purchase a license from
|
|
8
|
-
*
|
|
8
|
+
* http://iframe-resizer.com/pricing
|
|
9
9
|
*
|
|
10
10
|
* @desciption Keep same and cross domain iFrames sized to their content
|
|
11
11
|
*
|
|
12
12
|
* @author David J. Bradshaw <dave@bradshaw.net>
|
|
13
13
|
*
|
|
14
|
-
* @see {@link
|
|
14
|
+
* @see {@link http://iframe-resizer.com}
|
|
15
15
|
*
|
|
16
16
|
* @copyright (c) 2013 - 2024, David J. Bradshaw. All rights reserved.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
const e=10,t="data-iframe-size",n=(e,t,n,o)=>e.addEventListener(t,n,o||!1),o=(e,t,n)=>e.removeEventListener(t,n,!1),i={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},a={height:()=>(ee("Custom height calculation function not defined"),Se.auto()),width:()=>(ee("Custom width calculation function not defined"),Oe.auto())},r={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,documentElementBoundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},c=128,s={},d="checkVisibility"in window,l="auto",m="[iFrameSizer]",u=m.length,f={max:1,min:1,bodyScroll:1,documentElementScroll:1},h=["body"],g="scroll";let p=!0,w="",y=0,v="",b=null,$="",E=!0,S=!1,O=null,z=!0,M=!1,C=1,T=l,I=!0,P="",x={},N=!0,R=!1,A=!1,B="",L=0,k=0,H="child",F=null,q=!1,D=window.parent,U="*",W=0,V=!1,j=1,J=g,Q=window,X=()=>{ee("onMessage function not defined")},Y=()=>{},G=null,K=null;const Z=e=>""!=`${e}`&&void 0!==e;const _=(...e)=>[`${m}[${B}]`,...e].join(" "),ee=(...e)=>console?.warn(_(...e)),te=(...e)=>console?.warn(window.chrome?_(...e):_(...e).replaceAll(/\u001B\[[\d;]*m/gi,""));function ne(){!function(){try{q="iframeParentListener"in window.parent}catch(e){}}(),function(){const e=e=>"true"===e,t=P.slice(u).split(":");B=t[0],y=void 0===t[1]?y:Number(t[1]),S=void 0===t[2]?S:e(t[2]),R=void 0===t[3]?R:e(t[3]),p=void 0===t[6]?p:e(t[6]),v=t[7],T=void 0===t[8]?T:t[8],w=t[9],$=t[10],W=void 0===t[11]?W:Number(t[11]),x.enable=void 0!==t[12]&&e(t[12]),H=void 0===t[13]?H:t[13],J=void 0===t[14]?J:t[14],A=void 0===t[15]?A:e(t[15]),L=void 0===t[16]?L:Number(t[16]),k=void 0===t[17]?k:Number(t[17]),E=void 0===t[18]?E:e(t[18])}(),function(){function e(){const e=window.iFrameResizer;X=e?.onMessage||X,Y=e?.onReady||Y,L=e?.offsetHeight||L,k=e?.offsetWidth||k,U=e?.targetOrigin||U,T=e?.heightCalculationMethod||T,J=e?.widthCalculationMethod||J}function t(e,t){return"function"==typeof e&&(a[t]=e,e="custom"),e}"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),T=t(T,"height"),J=t(J,"width"))}(),function(){void 0===v&&(v=`${y}px`);oe("margin",function(e,t){t.includes("-")&&(ee(`Negative CSS value ignored for ${e}`),t="");return t}("margin",v))}(),oe("background",w),oe("padding",$),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)}(),se(),de(),function(){let e=!1;const n=n=>document.querySelectorAll(`[${n}]`).forEach((o=>{e=!0,o.removeAttribute(n),o.setAttribute(t,null)}));n("data-iframe-height"),n("data-iframe-width"),e&&te("\n[31;1mDeprecated Attributes[m\n \nThe [1mdata-iframe-height[m and [1mdata-iframe-width[m attributes have been deprecated and replaced with the single [1mdata-iframe-size[m attribute. Use of the old attributes will be removed in a future version of [3miframe-resizer[m.")}(),document.querySelectorAll(`[${t}]`).length>0&&("auto"===T&&(T="autoOverflow"),"auto"===J&&(J="autoOverflow")),re(),Q.parentIFrame={autoResize:e=>(!0===e&&!1===p?(p=!0,le()):!1===e&&!0===p&&(p=!1,ae("remove"),F?.disconnect(),b?.disconnect()),Pe(0,0,"autoResize",JSON.stringify(p)),p),close(){Pe(0,0,"close")},getId:()=>B,getPageInfo(e){if("function"==typeof e)return G=e,Pe(0,0,"pageInfo"),void te("\n[31;1mDeprecated Method (getPageInfo()[m\n \nThe [1mgetPageInfo()[m method has been deprecated and replaced with [1mgetParentInfo()[m. Use of this method will be removed in a future version of [3miframe-resizer[m.\n");G=null,Pe(0,0,"pageInfoStop")},getParentInfo(e){if("function"==typeof e)return K=e,void Pe(0,0,"parentInfo");K=null,Pe(0,0,"parentInfoStop")},moveToAnchor(e){x.findTarget(e)},reset(){Ie()},scrollTo(e,t){Pe(t,e,"scrollTo")},scrollToOffset(e,t){Pe(t,e,"scrollToOffset")},sendMessage(e,t){Pe(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){T=e,se()},setWidthCalculationMethod(e){J=e,de()},setTargetOrigin(e){U=e},size(e,t){Me("size",`parentIFrame.size(${e||""}${t?`,${t}`:""})`,e,t)}},function(){if(!0!==A)return;function e(e){Pe(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,o){n(window.document,t,e)}t("mouseenter"),t("mouseleave")}(),le(),x=function(){const t=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function o(n){const o=n.getBoundingClientRect(),i=t();return{x:parseInt(o.left,e)+parseInt(i.x,e),y:parseInt(o.top,e)+parseInt(i.y,e)}}function i(e){function t(e){const t=o(e);Pe(t.y,t.x,"scrollToOffset")}const n=e.split("#")[1]||e,i=decodeURIComponent(n),a=document.getElementById(i)||document.getElementsByName(i)[0];void 0===a?Pe(0,0,"inPageLink",`#${n}`):t(a)}function a(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&i(t)}function r(){function e(e){function t(e){e.preventDefault(),i(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&n(e,"click",t)}document.querySelectorAll('a[href^="#"]').forEach(e)}function s(){n(window,"hashchange",a)}function d(){setTimeout(a,c)}function l(){r(),s(),d()}x.enable&&l();return{findTarget:i}}(),Me("init","Init message from host page"),Y(),N=!1}function oe(e,t){void 0!==t&&""!==t&&"null"!==t&&document.body.style.setProperty(e,t)}function ie(e){({add(t){function o(){Me(e.eventName,e.eventType)}s[t]=o,n(window,t,o,{passive:!0})},remove(e){const t=s[e];delete s[e],o(window,e,t)}})[e.method](e.eventName)}function ae(e){ie({method:e,eventType:"After Print",eventName:"afterprint"}),ie({method:e,eventType:"Before Print",eventName:"beforeprint"}),ie({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}function re(){const e=document.querySelectorAll(`[${t}]`);M=e.length>0,O=M?e:ve(document)()}function ce(e,t,n,o){return t!==e&&(e in n||(ee(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in r&&te(`\n[31;1mDeprecated ${o}CalculationMethod (${e})[m\n\nThis version of [3miframe-resizer[m can auto detect the most suitable ${o} calculation method. It is recommended that you remove this option.`)),e}function se(){T=ce(T,l,Se,"height")}function de(){J=ce(J,g,Oe,"width")}function le(){!0===p&&(ae("add"),b=function(){function e(e){e.forEach(pe),re()}function t(){const t=new window.MutationObserver(e),n=document.querySelector("body"),o={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return t.observe(n,o),t}const n=t();return{disconnect(){n.disconnect()}}}(),F=new ResizeObserver(me),ge(window.document))}function me(e){Me("resizeObserver",`resizeObserver: ${function(e){switch(!0){case!Z(e):return"";case Z(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case Z(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(Z(e.className)?`.${e.className}`:"")}}(e[0].target)}`)}const ue=e=>{const t=getComputedStyle(e);return""!==t?.position&&"static"!==t?.position},fe=()=>[...ve(document)()].filter(ue);function he(e){e&&F.observe(e)}function ge(e){[...fe(),...h.flatMap((t=>e.querySelector(t)))].forEach(he)}function pe(e){"childList"===e.type&&ge(e.target)}function we(e){const t=(n=e).charAt(0).toUpperCase()+n.slice(1);var n;let o,a=0,r=O.length,c=0,s=performance.now();O.forEach((t=>{M||!d||t.checkVisibility(i)?(a=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),a>c&&(c=a,o=t)):r-=1})),s=performance.now()-s;const l=`\nParsed ${r} element${r=""} in ${s.toPrecision(3)}ms\n${t} ${M?"tagged ":""}element found at: ${c}px\nPosition calculated from HTML element: ${function(e){const t=e?.outerHTML?.toString();return t?t.length<30?t:`${t.slice(0,30).replaceAll("\n"," ")}...`:e}(o)}`;return s<1.1||N||M||te(`\n[31;1mPerformance Warning[m\n\nCalculateing the page size took an excessive amount of time. To improve performace add the [1mdata-iframe-size[m attribute to the ${e} element on the page.\n${l}`),c}const ye=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.documentElementBoundingClientRect()],ve=e=>()=>e.querySelectorAll("* :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)");const be={height:0,width:0},$e={height:0,width:0};function Ee(e,t){function n(){return $e[i]=a,be[i]=s,a}const o=e===Se,i=o?"height":"width",a=e.documentElementBoundingClientRect(),r=Math.ceil(a),c=Math.floor(a),s=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e);switch(!0){case!e.enabled():return s;case!t&&0===$e[i]&&0===be[i]:if(e.taggedElement(!0)<=r)return n();break;case V&&a===$e[i]&&s===be[i]:return Math.max(a,s);case 0===a:return s;case!t&&a!==$e[i]&&s<=be[i]:case!t&&a<$e[i]:case s===c||s===r:case a>s:return n();case!t:!function({ceilBoundingSize:e,dimension:t,isHeight:n,scrollSize:o}){const i=n?"bottom":"right";te(`\n[31;1mDetected content overflowing html element[m\n \nThis causes [3miframe-resizer[m to fall back to checking the position of every element on the page in order to calculate the correct dimensions of the iframe. Inspecting the size, ${i} margin, and position of every visable HTML element will have a performace impact on more complex pages. \n\nTo fix this issue, and remove this warning, you can either ensure the content of the page does not overflow the [1m<HTML>[m element or alternatively you can add the attribute [1mdata-iframe-size[m to the elements on the page that you want [3miframe-resizer[m to use when calculating the dimensions of the iframe. \n \nWhen present the [3m${i} margin of the ${n?"lowest":"right most"} element[m with a [1mdata-iframe-size[m attribute will be used to set the ${t} of the iframe.\n \n(Page size: ${o} > document size: ${e})`),n?T="autoOverflow":J="autoOverflow"}({ceilBoundingSize:r,dimension:i,isHeight:o,scrollSize:s})}return Math.max(e.taggedElement(),n())}const Se={enabled:()=>E,getOffset:()=>L,type:"height",auto:()=>Ee(Se,!1),autoOverflow:()=>Ee(Se,!0),bodyOffset:()=>{const{body:t}=document,n=getComputedStyle(t);return t.offsetHeight+parseInt(n.marginTop,e)+parseInt(n.marginBottom,e)},bodyScroll:()=>document.body.scrollHeight,offset:()=>Se.bodyOffset(),custom:()=>a.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().bottom,max:()=>Math.max(...ye(Se)),min:()=>Math.min(...ye(Se)),grow:()=>Se.max(),lowestElement:()=>we("bottom"),taggedElement:()=>we("bottom")},Oe={enabled:()=>S,getOffset:()=>k,type:"width",auto:()=>Ee(Oe,!1),autoOverflow:()=>Ee(Oe,!0),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>a.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().right,max:()=>Math.max(...ye(Oe)),min:()=>Math.min(...ye(Oe)),rightMostElement:()=>we("right"),scroll:()=>Math.max(Oe.bodyScroll(),Oe.documentElementScroll()),taggedElement:()=>we("right")};function ze(e,t,n,o){let i,a;!function(){const e=(e,t)=>!(Math.abs(e-t)<=W);return i=Math.ceil(void 0===n?Se[T]():n),a=Math.ceil(void 0===o?Oe[J]():o),E&&e(C,i)||S&&e(j,a)}()&&"init"!==e?!(e in{init:1,size:1})&&(E&&T in f||S&&J in f)&&Ie():(Ce(),C=i,j=a,Pe(C,j,e))}function Me(e,t,n,o){document.hidden||ze(e,0,n,o)}function Ce(){V||(V=!0,requestAnimationFrame((()=>{V=!1})))}function Te(e){C=Se[T](),j=Oe[J](),Pe(C,j,e)}function Ie(e){const t=T;T=l,Ce(),Te("reset"),T=t}function Pe(e,t,n,o,i){void 0!==i||(i=U),function(){const a=`${B}:${`${e+L}:${t+k}`}:${n}${void 0===o?"":`:${o}`}`;q?window.parent.iframeParentListener(m+a):D.postMessage(m+a,i)}()}function xe(e){const t={init:function(){P=e.data,D=e.source,ne(),z=!1,setTimeout((()=>{I=!1}),c)},reset(){I||Te("resetPage")},resize(){Me("resizeParent")},moveToAnchor(){x.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();G?G(JSON.parse(e)):Pe(0,0,"pageInfoStop")},parentInfo(){const e=o();K?K(Object.freeze(JSON.parse(e))):Pe(0,0,"parentInfoStop")},message(){const e=o();X(JSON.parse(e))}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,a=()=>e.data.split(":")[2]in{true:1,false:1};m===`${e.data}`.slice(0,u)&&(!1!==z?a()&&t.init():function(){const o=n();o in t?t[o]():i()||a()||ee(`Unexpected message (${e.data})`)}())}function Ne(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}function Re(e){return xe(e),Q}"undefined"!=typeof window&&(window.iframeChildListener=e=>xe({data:e,sameDomian:!0}),n(window,"message",xe),n(window,"readystatechange",Ne),Ne());try{top?.document?.getElementById("banner")&&(Q={},window.mockMsgListener=Re,o(window,"message",xe),define([],(()=>Re)))}catch(e){}
|
|
20
|
+
const e=10,t="data-iframe-size",n=(e,t,n,o)=>e.addEventListener(t,n,o||!1),o=(e,t,n)=>e.removeEventListener(t,n,!1),i={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},a={height:()=>(ne("Custom height calculation function not defined"),Me.auto()),width:()=>(ne("Custom width calculation function not defined"),Ce.auto())},l={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,documentElementBoundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},r=128,c={},s="checkVisibility"in window,u="auto",d="[iFrameSizer]",m=d.length,f={max:1,min:1,bodyScroll:1,documentElementScroll:1},h=["body"],p="scroll";let y,g=!0,v="",b=0,w="",z=null,S="",$=!0,j=!1,E=null,O=!0,M=!1,C=1,A=u,T=!0,I="",P={},N=!0,x=!1,R=0,k=!1,B="",L=0,W=0,H="child",q=null,F=!1,D=window.parent,U="*",V=0,J=!1,Z=1,Q=p,Y=window,X=()=>{ne("onMessage function not defined")},G=()=>{},K=null,_=null;const ee=e=>""!=`${e}`&&void 0!==e;const te=(...e)=>[`${d}[${B}]`,...e].join(" "),ne=(...e)=>console?.warn(te(...e)),oe=(...e)=>console?.warn(((...e)=>window.chrome?te(...e).replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m"):te(...e).replaceAll(/\u001B\[[\d;]*m/gi,""))(...e)),ie=e=>oe(e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))));function ae(){!function(){try{F="iframeParentListener"in window.parent}catch(e){}}(),function(){const e=e=>"true"===e,t=I.slice(m).split(":");B=t[0],b=void 0===t[1]?b:Number(t[1]),j=void 0===t[2]?j:e(t[2]),x=void 0===t[3]?x:e(t[3]),g=void 0===t[6]?g:e(t[6]),w=t[7],A=void 0===t[8]?A:t[8],v=t[9],S=t[10],V=void 0===t[11]?V:Number(t[11]),P.enable=void 0!==t[12]&&e(t[12]),H=void 0===t[13]?H:t[13],Q=void 0===t[14]?Q:t[14],k=void 0===t[15]?k:e(t[15]),L=void 0===t[16]?L:Number(t[16]),W=void 0===t[17]?W:Number(t[17]),$=void 0===t[18]?$:e(t[18]),y=t[19]}(),function(){function e(){const e=window.iFrameResizer;X=e?.onMessage||X,G=e?.onReady||G,L=e?.offsetHeight||L,W=e?.offsetWidth||W,U=e?.targetOrigin||U,A=e?.heightCalculationMethod||A,Q=e?.widthCalculationMethod||Q}function t(e,t){return"function"==typeof e&&(a[t]=e,e="custom"),e}"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),A=t(A,"height"),Q=t(Q,"width"))}(),R=["1jqr0si6pnt","1p37k9w4kov"].indexOf(y),-1===R&&""!==y&&(R=-2),function(){void 0===w&&(w=`${b}px`);le("margin",function(e,t){t.includes("-")&&(ne(`Negative CSS value ignored for ${e}`),t="");return t}("margin",w))}(),le("background",v),le("padding",S),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)}(),R<0?ie(`${fe[R+2]}${fe[2]}`):R<2&&ie(fe[3]),de(),me(),function(){let e=!1;const n=n=>document.querySelectorAll(`[${n}]`).forEach((o=>{e=!0,o.removeAttribute(n),o.setAttribute(t,null)}));n("data-iframe-height"),n("data-iframe-width"),e&&oe("\n<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</>.")}(),document.querySelectorAll(`[${t}]`).length>0&&("auto"===A&&(A="autoOverflow"),"auto"===Q&&(Q="autoOverflow")),se(),Y.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===g?(g=!0,he()):!1===e&&!0===g&&(g=!1,ce("remove"),q?.disconnect(),z?.disconnect()),xe(0,0,"autoResize",JSON.stringify(g)),g),close(){xe(0,0,"close")},getId:()=>B,getPageInfo(e){if("function"==typeof e)return K=e,xe(0,0,"pageInfo"),void oe("\n<rb>Deprecated Method (getPageInfo()</>\n \nThe <b>getPageInfo()</> method has been deprecated and replaced with <b>getParentInfo()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n");K=null,xe(0,0,"pageInfoStop")},getParentInfo(e){if("function"==typeof e)return _=e,void xe(0,0,"parentInfo");_=null,xe(0,0,"parentInfoStop")},moveToAnchor(e){P.findTarget(e)},reset(){Ne()},scrollTo(e,t){xe(t,e,"scrollTo")},scrollToOffset(e,t){xe(t,e,"scrollToOffset")},sendMessage(e,t){xe(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){A=e,de()},setWidthCalculationMethod(e){Q=e,me()},setTargetOrigin(e){U=e},size(e,t){Te("size",`parentIFrame.size(${e||""}${t?`,${t}`:""})`,e,t)}}),Y.parentIFrame=Y.parentIframe,function(){if(!0!==k)return;function e(e){xe(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,o){n(window.document,t,e)}t("mouseenter"),t("mouseleave")}(),he(),P=function(){const t=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function o(n){const o=n.getBoundingClientRect(),i=t();return{x:parseInt(o.left,e)+parseInt(i.x,e),y:parseInt(o.top,e)+parseInt(i.y,e)}}function i(e){function t(e){const t=o(e);xe(t.y,t.x,"scrollToOffset")}const n=e.split("#")[1]||e,i=decodeURIComponent(n),a=document.getElementById(i)||document.getElementsByName(i)[0];void 0===a?xe(0,0,"inPageLink",`#${n}`):t(a)}function a(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&i(t)}function l(){function e(e){function t(e){e.preventDefault(),i(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&n(e,"click",t)}document.querySelectorAll('a[href^="#"]').forEach(e)}function c(){n(window,"hashchange",a)}function s(){setTimeout(a,r)}function u(){l(),c(),s()}P.enable&&u();return{findTarget:i}}(),Te("init","Init message from host page"),G(),N=!1}function le(e,t){void 0!==t&&""!==t&&"null"!==t&&document.body.style.setProperty(e,t)}function re(e){({add(t){function o(){Te(e.eventName,e.eventType)}c[t]=o,n(window,t,o,{passive:!0})},remove(e){const t=c[e];delete c[e],o(window,e,t)}})[e.method](e.eventName)}function ce(e){re({method:e,eventType:"After Print",eventName:"afterprint"}),re({method:e,eventType:"Before Print",eventName:"beforeprint"}),re({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}function se(){const e=document.querySelectorAll(`[${t}]`);M=e.length>0,E=M?e:$e(document)()}function ue(e,t,n,o){return t!==e&&(e in n||(ne(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in l&&oe(`\n<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.`)),e}function de(){A=ue(A,u,Me,"height")}function me(){Q=ue(Q,p,Ce,"width")}const fe=["<iy><yi>Puchspk Spjluzl Rlf</><iy><iy>","<iy><yi>Tpzzpun Spjluzl Rlf</><iy><iy>","Aopz spiyhyf pz hchpshisl dpao ivao Jvttlyjphs huk Vwlu-Zvbylz spjluzlz.<iy><iy><i>Jvttlyjphs Spjluzl</><iy>Mvy jvttlyjphs bzl, <p>pmyhtl-ylzpgly</> ylxbpylz h svd jvza vul aptul spjluzl mll. Mvy tvyl pumvythapvu cpzpa <b>oaaw://pmyhtl-ylzpgly.jvt/wypjpun</>.<iy><iy><i>Vwlu Zvbyjl Spjluzl</><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-jvtlyjphs vwlu zvbyjl wyvqlja, fvb jhu bzl pa mvy myll bukly aol alytz vm aol NWS C3 Spjluzl. Av jvumpyt fvb hjjlwa aolzl alytz, wslhzl zla aol <i>spjlujl</> rlf pu pmyhtlYlzpgl vwapvuz av <i>'NWS-C3'</>.<iy><iy>Mvy tvyl pumvythapvu vu aol Nub Wbispj Spjluzl <iy><b>oaaw://pmyhtl-ylzpgly.jvt/vwlu-zvbyjl-spjluzl</>","<i>NWS-C3 Spjluzl Clyzpvu</><iy><iy>Aopz clyzpvu vm <p>pmyhtl-ylzpgly</> pz ilpun bzlk bukly aol alytz vm aol <i>NWS C3</> spjluzl. Pm fvb hyl bzpun aopz spiyhyf pu h jvttlyjphs wyvqlja, fvb dpss ullk av wbyjohzl h svd jvza vul aptl spjluzl. Mvy tvyl pumvythapvu cpzpa <b>oaaw://pmyhtl-ylzpgly.jvt/wypjpun</>."];function he(){!0===g&&(ce("add"),z=function(){function e(e){e.forEach(we),se()}function t(){const t=new window.MutationObserver(e),n=document.querySelector("body"),o={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return t.observe(n,o),t}const n=t();return{disconnect(){n.disconnect()}}}(),q=new ResizeObserver(pe),be(window.document))}function pe(e){Te("resizeObserver",`resizeObserver: ${function(e){switch(!0){case!ee(e):return"";case ee(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case ee(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(ee(e.className)?`.${e.className}`:"")}}(e[0].target)}`)}const ye=e=>{const t=getComputedStyle(e);return""!==t?.position&&"static"!==t?.position},ge=()=>[...$e(document)()].filter(ye);function ve(e){e&&q.observe(e)}function be(e){[...ge(),...h.flatMap((t=>e.querySelector(t)))].forEach(ve)}function we(e){"childList"===e.type&&be(e.target)}function ze(e){const t=(n=e).charAt(0).toUpperCase()+n.slice(1);var n;let o,a=0,l=E.length,r=0,c=performance.now();E.forEach((t=>{M||!s||t.checkVisibility(i)?(a=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),a>r&&(r=a,o=t)):l-=1})),c=performance.now()-c;const u=`\nParsed ${l} element${l=""} in ${c.toPrecision(3)}ms\n${t} ${M?"tagged ":""}element found at: ${r}px\nPosition calculated from HTML element: ${function(e){const t=e?.outerHTML?.toString();return t?t.length<30?t:`${t.slice(0,30).replaceAll("\n"," ")}...`:e}(o)}`;return c<1.1||N||M||oe(`\n<rb>Performance Warning</>\n\nCalculateing the page size took an excessive amount of time. To improve performace add the <b>data-iframe-size</> attribute to the ${e} element on the page.\n${u}`),r}const Se=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.documentElementBoundingClientRect()],$e=e=>()=>e.querySelectorAll("* :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)");const je={height:0,width:0},Ee={height:0,width:0};function Oe(e,t){function n(){return Ee[i]=a,je[i]=c,a}const o=e===Me,i=o?"height":"width",a=e.documentElementBoundingClientRect(),l=Math.ceil(a),r=Math.floor(a),c=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e);switch(!0){case!e.enabled():return c;case!t&&0===Ee[i]&&0===je[i]:if(e.taggedElement(!0)<=l)return n();break;case J&&a===Ee[i]&&c===je[i]:return Math.max(a,c);case 0===a:return c;case!t&&a!==Ee[i]&&c<=je[i]:case!t&&a<Ee[i]:case c===r||c===l:case a>c:return n();case!t:!function({ceilBoundingSize:e,dimension:t,isHeight:n,scrollSize:o}){const i=n?"bottom":"right";oe(`\n<rb>Detected content overflowing html element</>\n \nThis causes <i>iframe-resizer</> to fall back to checking the position of every element on the page in order to calculate the correct dimensions of the iframe. Inspecting the size, ${i} margin, and position of every visable HTML element will have a performace impact on more complex pages. \n\nTo fix this issue, and remove this warning, you can either ensure the content of the page does not overflow the <b><HTML></> element or alternatively you can add the attribute <b>data-iframe-size</> to the elements on the page that you want <i>iframe-resizer</> to use when calculating the dimensions of the iframe. \n \nWhen present the <i>${i} margin of the ${n?"lowest":"right most"} element</> with a <b>data-iframe-size</> attribute will be used to set the ${t} of the iframe.\n \n(Page size: ${o} > document size: ${e})`),n?A="autoOverflow":Q="autoOverflow"}({ceilBoundingSize:l,dimension:i,isHeight:o,scrollSize:c})}return Math.max(e.taggedElement(),n())}const Me={enabled:()=>$,getOffset:()=>L,type:"height",auto:()=>Oe(Me,!1),autoOverflow:()=>Oe(Me,!0),bodyOffset:()=>{const{body:t}=document,n=getComputedStyle(t);return t.offsetHeight+parseInt(n.marginTop,e)+parseInt(n.marginBottom,e)},bodyScroll:()=>document.body.scrollHeight,offset:()=>Me.bodyOffset(),custom:()=>a.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().bottom,max:()=>Math.max(...Se(Me)),min:()=>Math.min(...Se(Me)),grow:()=>Me.max(),lowestElement:()=>ze("bottom"),taggedElement:()=>ze("bottom")},Ce={enabled:()=>j,getOffset:()=>W,type:"width",auto:()=>Oe(Ce,!1),autoOverflow:()=>Oe(Ce,!0),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>a.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().right,max:()=>Math.max(...Se(Ce)),min:()=>Math.min(...Se(Ce)),rightMostElement:()=>ze("right"),scroll:()=>Math.max(Ce.bodyScroll(),Ce.documentElementScroll()),taggedElement:()=>ze("right")};function Ae(e,t,n,o){let i,a;!function(){const e=(e,t)=>!(Math.abs(e-t)<=V);return i=Math.ceil(void 0===n?Me[A]():n),a=Math.ceil(void 0===o?Ce[Q]():o),$&&e(C,i)||j&&e(Z,a)}()&&"init"!==e?!(e in{init:1,size:1})&&($&&A in f||j&&Q in f)&&Ne():(Ie(),C=i,Z=a,xe(C,Z,e))}function Te(e,t,n,o){document.hidden||Ae(e,0,n,o)}function Ie(){J||(J=!0,requestAnimationFrame((()=>{J=!1})))}function Pe(e){C=Me[A](),Z=Ce[Q](),xe(C,Z,e)}function Ne(e){const t=A;A=u,Ie(),Pe("reset"),A=t}function xe(e,t,n,o,i){R<0||(void 0!==i||(i=U),function(){const a=`${B}:${`${e+L}:${t+W}`}:${n}${void 0===o?"":`:${o}`}`;F?window.parent.iframeParentListener(d+a):D.postMessage(d+a,i)}())}function Re(e){const t={init:function(){I=e.data,D=e.source,ae(),O=!1,setTimeout((()=>{T=!1}),r)},reset(){T||Pe("resetPage")},resize(){Te("resizeParent")},moveToAnchor(){P.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();K?K(JSON.parse(e)):xe(0,0,"pageInfoStop")},parentInfo(){const e=o();_?_(Object.freeze(JSON.parse(e))):xe(0,0,"parentInfoStop")},message(){const e=o();X(JSON.parse(e))}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,a=()=>e.data.split(":")[2]in{true:1,false:1};d===`${e.data}`.slice(0,m)&&(!1!==O?a()&&t.init():function(){const o=n();o in t?t[o]():i()||a()||ne(`Unexpected message (${e.data})`)}())}function ke(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}function Be(e){return Re(e),Y}"undefined"!=typeof window&&(window.iframeChildListener=e=>Re({data:e,sameDomian:!0}),n(window,"message",Re),n(window,"readystatechange",ke),ke());try{top?.document?.getElementById("banner")&&(Y={},window.mockMsgListener=Be,o(window,"message",Re),define([],(()=>Be)))}catch(e){}
|
package/index.umd.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @preserve
|
|
3
3
|
*
|
|
4
|
-
* @module iframe-resizer/child 5.0.0-alpha.
|
|
4
|
+
* @module iframe-resizer/child 5.0.0-alpha.5 (umd) - 2024-04-17
|
|
5
5
|
*
|
|
6
6
|
* @license GPL-3.0 for non-commercial use only.
|
|
7
7
|
* For commercial use, you must purchase a license from
|
|
8
|
-
*
|
|
8
|
+
* http://iframe-resizer.com/pricing
|
|
9
9
|
*
|
|
10
10
|
* @desciption Keep same and cross domain iFrames sized to their content
|
|
11
11
|
*
|
|
12
12
|
* @author David J. Bradshaw <dave@bradshaw.net>
|
|
13
13
|
*
|
|
14
|
-
* @see {@link
|
|
14
|
+
* @see {@link http://iframe-resizer.com}
|
|
15
15
|
*
|
|
16
16
|
* @copyright (c) 2013 - 2024, David J. Bradshaw. All rights reserved.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";const e=10,t="data-iframe-size",n=(e,t,n,o)=>e.addEventListener(t,n,o||!1),o=(e,t,n)=>e.removeEventListener(t,n,!1),i={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},a={height:()=>(ee("Custom height calculation function not defined"),Se.auto()),width:()=>(ee("Custom width calculation function not defined"),Oe.auto())},r={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,documentElementBoundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},c=128,s={},d="checkVisibility"in window,l="auto",m="[iFrameSizer]",u=m.length,f={max:1,min:1,bodyScroll:1,documentElementScroll:1},h=["body"],g="scroll";let p=!0,w="",y=0,v="",b=null,$="",E=!0,S=!1,O=null,z=!0,M=!1,C=1,T=l,I=!0,P="",x={},N=!0,R=!1,A=!1,B="",L=0,k=0,H="child",F=null,q=!1,D=window.parent,U="*",W=0,V=!1,j=1,J=g,Q=window,X=()=>{ee("onMessage function not defined")},Y=()=>{},G=null,K=null;const Z=e=>""!=`${e}`&&void 0!==e;const _=(...e)=>[`${m}[${B}]`,...e].join(" "),ee=(...e)=>console?.warn(_(...e)),te=(...e)=>console?.warn(window.chrome?_(...e):_(...e).replaceAll(/\u001B\[[\d;]*m/gi,""));function ne(){!function(){try{q="iframeParentListener"in window.parent}catch(e){}}(),function(){const e=e=>"true"===e,t=P.slice(u).split(":");B=t[0],y=void 0===t[1]?y:Number(t[1]),S=void 0===t[2]?S:e(t[2]),R=void 0===t[3]?R:e(t[3]),p=void 0===t[6]?p:e(t[6]),v=t[7],T=void 0===t[8]?T:t[8],w=t[9],$=t[10],W=void 0===t[11]?W:Number(t[11]),x.enable=void 0!==t[12]&&e(t[12]),H=void 0===t[13]?H:t[13],J=void 0===t[14]?J:t[14],A=void 0===t[15]?A:e(t[15]),L=void 0===t[16]?L:Number(t[16]),k=void 0===t[17]?k:Number(t[17]),E=void 0===t[18]?E:e(t[18])}(),function(){function e(){const e=window.iFrameResizer;X=e?.onMessage||X,Y=e?.onReady||Y,L=e?.offsetHeight||L,k=e?.offsetWidth||k,U=e?.targetOrigin||U,T=e?.heightCalculationMethod||T,J=e?.widthCalculationMethod||J}function t(e,t){return"function"==typeof e&&(a[t]=e,e="custom"),e}"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),T=t(T,"height"),J=t(J,"width"))}(),function(){void 0===v&&(v=`${y}px`);oe("margin",function(e,t){t.includes("-")&&(ee(`Negative CSS value ignored for ${e}`),t="");return t}("margin",v))}(),oe("background",w),oe("padding",$),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)}(),se(),de(),function(){let e=!1;const n=n=>document.querySelectorAll(`[${n}]`).forEach((o=>{e=!0,o.removeAttribute(n),o.setAttribute(t,null)}));n("data-iframe-height"),n("data-iframe-width"),e&&te("\n[31;1mDeprecated Attributes[m\n \nThe [1mdata-iframe-height[m and [1mdata-iframe-width[m attributes have been deprecated and replaced with the single [1mdata-iframe-size[m attribute. Use of the old attributes will be removed in a future version of [3miframe-resizer[m.")}(),document.querySelectorAll(`[${t}]`).length>0&&("auto"===T&&(T="autoOverflow"),"auto"===J&&(J="autoOverflow")),re(),Q.parentIFrame={autoResize:e=>(!0===e&&!1===p?(p=!0,le()):!1===e&&!0===p&&(p=!1,ae("remove"),F?.disconnect(),b?.disconnect()),Pe(0,0,"autoResize",JSON.stringify(p)),p),close(){Pe(0,0,"close")},getId:()=>B,getPageInfo(e){if("function"==typeof e)return G=e,Pe(0,0,"pageInfo"),void te("\n[31;1mDeprecated Method (getPageInfo()[m\n \nThe [1mgetPageInfo()[m method has been deprecated and replaced with [1mgetParentInfo()[m. Use of this method will be removed in a future version of [3miframe-resizer[m.\n");G=null,Pe(0,0,"pageInfoStop")},getParentInfo(e){if("function"==typeof e)return K=e,void Pe(0,0,"parentInfo");K=null,Pe(0,0,"parentInfoStop")},moveToAnchor(e){x.findTarget(e)},reset(){Ie()},scrollTo(e,t){Pe(t,e,"scrollTo")},scrollToOffset(e,t){Pe(t,e,"scrollToOffset")},sendMessage(e,t){Pe(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){T=e,se()},setWidthCalculationMethod(e){J=e,de()},setTargetOrigin(e){U=e},size(e,t){Me("size",`parentIFrame.size(${e||""}${t?`,${t}`:""})`,e,t)}},function(){if(!0!==A)return;function e(e){Pe(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,o){n(window.document,t,e)}t("mouseenter"),t("mouseleave")}(),le(),x=function(){const t=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function o(n){const o=n.getBoundingClientRect(),i=t();return{x:parseInt(o.left,e)+parseInt(i.x,e),y:parseInt(o.top,e)+parseInt(i.y,e)}}function i(e){function t(e){const t=o(e);Pe(t.y,t.x,"scrollToOffset")}const n=e.split("#")[1]||e,i=decodeURIComponent(n),a=document.getElementById(i)||document.getElementsByName(i)[0];void 0===a?Pe(0,0,"inPageLink",`#${n}`):t(a)}function a(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&i(t)}function r(){function e(e){function t(e){e.preventDefault(),i(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&n(e,"click",t)}document.querySelectorAll('a[href^="#"]').forEach(e)}function s(){n(window,"hashchange",a)}function d(){setTimeout(a,c)}function l(){r(),s(),d()}x.enable&&l();return{findTarget:i}}(),Me("init","Init message from host page"),Y(),N=!1}function oe(e,t){void 0!==t&&""!==t&&"null"!==t&&document.body.style.setProperty(e,t)}function ie(e){({add(t){function o(){Me(e.eventName,e.eventType)}s[t]=o,n(window,t,o,{passive:!0})},remove(e){const t=s[e];delete s[e],o(window,e,t)}})[e.method](e.eventName)}function ae(e){ie({method:e,eventType:"After Print",eventName:"afterprint"}),ie({method:e,eventType:"Before Print",eventName:"beforeprint"}),ie({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}function re(){const e=document.querySelectorAll(`[${t}]`);M=e.length>0,O=M?e:ve(document)()}function ce(e,t,n,o){return t!==e&&(e in n||(ee(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in r&&te(`\n[31;1mDeprecated ${o}CalculationMethod (${e})[m\n\nThis version of [3miframe-resizer[m can auto detect the most suitable ${o} calculation method. It is recommended that you remove this option.`)),e}function se(){T=ce(T,l,Se,"height")}function de(){J=ce(J,g,Oe,"width")}function le(){!0===p&&(ae("add"),b=function(){function e(e){e.forEach(pe),re()}function t(){const t=new window.MutationObserver(e),n=document.querySelector("body"),o={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return t.observe(n,o),t}const n=t();return{disconnect(){n.disconnect()}}}(),F=new ResizeObserver(me),ge(window.document))}function me(e){Me("resizeObserver",`resizeObserver: ${function(e){switch(!0){case!Z(e):return"";case Z(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case Z(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(Z(e.className)?`.${e.className}`:"")}}(e[0].target)}`)}const ue=e=>{const t=getComputedStyle(e);return""!==t?.position&&"static"!==t?.position},fe=()=>[...ve(document)()].filter(ue);function he(e){e&&F.observe(e)}function ge(e){[...fe(),...h.flatMap((t=>e.querySelector(t)))].forEach(he)}function pe(e){"childList"===e.type&&ge(e.target)}function we(e){const t=(n=e).charAt(0).toUpperCase()+n.slice(1);var n;let o,a=0,r=O.length,c=0,s=performance.now();O.forEach((t=>{M||!d||t.checkVisibility(i)?(a=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),a>c&&(c=a,o=t)):r-=1})),s=performance.now()-s;const l=`\nParsed ${r} element${r=""} in ${s.toPrecision(3)}ms\n${t} ${M?"tagged ":""}element found at: ${c}px\nPosition calculated from HTML element: ${function(e){const t=e?.outerHTML?.toString();return t?t.length<30?t:`${t.slice(0,30).replaceAll("\n"," ")}...`:e}(o)}`;return s<1.1||N||M||te(`\n[31;1mPerformance Warning[m\n\nCalculateing the page size took an excessive amount of time. To improve performace add the [1mdata-iframe-size[m attribute to the ${e} element on the page.\n${l}`),c}const ye=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.documentElementBoundingClientRect()],ve=e=>()=>e.querySelectorAll("* :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)");const be={height:0,width:0},$e={height:0,width:0};function Ee(e,t){function n(){return $e[i]=a,be[i]=s,a}const o=e===Se,i=o?"height":"width",a=e.documentElementBoundingClientRect(),r=Math.ceil(a),c=Math.floor(a),s=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e);switch(!0){case!e.enabled():return s;case!t&&0===$e[i]&&0===be[i]:if(e.taggedElement(!0)<=r)return n();break;case V&&a===$e[i]&&s===be[i]:return Math.max(a,s);case 0===a:return s;case!t&&a!==$e[i]&&s<=be[i]:case!t&&a<$e[i]:case s===c||s===r:case a>s:return n();case!t:!function({ceilBoundingSize:e,dimension:t,isHeight:n,scrollSize:o}){const i=n?"bottom":"right";te(`\n[31;1mDetected content overflowing html element[m\n \nThis causes [3miframe-resizer[m to fall back to checking the position of every element on the page in order to calculate the correct dimensions of the iframe. Inspecting the size, ${i} margin, and position of every visable HTML element will have a performace impact on more complex pages. \n\nTo fix this issue, and remove this warning, you can either ensure the content of the page does not overflow the [1m<HTML>[m element or alternatively you can add the attribute [1mdata-iframe-size[m to the elements on the page that you want [3miframe-resizer[m to use when calculating the dimensions of the iframe. \n \nWhen present the [3m${i} margin of the ${n?"lowest":"right most"} element[m with a [1mdata-iframe-size[m attribute will be used to set the ${t} of the iframe.\n \n(Page size: ${o} > document size: ${e})`),n?T="autoOverflow":J="autoOverflow"}({ceilBoundingSize:r,dimension:i,isHeight:o,scrollSize:s})}return Math.max(e.taggedElement(),n())}const Se={enabled:()=>E,getOffset:()=>L,type:"height",auto:()=>Ee(Se,!1),autoOverflow:()=>Ee(Se,!0),bodyOffset:()=>{const{body:t}=document,n=getComputedStyle(t);return t.offsetHeight+parseInt(n.marginTop,e)+parseInt(n.marginBottom,e)},bodyScroll:()=>document.body.scrollHeight,offset:()=>Se.bodyOffset(),custom:()=>a.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().bottom,max:()=>Math.max(...ye(Se)),min:()=>Math.min(...ye(Se)),grow:()=>Se.max(),lowestElement:()=>we("bottom"),taggedElement:()=>we("bottom")},Oe={enabled:()=>S,getOffset:()=>k,type:"width",auto:()=>Ee(Oe,!1),autoOverflow:()=>Ee(Oe,!0),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>a.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().right,max:()=>Math.max(...ye(Oe)),min:()=>Math.min(...ye(Oe)),rightMostElement:()=>we("right"),scroll:()=>Math.max(Oe.bodyScroll(),Oe.documentElementScroll()),taggedElement:()=>we("right")};function ze(e,t,n,o){let i,a;!function(){const e=(e,t)=>!(Math.abs(e-t)<=W);return i=Math.ceil(void 0===n?Se[T]():n),a=Math.ceil(void 0===o?Oe[J]():o),E&&e(C,i)||S&&e(j,a)}()&&"init"!==e?!(e in{init:1,size:1})&&(E&&T in f||S&&J in f)&&Ie():(Ce(),C=i,j=a,Pe(C,j,e))}function Me(e,t,n,o){document.hidden||ze(e,0,n,o)}function Ce(){V||(V=!0,requestAnimationFrame((()=>{V=!1})))}function Te(e){C=Se[T](),j=Oe[J](),Pe(C,j,e)}function Ie(e){const t=T;T=l,Ce(),Te("reset"),T=t}function Pe(e,t,n,o,i){void 0!==i||(i=U),function(){const a=`${B}:${`${e+L}:${t+k}`}:${n}${void 0===o?"":`:${o}`}`;q?window.parent.iframeParentListener(m+a):D.postMessage(m+a,i)}()}function xe(e){const t={init:function(){P=e.data,D=e.source,ne(),z=!1,setTimeout((()=>{I=!1}),c)},reset(){I||Te("resetPage")},resize(){Me("resizeParent")},moveToAnchor(){x.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();G?G(JSON.parse(e)):Pe(0,0,"pageInfoStop")},parentInfo(){const e=o();K?K(Object.freeze(JSON.parse(e))):Pe(0,0,"parentInfoStop")},message(){const e=o();X(JSON.parse(e))}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,a=()=>e.data.split(":")[2]in{true:1,false:1};m===`${e.data}`.slice(0,u)&&(!1!==z?a()&&t.init():function(){const o=n();o in t?t[o]():i()||a()||ee(`Unexpected message (${e.data})`)}())}function Ne(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}function Re(e){return xe(e),Q}"undefined"!=typeof window&&(window.iframeChildListener=e=>xe({data:e,sameDomian:!0}),n(window,"message",xe),n(window,"readystatechange",Ne),Ne());try{top?.document?.getElementById("banner")&&(Q={},window.mockMsgListener=Re,o(window,"message",xe),define([],(()=>Re)))}catch(e){}}));
|
|
20
|
+
!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";const e=10,t="data-iframe-size",n=(e,t,n,o)=>e.addEventListener(t,n,o||!1),o=(e,t,n)=>e.removeEventListener(t,n,!1),i={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},a={height:()=>(ne("Custom height calculation function not defined"),Me.auto()),width:()=>(ne("Custom width calculation function not defined"),Ce.auto())},l={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,documentElementBoundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},r=128,c={},s="checkVisibility"in window,u="auto",d="[iFrameSizer]",m=d.length,f={max:1,min:1,bodyScroll:1,documentElementScroll:1},h=["body"],p="scroll";let y,g=!0,v="",b=0,w="",z=null,S="",$=!0,j=!1,E=null,O=!0,M=!1,C=1,A=u,T=!0,I="",P={},N=!0,x=!1,R=0,k=!1,B="",L=0,W=0,H="child",q=null,F=!1,D=window.parent,U="*",V=0,J=!1,Z=1,Q=p,Y=window,X=()=>{ne("onMessage function not defined")},G=()=>{},K=null,_=null;const ee=e=>""!=`${e}`&&void 0!==e;const te=(...e)=>[`${d}[${B}]`,...e].join(" "),ne=(...e)=>console?.warn(te(...e)),oe=(...e)=>console?.warn(((...e)=>window.chrome?te(...e).replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m"):te(...e).replaceAll(/\u001B\[[\d;]*m/gi,""))(...e)),ie=e=>oe(e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))));function ae(){!function(){try{F="iframeParentListener"in window.parent}catch(e){}}(),function(){const e=e=>"true"===e,t=I.slice(m).split(":");B=t[0],b=void 0===t[1]?b:Number(t[1]),j=void 0===t[2]?j:e(t[2]),x=void 0===t[3]?x:e(t[3]),g=void 0===t[6]?g:e(t[6]),w=t[7],A=void 0===t[8]?A:t[8],v=t[9],S=t[10],V=void 0===t[11]?V:Number(t[11]),P.enable=void 0!==t[12]&&e(t[12]),H=void 0===t[13]?H:t[13],Q=void 0===t[14]?Q:t[14],k=void 0===t[15]?k:e(t[15]),L=void 0===t[16]?L:Number(t[16]),W=void 0===t[17]?W:Number(t[17]),$=void 0===t[18]?$:e(t[18]),y=t[19]}(),function(){function e(){const e=window.iFrameResizer;X=e?.onMessage||X,G=e?.onReady||G,L=e?.offsetHeight||L,W=e?.offsetWidth||W,U=e?.targetOrigin||U,A=e?.heightCalculationMethod||A,Q=e?.widthCalculationMethod||Q}function t(e,t){return"function"==typeof e&&(a[t]=e,e="custom"),e}"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),A=t(A,"height"),Q=t(Q,"width"))}(),R=["1jqr0si6pnt","1p37k9w4kov"].indexOf(y),-1===R&&""!==y&&(R=-2),function(){void 0===w&&(w=`${b}px`);le("margin",function(e,t){t.includes("-")&&(ne(`Negative CSS value ignored for ${e}`),t="");return t}("margin",w))}(),le("background",v),le("padding",S),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)}(),R<0?ie(`${fe[R+2]}${fe[2]}`):R<2&&ie(fe[3]),de(),me(),function(){let e=!1;const n=n=>document.querySelectorAll(`[${n}]`).forEach((o=>{e=!0,o.removeAttribute(n),o.setAttribute(t,null)}));n("data-iframe-height"),n("data-iframe-width"),e&&oe("\n<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</>.")}(),document.querySelectorAll(`[${t}]`).length>0&&("auto"===A&&(A="autoOverflow"),"auto"===Q&&(Q="autoOverflow")),se(),Y.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===g?(g=!0,he()):!1===e&&!0===g&&(g=!1,ce("remove"),q?.disconnect(),z?.disconnect()),xe(0,0,"autoResize",JSON.stringify(g)),g),close(){xe(0,0,"close")},getId:()=>B,getPageInfo(e){if("function"==typeof e)return K=e,xe(0,0,"pageInfo"),void oe("\n<rb>Deprecated Method (getPageInfo()</>\n \nThe <b>getPageInfo()</> method has been deprecated and replaced with <b>getParentInfo()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n");K=null,xe(0,0,"pageInfoStop")},getParentInfo(e){if("function"==typeof e)return _=e,void xe(0,0,"parentInfo");_=null,xe(0,0,"parentInfoStop")},moveToAnchor(e){P.findTarget(e)},reset(){Ne()},scrollTo(e,t){xe(t,e,"scrollTo")},scrollToOffset(e,t){xe(t,e,"scrollToOffset")},sendMessage(e,t){xe(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){A=e,de()},setWidthCalculationMethod(e){Q=e,me()},setTargetOrigin(e){U=e},size(e,t){Te("size",`parentIFrame.size(${e||""}${t?`,${t}`:""})`,e,t)}}),Y.parentIFrame=Y.parentIframe,function(){if(!0!==k)return;function e(e){xe(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,o){n(window.document,t,e)}t("mouseenter"),t("mouseleave")}(),he(),P=function(){const t=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function o(n){const o=n.getBoundingClientRect(),i=t();return{x:parseInt(o.left,e)+parseInt(i.x,e),y:parseInt(o.top,e)+parseInt(i.y,e)}}function i(e){function t(e){const t=o(e);xe(t.y,t.x,"scrollToOffset")}const n=e.split("#")[1]||e,i=decodeURIComponent(n),a=document.getElementById(i)||document.getElementsByName(i)[0];void 0===a?xe(0,0,"inPageLink",`#${n}`):t(a)}function a(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&i(t)}function l(){function e(e){function t(e){e.preventDefault(),i(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&n(e,"click",t)}document.querySelectorAll('a[href^="#"]').forEach(e)}function c(){n(window,"hashchange",a)}function s(){setTimeout(a,r)}function u(){l(),c(),s()}P.enable&&u();return{findTarget:i}}(),Te("init","Init message from host page"),G(),N=!1}function le(e,t){void 0!==t&&""!==t&&"null"!==t&&document.body.style.setProperty(e,t)}function re(e){({add(t){function o(){Te(e.eventName,e.eventType)}c[t]=o,n(window,t,o,{passive:!0})},remove(e){const t=c[e];delete c[e],o(window,e,t)}})[e.method](e.eventName)}function ce(e){re({method:e,eventType:"After Print",eventName:"afterprint"}),re({method:e,eventType:"Before Print",eventName:"beforeprint"}),re({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}function se(){const e=document.querySelectorAll(`[${t}]`);M=e.length>0,E=M?e:$e(document)()}function ue(e,t,n,o){return t!==e&&(e in n||(ne(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in l&&oe(`\n<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.`)),e}function de(){A=ue(A,u,Me,"height")}function me(){Q=ue(Q,p,Ce,"width")}const fe=["<iy><yi>Puchspk Spjluzl Rlf</><iy><iy>","<iy><yi>Tpzzpun Spjluzl Rlf</><iy><iy>","Aopz spiyhyf pz hchpshisl dpao ivao Jvttlyjphs huk Vwlu-Zvbylz spjluzlz.<iy><iy><i>Jvttlyjphs Spjluzl</><iy>Mvy jvttlyjphs bzl, <p>pmyhtl-ylzpgly</> ylxbpylz h svd jvza vul aptul spjluzl mll. Mvy tvyl pumvythapvu cpzpa <b>oaaw://pmyhtl-ylzpgly.jvt/wypjpun</>.<iy><iy><i>Vwlu Zvbyjl Spjluzl</><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-jvtlyjphs vwlu zvbyjl wyvqlja, fvb jhu bzl pa mvy myll bukly aol alytz vm aol NWS C3 Spjluzl. Av jvumpyt fvb hjjlwa aolzl alytz, wslhzl zla aol <i>spjlujl</> rlf pu pmyhtlYlzpgl vwapvuz av <i>'NWS-C3'</>.<iy><iy>Mvy tvyl pumvythapvu vu aol Nub Wbispj Spjluzl <iy><b>oaaw://pmyhtl-ylzpgly.jvt/vwlu-zvbyjl-spjluzl</>","<i>NWS-C3 Spjluzl Clyzpvu</><iy><iy>Aopz clyzpvu vm <p>pmyhtl-ylzpgly</> pz ilpun bzlk bukly aol alytz vm aol <i>NWS C3</> spjluzl. Pm fvb hyl bzpun aopz spiyhyf pu h jvttlyjphs wyvqlja, fvb dpss ullk av wbyjohzl h svd jvza vul aptl spjluzl. Mvy tvyl pumvythapvu cpzpa <b>oaaw://pmyhtl-ylzpgly.jvt/wypjpun</>."];function he(){!0===g&&(ce("add"),z=function(){function e(e){e.forEach(we),se()}function t(){const t=new window.MutationObserver(e),n=document.querySelector("body"),o={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return t.observe(n,o),t}const n=t();return{disconnect(){n.disconnect()}}}(),q=new ResizeObserver(pe),be(window.document))}function pe(e){Te("resizeObserver",`resizeObserver: ${function(e){switch(!0){case!ee(e):return"";case ee(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case ee(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(ee(e.className)?`.${e.className}`:"")}}(e[0].target)}`)}const ye=e=>{const t=getComputedStyle(e);return""!==t?.position&&"static"!==t?.position},ge=()=>[...$e(document)()].filter(ye);function ve(e){e&&q.observe(e)}function be(e){[...ge(),...h.flatMap((t=>e.querySelector(t)))].forEach(ve)}function we(e){"childList"===e.type&&be(e.target)}function ze(e){const t=(n=e).charAt(0).toUpperCase()+n.slice(1);var n;let o,a=0,l=E.length,r=0,c=performance.now();E.forEach((t=>{M||!s||t.checkVisibility(i)?(a=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),a>r&&(r=a,o=t)):l-=1})),c=performance.now()-c;const u=`\nParsed ${l} element${l=""} in ${c.toPrecision(3)}ms\n${t} ${M?"tagged ":""}element found at: ${r}px\nPosition calculated from HTML element: ${function(e){const t=e?.outerHTML?.toString();return t?t.length<30?t:`${t.slice(0,30).replaceAll("\n"," ")}...`:e}(o)}`;return c<1.1||N||M||oe(`\n<rb>Performance Warning</>\n\nCalculateing the page size took an excessive amount of time. To improve performace add the <b>data-iframe-size</> attribute to the ${e} element on the page.\n${u}`),r}const Se=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.documentElementBoundingClientRect()],$e=e=>()=>e.querySelectorAll("* :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)");const je={height:0,width:0},Ee={height:0,width:0};function Oe(e,t){function n(){return Ee[i]=a,je[i]=c,a}const o=e===Me,i=o?"height":"width",a=e.documentElementBoundingClientRect(),l=Math.ceil(a),r=Math.floor(a),c=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e);switch(!0){case!e.enabled():return c;case!t&&0===Ee[i]&&0===je[i]:if(e.taggedElement(!0)<=l)return n();break;case J&&a===Ee[i]&&c===je[i]:return Math.max(a,c);case 0===a:return c;case!t&&a!==Ee[i]&&c<=je[i]:case!t&&a<Ee[i]:case c===r||c===l:case a>c:return n();case!t:!function({ceilBoundingSize:e,dimension:t,isHeight:n,scrollSize:o}){const i=n?"bottom":"right";oe(`\n<rb>Detected content overflowing html element</>\n \nThis causes <i>iframe-resizer</> to fall back to checking the position of every element on the page in order to calculate the correct dimensions of the iframe. Inspecting the size, ${i} margin, and position of every visable HTML element will have a performace impact on more complex pages. \n\nTo fix this issue, and remove this warning, you can either ensure the content of the page does not overflow the <b><HTML></> element or alternatively you can add the attribute <b>data-iframe-size</> to the elements on the page that you want <i>iframe-resizer</> to use when calculating the dimensions of the iframe. \n \nWhen present the <i>${i} margin of the ${n?"lowest":"right most"} element</> with a <b>data-iframe-size</> attribute will be used to set the ${t} of the iframe.\n \n(Page size: ${o} > document size: ${e})`),n?A="autoOverflow":Q="autoOverflow"}({ceilBoundingSize:l,dimension:i,isHeight:o,scrollSize:c})}return Math.max(e.taggedElement(),n())}const Me={enabled:()=>$,getOffset:()=>L,type:"height",auto:()=>Oe(Me,!1),autoOverflow:()=>Oe(Me,!0),bodyOffset:()=>{const{body:t}=document,n=getComputedStyle(t);return t.offsetHeight+parseInt(n.marginTop,e)+parseInt(n.marginBottom,e)},bodyScroll:()=>document.body.scrollHeight,offset:()=>Me.bodyOffset(),custom:()=>a.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().bottom,max:()=>Math.max(...Se(Me)),min:()=>Math.min(...Se(Me)),grow:()=>Me.max(),lowestElement:()=>ze("bottom"),taggedElement:()=>ze("bottom")},Ce={enabled:()=>j,getOffset:()=>W,type:"width",auto:()=>Oe(Ce,!1),autoOverflow:()=>Oe(Ce,!0),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>a.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().right,max:()=>Math.max(...Se(Ce)),min:()=>Math.min(...Se(Ce)),rightMostElement:()=>ze("right"),scroll:()=>Math.max(Ce.bodyScroll(),Ce.documentElementScroll()),taggedElement:()=>ze("right")};function Ae(e,t,n,o){let i,a;!function(){const e=(e,t)=>!(Math.abs(e-t)<=V);return i=Math.ceil(void 0===n?Me[A]():n),a=Math.ceil(void 0===o?Ce[Q]():o),$&&e(C,i)||j&&e(Z,a)}()&&"init"!==e?!(e in{init:1,size:1})&&($&&A in f||j&&Q in f)&&Ne():(Ie(),C=i,Z=a,xe(C,Z,e))}function Te(e,t,n,o){document.hidden||Ae(e,0,n,o)}function Ie(){J||(J=!0,requestAnimationFrame((()=>{J=!1})))}function Pe(e){C=Me[A](),Z=Ce[Q](),xe(C,Z,e)}function Ne(e){const t=A;A=u,Ie(),Pe("reset"),A=t}function xe(e,t,n,o,i){R<0||(void 0!==i||(i=U),function(){const a=`${B}:${`${e+L}:${t+W}`}:${n}${void 0===o?"":`:${o}`}`;F?window.parent.iframeParentListener(d+a):D.postMessage(d+a,i)}())}function Re(e){const t={init:function(){I=e.data,D=e.source,ae(),O=!1,setTimeout((()=>{T=!1}),r)},reset(){T||Pe("resetPage")},resize(){Te("resizeParent")},moveToAnchor(){P.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();K?K(JSON.parse(e)):xe(0,0,"pageInfoStop")},parentInfo(){const e=o();_?_(Object.freeze(JSON.parse(e))):xe(0,0,"parentInfoStop")},message(){const e=o();X(JSON.parse(e))}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,a=()=>e.data.split(":")[2]in{true:1,false:1};d===`${e.data}`.slice(0,m)&&(!1!==O?a()&&t.init():function(){const o=n();o in t?t[o]():i()||a()||ne(`Unexpected message (${e.data})`)}())}function ke(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}function Be(e){return Re(e),Y}"undefined"!=typeof window&&(window.iframeChildListener=e=>Re({data:e,sameDomian:!0}),n(window,"message",Re),n(window,"readystatechange",ke),ke());try{top?.document?.getElementById("banner")&&(Y={},window.mockMsgListener=Be,o(window,"message",Re),define([],(()=>Be)))}catch(e){}}));
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iframe-resizer/child",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.5",
|
|
4
4
|
"license": "GPL-3.0",
|
|
5
|
-
"homepage": "
|
|
5
|
+
"homepage": "http://iframe-resizer.com",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "David J. Bradshaw",
|
|
8
8
|
"email": "dave@bradshaw.net"
|