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