@iframe-resizer/child 5.0.0-alpha.4 → 5.0.0-alpha.6
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.6 2024-04-17 - 13:42:58.287Z_
|
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.6 (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:()=>(ie("Custom height calculation function not defined"),Ae.auto()),width:()=>(ie("Custom width calculation function not defined"),Te.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,v=!0,b="",w=0,z="",S=null,$="",j=!0,E=!1,O=null,M=!0,C=!1,A=1,T=u,I=!0,P="",N={},x=!0,R=!1,k=0,B=!1,L=!1,W="",H=0,q=0,F="child",V=null,D=!1,U=window.parent,J="*",Z=0,Q=!1,Y=1,G=p,X=window,K=()=>{ie("onMessage function not defined")},_=()=>{},ee=null,te=null;const ne=e=>""!=`${e}`&&void 0!==e;const oe=(...e)=>[`${d}[${W}]`,...e].join(" "),ie=(...e)=>console?.warn(oe(...e)),ae=(...e)=>console?.warn(((...e)=>window.chrome?oe(...e).replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m"):oe(...e).replaceAll(/\u001B\[[\d;]*m/gi,""))(...e)),le=e=>ae(e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))));function re(){!function(){try{D="iframeParentListener"in window.parent}catch(e){}}(),function(){const e=e=>"true"===e,t=P.slice(m).split(":");W=t[0],w=void 0===t[1]?w:Number(t[1]),E=void 0===t[2]?E:e(t[2]),R=void 0===t[3]?R:e(t[3]),v=void 0===t[6]?v:e(t[6]),z=t[7],T=void 0===t[8]?T:t[8],b=t[9],$=t[10],Z=void 0===t[11]?Z:Number(t[11]),N.enable=void 0!==t[12]&&e(t[12]),F=void 0===t[13]?F:t[13],G=void 0===t[14]?G:t[14],L=void 0===t[15]?L:e(t[15]),H=void 0===t[16]?H:Number(t[16]),q=void 0===t[17]?q:Number(t[17]),j=void 0===t[18]?j:e(t[18]),y=t[19],g=t[20],B=void 0===t[21]?B:e(t[21])}(),function(){function e(){const e=window.iFrameResizer;K=e?.onMessage||K,_=e?.onReady||_,H=e?.offsetHeight||H,q=e?.offsetWidth||q,J=e?.targetOrigin||J,T=e?.heightCalculationMethod||T,G=e?.widthCalculationMethod||G}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"),G=t(G,"width"))}(),function(){k=["1jqr0si6pnt","GPL-V3","bar"].indexOf(y),-1===k&&""!==y&&(k=-2);!B&&g||(k=9)}(),function(){void 0===z&&(z=`${w}px`);ce("margin",function(e,t){t.includes("-")&&(ie(`Negative CSS value ignored for ${e}`),t="");return t}("margin",z))}(),ce("background",b),ce("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)}(),k<0?le(`${pe[k+2]}${pe[2]}`):k<2&&le(pe[3]),fe(),he(),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&&ae("\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"===T&&(T="autoOverflow"),"auto"===G&&(G="autoOverflow")),de(),X.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===v?(v=!0,ye()):!1===e&&!0===v&&(v=!1,ue("remove"),V?.disconnect(),S?.disconnect()),ke(0,0,"autoResize",JSON.stringify(v)),v),close(){ke(0,0,"close")},getId:()=>W,getPageInfo(e){if("function"==typeof e)return ee=e,ke(0,0,"pageInfo"),void ae("\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");ee=null,ke(0,0,"pageInfoStop")},getParentInfo(e){if("function"==typeof e)return te=e,void ke(0,0,"parentInfo");te=null,ke(0,0,"parentInfoStop")},moveToAnchor(e){N.findTarget(e)},reset(){Re()},scrollTo(e,t){ke(t,e,"scrollTo")},scrollToOffset(e,t){ke(t,e,"scrollToOffset")},sendMessage(e,t){ke(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){T=e,fe()},setWidthCalculationMethod(e){G=e,he()},setTargetOrigin(e){J=e},size(e,t){Pe("size",`parentIFrame.size(${e||""}${t?`,${t}`:""})`,e,t)}}),X.parentIFrame=X.parentIframe,function(){if(!0!==L)return;function e(e){ke(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,o){n(window.document,t,e)}t("mouseenter"),t("mouseleave")}(),ye(),N=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);ke(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?ke(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()}N.enable&&u();return{findTarget:i}}(),Pe("init","Init message from host page"),_(),x=!1}function ce(e,t){void 0!==t&&""!==t&&"null"!==t&&document.body.style.setProperty(e,t)}function se(e){({add(t){function o(){Pe(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 ue(e){se({method:e,eventType:"After Print",eventName:"afterprint"}),se({method:e,eventType:"Before Print",eventName:"beforeprint"}),se({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}function de(){const e=document.querySelectorAll(`[${t}]`);C=e.length>0,O=C?e:Ee(document)()}function me(e,t,n,o){return t!==e&&(e in n||(ie(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in l&&ae(`\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 fe(){T=me(T,u,Ae,"height")}function he(){G=me(G,p,Te,"width")}const pe=["<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 ye(){!0===v&&(ue("add"),S=function(){function e(e){e.forEach(Se),de()}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()}}}(),V=new ResizeObserver(ge),ze(window.document))}function ge(e){Pe("resizeObserver",`resizeObserver: ${function(e){switch(!0){case!ne(e):return"";case ne(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case ne(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(ne(e.className)?`.${e.className}`:"")}}(e[0].target)}`)}const ve=e=>{const t=getComputedStyle(e);return""!==t?.position&&"static"!==t?.position},be=()=>[...Ee(document)()].filter(ve);function we(e){e&&V.observe(e)}function ze(e){[...be(),...h.flatMap((t=>e.querySelector(t)))].forEach(we)}function Se(e){"childList"===e.type&&ze(e.target)}function $e(e){const t=(n=e).charAt(0).toUpperCase()+n.slice(1);var n;let o,a=0,l=O.length,r=0,c=performance.now();O.forEach((t=>{C||!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} ${C?"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||x||C||ae(`\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 je=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.documentElementBoundingClientRect()],Ee=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 Oe={height:0,width:0},Me={height:0,width:0};function Ce(e,t){function n(){return Me[i]=a,Oe[i]=c,a}const o=e===Ae,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===Me[i]&&0===Oe[i]:if(e.taggedElement(!0)<=l)return n();break;case Q&&a===Me[i]&&c===Oe[i]:return Math.max(a,c);case 0===a:return c;case!t&&a!==Me[i]&&c<=Oe[i]:case!t&&a<Me[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";ae(`\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?T="autoOverflow":G="autoOverflow"}({ceilBoundingSize:l,dimension:i,isHeight:o,scrollSize:c})}return Math.max(e.taggedElement(),n())}const Ae={enabled:()=>j,getOffset:()=>H,type:"height",auto:()=>Ce(Ae,!1),autoOverflow:()=>Ce(Ae,!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:()=>Ae.bodyOffset(),custom:()=>a.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().bottom,max:()=>Math.max(...je(Ae)),min:()=>Math.min(...je(Ae)),grow:()=>Ae.max(),lowestElement:()=>$e("bottom"),taggedElement:()=>$e("bottom")},Te={enabled:()=>E,getOffset:()=>q,type:"width",auto:()=>Ce(Te,!1),autoOverflow:()=>Ce(Te,!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(...je(Te)),min:()=>Math.min(...je(Te)),rightMostElement:()=>$e("right"),scroll:()=>Math.max(Te.bodyScroll(),Te.documentElementScroll()),taggedElement:()=>$e("right")};function Ie(e,t,n,o){let i,a;!function(){const e=(e,t)=>!(Math.abs(e-t)<=Z);return i=Math.ceil(void 0===n?Ae[T]():n),a=Math.ceil(void 0===o?Te[G]():o),j&&e(A,i)||E&&e(Y,a)}()&&"init"!==e?!(e in{init:1,size:1})&&(j&&T in f||E&&G in f)&&Re():(Ne(),A=i,Y=a,ke(A,Y,e))}function Pe(e,t,n,o){document.hidden||Ie(e,0,n,o)}function Ne(){Q||(Q=!0,requestAnimationFrame((()=>{Q=!1})))}function xe(e){A=Ae[T](),Y=Te[G](),ke(A,Y,e)}function Re(e){const t=T;T=u,Ne(),xe("reset"),T=t}function ke(e,t,n,o,i){k<0||(void 0!==i||(i=J),function(){const a=`${W}:${`${e+H}:${t+q}`}:${n}${void 0===o?"":`:${o}`}`;D?window.parent.iframeParentListener(d+a):U.postMessage(d+a,i)}())}function Be(e){const t={init:function(){P=e.data,U=e.source,re(),M=!1,setTimeout((()=>{I=!1}),r)},reset(){I||xe("resetPage")},resize(){Pe("resizeParent")},moveToAnchor(){N.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();ee?ee(JSON.parse(e)):ke(0,0,"pageInfoStop")},parentInfo(){const e=o();te?te(Object.freeze(JSON.parse(e))):ke(0,0,"parentInfoStop")},message(){const e=o();K(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!==M?a()&&t.init():function(){const o=n();o in t?t[o]():i()||a()||ie(`Unexpected message (${e.data})`)}())}function Le(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}function We(e){return Be(e),X}"undefined"!=typeof window&&(window.iframeChildListener=e=>Be({data:e,sameDomian:!0}),n(window,"message",Be),n(window,"readystatechange",Le),Le());try{top?.document?.getElementById("banner")&&(X={},window.mockMsgListener=We,o(window,"message",Be),define([],(()=>We)))}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.6 (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:()=>(ie("Custom height calculation function not defined"),Ae.auto()),width:()=>(ie("Custom width calculation function not defined"),Te.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,v=!0,b="",w=0,z="",S=null,$="",j=!0,E=!1,O=null,M=!0,C=!1,A=1,T=u,I=!0,P="",N={},x=!0,R=!1,k=0,B=!1,L=!1,W="",H=0,q=0,F="child",V=null,D=!1,U=window.parent,J="*",Z=0,Q=!1,Y=1,G=p,X=window,K=()=>{ie("onMessage function not defined")},_=()=>{},ee=null,te=null;const ne=e=>""!=`${e}`&&void 0!==e;const oe=(...e)=>[`${d}[${W}]`,...e].join(" "),ie=(...e)=>console?.warn(oe(...e)),ae=(...e)=>console?.warn(((...e)=>window.chrome?oe(...e).replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m"):oe(...e).replaceAll(/\u001B\[[\d;]*m/gi,""))(...e)),le=e=>ae(e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))));function re(){!function(){try{D="iframeParentListener"in window.parent}catch(e){}}(),function(){const e=e=>"true"===e,t=P.slice(m).split(":");W=t[0],w=void 0===t[1]?w:Number(t[1]),E=void 0===t[2]?E:e(t[2]),R=void 0===t[3]?R:e(t[3]),v=void 0===t[6]?v:e(t[6]),z=t[7],T=void 0===t[8]?T:t[8],b=t[9],$=t[10],Z=void 0===t[11]?Z:Number(t[11]),N.enable=void 0!==t[12]&&e(t[12]),F=void 0===t[13]?F:t[13],G=void 0===t[14]?G:t[14],L=void 0===t[15]?L:e(t[15]),H=void 0===t[16]?H:Number(t[16]),q=void 0===t[17]?q:Number(t[17]),j=void 0===t[18]?j:e(t[18]),y=t[19],g=t[20],B=void 0===t[21]?B:e(t[21])}(),function(){function e(){const e=window.iFrameResizer;K=e?.onMessage||K,_=e?.onReady||_,H=e?.offsetHeight||H,q=e?.offsetWidth||q,J=e?.targetOrigin||J,T=e?.heightCalculationMethod||T,G=e?.widthCalculationMethod||G}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"),G=t(G,"width"))}(),function(){k=["1jqr0si6pnt","GPL-V3","bar"].indexOf(y),-1===k&&""!==y&&(k=-2);!B&&g||(k=9)}(),function(){void 0===z&&(z=`${w}px`);ce("margin",function(e,t){t.includes("-")&&(ie(`Negative CSS value ignored for ${e}`),t="");return t}("margin",z))}(),ce("background",b),ce("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)}(),k<0?le(`${pe[k+2]}${pe[2]}`):k<2&&le(pe[3]),fe(),he(),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&&ae("\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"===T&&(T="autoOverflow"),"auto"===G&&(G="autoOverflow")),de(),X.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===v?(v=!0,ye()):!1===e&&!0===v&&(v=!1,ue("remove"),V?.disconnect(),S?.disconnect()),ke(0,0,"autoResize",JSON.stringify(v)),v),close(){ke(0,0,"close")},getId:()=>W,getPageInfo(e){if("function"==typeof e)return ee=e,ke(0,0,"pageInfo"),void ae("\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");ee=null,ke(0,0,"pageInfoStop")},getParentInfo(e){if("function"==typeof e)return te=e,void ke(0,0,"parentInfo");te=null,ke(0,0,"parentInfoStop")},moveToAnchor(e){N.findTarget(e)},reset(){Re()},scrollTo(e,t){ke(t,e,"scrollTo")},scrollToOffset(e,t){ke(t,e,"scrollToOffset")},sendMessage(e,t){ke(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){T=e,fe()},setWidthCalculationMethod(e){G=e,he()},setTargetOrigin(e){J=e},size(e,t){Pe("size",`parentIFrame.size(${e||""}${t?`,${t}`:""})`,e,t)}}),X.parentIFrame=X.parentIframe,function(){if(!0!==L)return;function e(e){ke(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,o){n(window.document,t,e)}t("mouseenter"),t("mouseleave")}(),ye(),N=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);ke(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?ke(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()}N.enable&&u();return{findTarget:i}}(),Pe("init","Init message from host page"),_(),x=!1}function ce(e,t){void 0!==t&&""!==t&&"null"!==t&&document.body.style.setProperty(e,t)}function se(e){({add(t){function o(){Pe(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 ue(e){se({method:e,eventType:"After Print",eventName:"afterprint"}),se({method:e,eventType:"Before Print",eventName:"beforeprint"}),se({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}function de(){const e=document.querySelectorAll(`[${t}]`);C=e.length>0,O=C?e:Ee(document)()}function me(e,t,n,o){return t!==e&&(e in n||(ie(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in l&&ae(`\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 fe(){T=me(T,u,Ae,"height")}function he(){G=me(G,p,Te,"width")}const pe=["<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 ye(){!0===v&&(ue("add"),S=function(){function e(e){e.forEach(Se),de()}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()}}}(),V=new ResizeObserver(ge),ze(window.document))}function ge(e){Pe("resizeObserver",`resizeObserver: ${function(e){switch(!0){case!ne(e):return"";case ne(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case ne(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(ne(e.className)?`.${e.className}`:"")}}(e[0].target)}`)}const ve=e=>{const t=getComputedStyle(e);return""!==t?.position&&"static"!==t?.position},be=()=>[...Ee(document)()].filter(ve);function we(e){e&&V.observe(e)}function ze(e){[...be(),...h.flatMap((t=>e.querySelector(t)))].forEach(we)}function Se(e){"childList"===e.type&&ze(e.target)}function $e(e){const t=(n=e).charAt(0).toUpperCase()+n.slice(1);var n;let o,a=0,l=O.length,r=0,c=performance.now();O.forEach((t=>{C||!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} ${C?"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||x||C||ae(`\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 je=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.documentElementBoundingClientRect()],Ee=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 Oe={height:0,width:0},Me={height:0,width:0};function Ce(e,t){function n(){return Me[i]=a,Oe[i]=c,a}const o=e===Ae,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===Me[i]&&0===Oe[i]:if(e.taggedElement(!0)<=l)return n();break;case Q&&a===Me[i]&&c===Oe[i]:return Math.max(a,c);case 0===a:return c;case!t&&a!==Me[i]&&c<=Oe[i]:case!t&&a<Me[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";ae(`\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?T="autoOverflow":G="autoOverflow"}({ceilBoundingSize:l,dimension:i,isHeight:o,scrollSize:c})}return Math.max(e.taggedElement(),n())}const Ae={enabled:()=>j,getOffset:()=>H,type:"height",auto:()=>Ce(Ae,!1),autoOverflow:()=>Ce(Ae,!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:()=>Ae.bodyOffset(),custom:()=>a.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().bottom,max:()=>Math.max(...je(Ae)),min:()=>Math.min(...je(Ae)),grow:()=>Ae.max(),lowestElement:()=>$e("bottom"),taggedElement:()=>$e("bottom")},Te={enabled:()=>E,getOffset:()=>q,type:"width",auto:()=>Ce(Te,!1),autoOverflow:()=>Ce(Te,!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(...je(Te)),min:()=>Math.min(...je(Te)),rightMostElement:()=>$e("right"),scroll:()=>Math.max(Te.bodyScroll(),Te.documentElementScroll()),taggedElement:()=>$e("right")};function Ie(e,t,n,o){let i,a;!function(){const e=(e,t)=>!(Math.abs(e-t)<=Z);return i=Math.ceil(void 0===n?Ae[T]():n),a=Math.ceil(void 0===o?Te[G]():o),j&&e(A,i)||E&&e(Y,a)}()&&"init"!==e?!(e in{init:1,size:1})&&(j&&T in f||E&&G in f)&&Re():(Ne(),A=i,Y=a,ke(A,Y,e))}function Pe(e,t,n,o){document.hidden||Ie(e,0,n,o)}function Ne(){Q||(Q=!0,requestAnimationFrame((()=>{Q=!1})))}function xe(e){A=Ae[T](),Y=Te[G](),ke(A,Y,e)}function Re(e){const t=T;T=u,Ne(),xe("reset"),T=t}function ke(e,t,n,o,i){k<0||(void 0!==i||(i=J),function(){const a=`${W}:${`${e+H}:${t+q}`}:${n}${void 0===o?"":`:${o}`}`;D?window.parent.iframeParentListener(d+a):U.postMessage(d+a,i)}())}function Be(e){const t={init:function(){P=e.data,U=e.source,re(),M=!1,setTimeout((()=>{I=!1}),r)},reset(){I||xe("resetPage")},resize(){Pe("resizeParent")},moveToAnchor(){N.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();ee?ee(JSON.parse(e)):ke(0,0,"pageInfoStop")},parentInfo(){const e=o();te?te(Object.freeze(JSON.parse(e))):ke(0,0,"parentInfoStop")},message(){const e=o();K(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!==M?a()&&t.init():function(){const o=n();o in t?t[o]():i()||a()||ie(`Unexpected message (${e.data})`)}())}function Le(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}function We(e){return Be(e),X}"undefined"!=typeof window&&(window.iframeChildListener=e=>Be({data:e,sameDomian:!0}),n(window,"message",Be),n(window,"readystatechange",Le),Le());try{top?.document?.getElementById("banner")&&(X={},window.mockMsgListener=We,o(window,"message",Be),define([],(()=>We)))}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.6 (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:()=>(ie("Custom height calculation function not defined"),Ae.auto()),width:()=>(ie("Custom width calculation function not defined"),Te.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,v=!0,b="",w=0,z="",S=null,$="",j=!0,E=!1,O=null,M=!0,C=!1,A=1,T=u,I=!0,P="",N={},x=!0,R=!1,k=0,B=!1,L=!1,W="",H=0,q=0,F="child",V=null,D=!1,U=window.parent,J="*",Z=0,Q=!1,Y=1,G=p,X=window,K=()=>{ie("onMessage function not defined")},_=()=>{},ee=null,te=null;const ne=e=>""!=`${e}`&&void 0!==e;const oe=(...e)=>[`${d}[${W}]`,...e].join(" "),ie=(...e)=>console?.warn(oe(...e)),ae=(...e)=>console?.warn(((...e)=>window.chrome?oe(...e).replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m"):oe(...e).replaceAll(/\u001B\[[\d;]*m/gi,""))(...e)),le=e=>ae(e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))));function re(){!function(){try{D="iframeParentListener"in window.parent}catch(e){}}(),function(){const e=e=>"true"===e,t=P.slice(m).split(":");W=t[0],w=void 0===t[1]?w:Number(t[1]),E=void 0===t[2]?E:e(t[2]),R=void 0===t[3]?R:e(t[3]),v=void 0===t[6]?v:e(t[6]),z=t[7],T=void 0===t[8]?T:t[8],b=t[9],$=t[10],Z=void 0===t[11]?Z:Number(t[11]),N.enable=void 0!==t[12]&&e(t[12]),F=void 0===t[13]?F:t[13],G=void 0===t[14]?G:t[14],L=void 0===t[15]?L:e(t[15]),H=void 0===t[16]?H:Number(t[16]),q=void 0===t[17]?q:Number(t[17]),j=void 0===t[18]?j:e(t[18]),y=t[19],g=t[20],B=void 0===t[21]?B:e(t[21])}(),function(){function e(){const e=window.iFrameResizer;K=e?.onMessage||K,_=e?.onReady||_,H=e?.offsetHeight||H,q=e?.offsetWidth||q,J=e?.targetOrigin||J,T=e?.heightCalculationMethod||T,G=e?.widthCalculationMethod||G}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"),G=t(G,"width"))}(),function(){k=["1jqr0si6pnt","GPL-V3","bar"].indexOf(y),-1===k&&""!==y&&(k=-2);!B&&g||(k=9)}(),function(){void 0===z&&(z=`${w}px`);ce("margin",function(e,t){t.includes("-")&&(ie(`Negative CSS value ignored for ${e}`),t="");return t}("margin",z))}(),ce("background",b),ce("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)}(),k<0?le(`${pe[k+2]}${pe[2]}`):k<2&&le(pe[3]),fe(),he(),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&&ae("\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"===T&&(T="autoOverflow"),"auto"===G&&(G="autoOverflow")),de(),X.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===v?(v=!0,ye()):!1===e&&!0===v&&(v=!1,ue("remove"),V?.disconnect(),S?.disconnect()),ke(0,0,"autoResize",JSON.stringify(v)),v),close(){ke(0,0,"close")},getId:()=>W,getPageInfo(e){if("function"==typeof e)return ee=e,ke(0,0,"pageInfo"),void ae("\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");ee=null,ke(0,0,"pageInfoStop")},getParentInfo(e){if("function"==typeof e)return te=e,void ke(0,0,"parentInfo");te=null,ke(0,0,"parentInfoStop")},moveToAnchor(e){N.findTarget(e)},reset(){Re()},scrollTo(e,t){ke(t,e,"scrollTo")},scrollToOffset(e,t){ke(t,e,"scrollToOffset")},sendMessage(e,t){ke(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){T=e,fe()},setWidthCalculationMethod(e){G=e,he()},setTargetOrigin(e){J=e},size(e,t){Pe("size",`parentIFrame.size(${e||""}${t?`,${t}`:""})`,e,t)}}),X.parentIFrame=X.parentIframe,function(){if(!0!==L)return;function e(e){ke(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,o){n(window.document,t,e)}t("mouseenter"),t("mouseleave")}(),ye(),N=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);ke(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?ke(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()}N.enable&&u();return{findTarget:i}}(),Pe("init","Init message from host page"),_(),x=!1}function ce(e,t){void 0!==t&&""!==t&&"null"!==t&&document.body.style.setProperty(e,t)}function se(e){({add(t){function o(){Pe(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 ue(e){se({method:e,eventType:"After Print",eventName:"afterprint"}),se({method:e,eventType:"Before Print",eventName:"beforeprint"}),se({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}function de(){const e=document.querySelectorAll(`[${t}]`);C=e.length>0,O=C?e:Ee(document)()}function me(e,t,n,o){return t!==e&&(e in n||(ie(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in l&&ae(`\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 fe(){T=me(T,u,Ae,"height")}function he(){G=me(G,p,Te,"width")}const pe=["<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 ye(){!0===v&&(ue("add"),S=function(){function e(e){e.forEach(Se),de()}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()}}}(),V=new ResizeObserver(ge),ze(window.document))}function ge(e){Pe("resizeObserver",`resizeObserver: ${function(e){switch(!0){case!ne(e):return"";case ne(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case ne(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(ne(e.className)?`.${e.className}`:"")}}(e[0].target)}`)}const ve=e=>{const t=getComputedStyle(e);return""!==t?.position&&"static"!==t?.position},be=()=>[...Ee(document)()].filter(ve);function we(e){e&&V.observe(e)}function ze(e){[...be(),...h.flatMap((t=>e.querySelector(t)))].forEach(we)}function Se(e){"childList"===e.type&&ze(e.target)}function $e(e){const t=(n=e).charAt(0).toUpperCase()+n.slice(1);var n;let o,a=0,l=O.length,r=0,c=performance.now();O.forEach((t=>{C||!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} ${C?"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||x||C||ae(`\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 je=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.documentElementBoundingClientRect()],Ee=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 Oe={height:0,width:0},Me={height:0,width:0};function Ce(e,t){function n(){return Me[i]=a,Oe[i]=c,a}const o=e===Ae,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===Me[i]&&0===Oe[i]:if(e.taggedElement(!0)<=l)return n();break;case Q&&a===Me[i]&&c===Oe[i]:return Math.max(a,c);case 0===a:return c;case!t&&a!==Me[i]&&c<=Oe[i]:case!t&&a<Me[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";ae(`\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?T="autoOverflow":G="autoOverflow"}({ceilBoundingSize:l,dimension:i,isHeight:o,scrollSize:c})}return Math.max(e.taggedElement(),n())}const Ae={enabled:()=>j,getOffset:()=>H,type:"height",auto:()=>Ce(Ae,!1),autoOverflow:()=>Ce(Ae,!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:()=>Ae.bodyOffset(),custom:()=>a.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().bottom,max:()=>Math.max(...je(Ae)),min:()=>Math.min(...je(Ae)),grow:()=>Ae.max(),lowestElement:()=>$e("bottom"),taggedElement:()=>$e("bottom")},Te={enabled:()=>E,getOffset:()=>q,type:"width",auto:()=>Ce(Te,!1),autoOverflow:()=>Ce(Te,!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(...je(Te)),min:()=>Math.min(...je(Te)),rightMostElement:()=>$e("right"),scroll:()=>Math.max(Te.bodyScroll(),Te.documentElementScroll()),taggedElement:()=>$e("right")};function Ie(e,t,n,o){let i,a;!function(){const e=(e,t)=>!(Math.abs(e-t)<=Z);return i=Math.ceil(void 0===n?Ae[T]():n),a=Math.ceil(void 0===o?Te[G]():o),j&&e(A,i)||E&&e(Y,a)}()&&"init"!==e?!(e in{init:1,size:1})&&(j&&T in f||E&&G in f)&&Re():(Ne(),A=i,Y=a,ke(A,Y,e))}function Pe(e,t,n,o){document.hidden||Ie(e,0,n,o)}function Ne(){Q||(Q=!0,requestAnimationFrame((()=>{Q=!1})))}function xe(e){A=Ae[T](),Y=Te[G](),ke(A,Y,e)}function Re(e){const t=T;T=u,Ne(),xe("reset"),T=t}function ke(e,t,n,o,i){k<0||(void 0!==i||(i=J),function(){const a=`${W}:${`${e+H}:${t+q}`}:${n}${void 0===o?"":`:${o}`}`;D?window.parent.iframeParentListener(d+a):U.postMessage(d+a,i)}())}function Be(e){const t={init:function(){P=e.data,U=e.source,re(),M=!1,setTimeout((()=>{I=!1}),r)},reset(){I||xe("resetPage")},resize(){Pe("resizeParent")},moveToAnchor(){N.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();ee?ee(JSON.parse(e)):ke(0,0,"pageInfoStop")},parentInfo(){const e=o();te?te(Object.freeze(JSON.parse(e))):ke(0,0,"parentInfoStop")},message(){const e=o();K(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!==M?a()&&t.init():function(){const o=n();o in t?t[o]():i()||a()||ie(`Unexpected message (${e.data})`)}())}function Le(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}function We(e){return Be(e),X}"undefined"!=typeof window&&(window.iframeChildListener=e=>Be({data:e,sameDomian:!0}),n(window,"message",Be),n(window,"readystatechange",Le),Le());try{top?.document?.getElementById("banner")&&(X={},window.mockMsgListener=We,o(window,"message",Be),define([],(()=>We)))}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.6",
|
|
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"
|