@iframe-resizer/jquery 5.4.0-beta.2 → 5.4.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/index.cjs.js +1 -1
- package/index.esm.js +1 -1
- package/index.umd.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
package/index.cjs.js
CHANGED
package/index.esm.js
CHANGED
package/index.umd.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @preserve
|
|
3
3
|
*
|
|
4
|
-
* @module iframe-resizer/jquery 5.4.0-beta.
|
|
4
|
+
* @module iframe-resizer/jquery 5.4.0-beta.3 (umd) - 2025-03-19
|
|
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(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";const e="5.4.0-beta.2",t="[iFrameSizer]",i=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),n=(e,t,i,n)=>e.addEventListener(t,i,n||!1),o=(e,t,i)=>e.removeEventListener(t,i,!1),r=e=>{if(!e)return"";let t=-559038744,i=1103547984;for(let n,o=0;o<e.length;o++)n=e.codePointAt(o),t=Math.imul(t^n,2246822519),i=Math.imul(i^n,3266489917);return t^=Math.imul(t^i>>>15,1935289751),i^=Math.imul(i^t>>>15,3405138345),t^=i>>>16,i^=t>>>16,(2097152*(i>>>0)+(t>>>11)).toString(36)},s=e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))),a=["<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."],l=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],c=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)]))),u=e=>s(a[e]),d=e=>{const t=e[s("spjluzl")];if(!t)return-1;const i=t.split("-");let n=function(e=""){let t=-2;const i=r(s(e));return i in c&&(t=c[i]),t}(i[0]);return 0===n||(e=>e[2]===r(e[0]+e[1]))(i)||(n=-2),n},f=e=>e,p="default",m={collapsed:!1,defaultEvent:void 0,event:void 0,label:"Auto Group",showTime:!0},h={profile:0,profileEnd:0,timeStamp:0,trace:0};const{fromEntries:g,keys:y}=Object,b=e=>t=>[t,function(i){e[t]=i}],w=(e,t)=>g(y(e).map(t));function v(e){const t=[],i={},n={...m,...e};let o;function r(){t.length=0}function s(){delete n.event,r()}const a=()=>!t.some((([e])=>"error"===e||"warn"===e))&&n.collapsed;function l(){if(0!==t.length){console[a()?"groupCollapsed":"group"](`%c${n.label} %c${(e=>{const t=e.event||e.defaultEvent;return t?`${t} `:""})(n)}%c${n.showTime?o:""}`,"font-weight: normal;","font-weight: bold;","font-weight: normal;font-style: italic;");for(const[e,...i]of t)console[e](...i);console.groupEnd(),s()}else s()}function c(){o=function(){const e=new Date,t=(t,i)=>e[`get${t}`]().toString().padStart(i,"0");return`@ ${t("Hours",2)}:${t("Minutes",2)}:${t("Seconds",2)}.${t("Milliseconds",3)}`}(),queueMicrotask((()=>queueMicrotask(l)))}function u(e,...i){0===t.length&&c(),t.push([e,...i])}function d(e=p,...t){u("log",`${e}: ${performance.now()-i[e]} ms`,...t)}return{...w(n,b(n)),...w(console,(e=>[e,(...t)=>u(e,...t)])),...w(h,(e=>[e,console[e]])),endAutoGroup:l,purge:r,time:function(e=p){i[e]=performance.now()},timeEnd:function(e=p){d(e),delete i[e]},timeLog:d}}const z=e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m")):e((e=>e.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,""))(t));let $={},j=!1;const k=e=>window.top===window.self?`${e}(parent)`:`${e}(nested parent)`;const T=e=>(t,...i)=>$[t]?.console[e](...i),R=(M="log",(e,...t)=>!0===(e=>$[e]?$[e].log:j)(e)?T(M)(e,...t):null);var M;const S=T("warn"),I=T("event");const x=(e,t)=>$[e]?$[e].console.warn(z(f)(t)):queueMicrotask((()=>console?.warn(z((e=>(...t)=>[`iframeResizer(${e})`,...t].join(" "))(e))(t)))),O=(e=>(t,i="renamed to")=>(n,o,r="",s="")=>e(s,`<rb>Deprecated ${t}(${n.replace("()","")})</>\n\nThe <b>${n}</> ${t.toLowerCase()} has been ${i} <b>${o}</>. ${r}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))(x),E=O("Method"),W=O("Option"),C={},L=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyPadding:null,checkOrigin:!0,direction:"vertical",inPageLinks:!1,heightCalculationMethod:"auto",id:"iFrameResizer",log:!1,license:void 0,mouseEvents:!0,offsetHeight:null,offsetWidth:null,postMessageTarget:null,sameDomain:!1,scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,waitForLoad:!1,widthCalculationMethod:"auto",onClose:()=>!0,onClosed(){},onInit:!1,onMessage:null,onMouseEnter(){},onMouseLeave(){},onReady:e=>{"function"==typeof C[e.id].onInit&&(W("init()","onReady()","",e.id),C[e.id].onInit(e))},onResized(){},onScroll:()=>!0}),A={position:null,version:e};function N(i){function r(){J(k),B(T),$("onResized",k)}function s(e){if("border-box"!==e.boxSizing)return 0;return(e.paddingTop?parseInt(e.paddingTop,10):0)+(e.paddingBottom?parseInt(e.paddingBottom,10):0)}function a(e){if("border-box"!==e.boxSizing)return 0;return(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}const l=e=>j.slice(j.indexOf(":")+7+e);const c=(e,t)=>(i,n)=>{const o={};var r,s;r=function(){U(`${i} (${e})`,`${e}:${t()}`,n)},o[s=n]||(r(),o[s]=requestAnimationFrame((()=>{o[s]=null})))},u=(e,t)=>()=>{let i=!1;const r=t=>()=>{C[u]?i&&i!==t||(e(t,u),i=t,requestAnimationFrame((()=>{i=!1}))):c()},s=r("scroll"),a=r("resize window");function l(e,i){R(u,`${e} listeners for send${t}`),i(window,"scroll",s),i(window,"resize",a)}function c(){l("Remove ",o),d.disconnect(),f.disconnect()}const u=T,d=new ResizeObserver(r("pageObserver")),f=new ResizeObserver(r("iframeObserver"));l("Add ",n),d.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),f.observe(C[u].iframe,{attributes:!0,childList:!1,subtree:!1}),C[u]&&(C[u][`stop${t}`]=c)},d=e=>()=>{e in C[T]&&(C[T][e](),delete C[T][e])},f=c("pageInfo",(function(){const e=document.body.getBoundingClientRect(),t=k.iframe.getBoundingClientRect(),{scrollY:i,scrollX:n,innerHeight:o,innerWidth:r}=window,{clientHeight:s,clientWidth:a}=document.documentElement;return JSON.stringify({iframeHeight:t.height,iframeWidth:t.width,clientHeight:Math.max(s,o||0),clientWidth:Math.max(a,r||0),offsetTop:parseInt(t.top-e.top,10),offsetLeft:parseInt(t.left-e.left,10),scrollTop:i,scrollLeft:n,documentHeight:s,documentWidth:a,windowHeight:o,windowWidth:r})})),p=c("parentInfo",(function(){const{iframe:e}=k,{scrollWidth:t,scrollHeight:i}=document.documentElement,{width:n,height:o,offsetLeft:r,offsetTop:s,pageLeft:a,pageTop:l,scale:c}=window.visualViewport;return JSON.stringify({iframe:e.getBoundingClientRect(),document:{scrollWidth:t,scrollHeight:i},viewport:{width:n,height:o,offsetLeft:r,offsetTop:s,pageLeft:a,pageTop:l,scale:c}})})),m=u(f,"PageInfo"),h=u(p,"ParentInfo"),g=d("stopPageInfo"),y=d("stopParentInfo");function b(e){const t=e.getBoundingClientRect();return P(T),{x:Number(t.left)+Number(A.position.x),y:Number(t.top)+Number(A.position.y)}}function w(e){const t=e?b(k.iframe):{x:0,y:0};R(T,`Reposition requested from iFrame (offset x:${t.x} y:${t.y})`);const i=((e,t)=>({x:e.width+t.x,y:e.height+t.y}))(k,t),n=window.parentIframe||window.parentIFrame;n?function(t,i){t["scrollTo"+(e?"Offset":"")](i.x,i.y)}(n,i):function(e){A.position=e,v(T)}(i)}function v(e){const{x:t,y:i}=A.position,n=C[e]?.iframe;!1!==$("onScroll",{iframe:n,top:i,left:t,x:t,y:i})?B(e):q()}function z(e){let t={};if(0===k.width&&0===k.height){const e=l(9).split(":");t={x:e[1],y:e[0]}}else t={x:k.width,y:k.height};$(e,{iframe:k.iframe,screenX:Number(t.x),screenY:Number(t.y),type:k.type})}const $=(e,t)=>F(T,e,t);let j=i.data,k={},T=null;"[iFrameResizerChild]Ready"!==j?t===`${j}`.slice(0,13)&&j.slice(13).split(":")[0]in C?(k=function(){const e=j.slice(13).split(":"),t=e[1]?Number(e[1]):0,i=C[e[0]]?.iframe,n=getComputedStyle(i);return{iframe:i,id:e[0],height:t+s(n)+a(n),width:Number(e[2]),type:e[3],msg:e[4]}}(),T=k.id,I(T,k.type),T?(function(e){if(!C[e])throw new Error(`${k.type} No settings for ${e}. Message was: ${j}`)}(T),function(){const e=k.type in{true:1,false:1,undefined:1};return e&&R(T,"Ignoring init message from meta parent page"),e}()||(R(T,`Received: ${j}`),C[T].loaded=!0,(null!==k.iframe||(S(T,`The iframe (${k.id}) was not found.`),0))&&function(){const{origin:e,sameDomain:t}=i;if(t)return!0;let n=C[T]?.checkOrigin;if(n&&"null"!=`${e}`&&!(n.constructor===Array?function(){let t=0,i=!1;for(R(T,`Checking connection is from allowed list of origins: ${n}`);t<n.length;t++)if(n[t]===e){i=!0;break}return i}():function(){const t=C[T]?.remoteHost;return R(T,`Checking connection is from: ${t}`),e===t}()))throw new Error(`Unexpected message received from: ${e} for ${k.iframe.id}. Message was: ${i.data}. This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.`);return!0}()&&function(){switch(C[T]?.firstRun&&C[T]&&(C[T].firstRun=!1),k.type){case"close":H(k.iframe);break;case"message":i=l(6),R(T,`onMessage passed: {iframe: ${k.iframe.id}, message: ${i}}`),$("onMessage",{iframe:k.iframe,message:JSON.parse(i)});break;case"mouseenter":z("onMouseEnter");break;case"mouseleave":z("onMouseLeave");break;case"autoResize":C[T].autoResize=JSON.parse(l(9));break;case"scrollBy":!function(){const e=k.width,t=k.height,i=window.parentIframe||window.parentIFrame||window;R(T,`Scroll request received by parent: x: ${e} y: ${t}`),i.scrollBy(e,t)}();break;case"scrollTo":w(!1);break;case"scrollToOffset":w(!0);break;case"pageInfo":f("start",T),m();break;case"parentInfo":p("start",T),h();break;case"pageInfoStop":g();break;case"parentInfoStop":y();break;case"inPageLink":!function(e){const t=e.split("#")[1]||"",i=decodeURIComponent(t);let n=document.getElementById(i)||document.getElementsByName(i)[0];n?function(){const e=b(n);R(T,`Moving to in page link (#${t}) at x: ${e.x} y: ${e.y}`),A.position={x:e.x,y:e.y},v(T),window.location.hash=t,R(T,"--")}():window.top!==window.self?function(){const e=window.parentIframe||window.parentIFrame;e?e.moveToAnchor(t):R(T,`In page link #${t} not found and window.parentIframe not found`)}():R(T,`In page link #${t} not found`)}(l(9));break;case"title":!function(e,t){C[t]?.syncTitle&&(C[t].iframe.title=e,R(t,`Set title attribute to: ${e}`))}(k.msg,T);break;case"reset":Q(k);break;case"init":r(),function(e){try{C[e].sameDomain=!!C[e]?.iframe?.contentWindow?.iframeChildListener}catch(t){C[e].sameDomain=!1}R(e,`sameDomain: ${C[e].sameDomain}`)}(T),(t=k.msg)!==e&&(void 0!==t?R(T,`Version mismatch (Child: ${t} !== Parent: ${e})`):x(T,"<rb>Legacy version detected in iframe</>\n\nDetected legacy version of child page script. It is recommended to update the page in the iframe to use <b>@iframe-resizer/child</>.\n\nSee <u>https://iframe-resizer.com/setup/#child-page-setup</> for more details.\n")),G=!0,$("onReady",k.iframe);break;default:if(0===k.width&&0===k.height)return void S(T,`Unsupported message received (${k.type}), this is likely due to the iframe containing a later version of iframe-resizer than the parent page`);if(0===k.width||0===k.height)return void R(T,"Ignoring message with 0 height or width");if(document.hidden)return void R(T,"Page hidden - ignored resize request");r()}var t,i}())):S("","iframeResizer received messageData without id, message was: ",j)):null!==T&&R(T,"Ignored:",j):Object.keys(C).forEach((e=>{C[e].mode>=0&&U("iFrame requested init",V(e),e)}))}function F(e,t,i){let n=null,o=null;if(C[e]){if(n=C[e][t],"function"!=typeof n)throw new TypeError(`${t} on iFrame[${e}] is not a function`);if("onClose"===t||"onScroll"===t)try{o=n(i)}catch(i){console.error(i),S(e,`Error in ${t} callback`)}else setTimeout((()=>n(i)))}return o}function D(e){const{id:t}=e;R(t,"Disconnected from iframe"),delete C[t]}function H(e){const{id:t}=e;if(!1!==F(t,"onClose",t)){R(t,`Removing iFrame: ${t}`);try{e.parentNode&&e.remove()}catch(e){S(t,e)}F(t,"onClosed",t),D(e)}else R(t,"Close iframe cancelled by onClose event")}function P(e){null===A.position&&(A.position={x:window.scrollX,y:window.scrollY},R(e,`Get page position: ${A.position.x}, ${A.position.y}`))}function q(){A.position=null}function B(e){null!==A.position&&(window.scrollTo(A.position.x,A.position.y),R(e,`Set page position: ${A.position.x}, ${A.position.y}`),q())}function Q(e){R(e.id,"Size reset requested by "+("init"===e.type?"parent page":"child page")),P(e.id),J(e),U("reset","reset",e.id)}function J(e){function t(t){const n=`${e[t]}px`;e.iframe.style[t]=n,R(i,`Iframe (${i}) ${t} set to ${n}`)}const{id:i}=e,{sizeHeight:n,sizeWidth:o}=C[i];n&&t("height"),o&&t("width")}function U(e,i,n,o){I(n,e),C[n]&&(C[n]?.postMessageTarget?function(){const{iframe:e,postMessageTarget:o,sameDomain:r,targetOrigin:s}=C[n];if(r)try{return e.contentWindow.iframeChildListener(t+i),void R(n,`Sending message to iframe[${n}] (${i}) via sameDomain`)}catch(e){R(n,"Same domain connection failed. Trying cross domain")}R(n,`Sending message to iframe[${n}] (${i}) targetOrigin: ${s}`),o.postMessage(t+i,s)}():S(n,`Iframe(${n}) not found`),o&&C[n]?.warningTimeout&&(C[n].msgTimeout=setTimeout((function(){if(void 0===C[n])return;const{iframe:e,loaded:t,loadErrorShown:i,waitForLoad:o}=C[n],{sandbox:r}=e;t||i||(C[n].loadErrorShown=!0,x(n,`<rb>No response from iFrame</>\n \nThe iframe (<i>${n}</>) has not responded within ${C[n].warningTimeout/1e3} seconds. Check <b>@iframe-resizer/child</> package has been loaded in the iframe.\n${o?"\nThe <b>waitForLoad</> option is currently set to <i>'true'</>. If the iframe loads before the JavaScript runs, this option will prevent <i>iframe-resizer</> from initialising. To disable this, set the <b>waitForLoad</> option to <i>'false'</>. \n":""}${!(r?.length>0)||r.contains("allow-scripts")&&r.contains("allow-same-origin")?"":"\nThe iframe has the <b>sandbox</> attribute, please ensure it contains both the <i>'allow-same-origin'</> and <i>'allow-scripts'</> values.\n"} \n${!(r?.length>0)||r.contains("allow-scripts")&&r.contains("allow-same-origin")?"":"The iframe has the <b>sandbox</> attribute, please ensure it contains both the <i>'allow-same-origin'</> and <i>'allow-scripts'</> values.\n"}This message can be ignored if everything is working, or you can set the <b>warningTimeout</> option to a higher value or zero to suppress this warning.\n`))}),C[n].warningTimeout)))}function V(e){const t=C[e];return[e,"8",t.sizeWidth,t.log,"32",!0,t.autoResize,t.bodyMargin,t.heightCalculationMethod,t.bodyBackground,t.bodyPadding,t.tolerance,t.inPageLinks,"child",t.widthCalculationMethod,t.mouseEvents,t.offsetHeight,t.offsetWidth,t.sizeHeight,t.license,A.version,t.mode].join(":")}$=C;let Z=0,G=!1,X=!1;const Y=t=>o=>{function r(e){if(!e)return{};if("object"!=typeof e)throw new TypeError("Options is not an object");return("sizeWidth"in e||"sizeHeight"in e||"autoResize"in e)&&x(f,'<rb>Deprecated Option</>\n\nThe <b>sizeWidth</>, <b>sizeHeight</> and <b>autoResize</> options have been replaced with new <b>direction</> option which expects values of <i>"vertical"</>, <i>"horizontal"</> or <i>"horizontal"</>.\n'),e}function a(e){const t=C[e]?.iframe?.title;return""===t||void 0===t}const c=e=>Object.hasOwn(e,"onMouseEnter")||Object.hasOwn(e,"onMouseLeave");const f=function(e){if(e&&"string"!=typeof e)throw new TypeError("Invalid id for iFrame. Expected String");return""!==e&&e||(e=function(){let e=t?.id||L.id+Z++;return null!==document.getElementById(e)&&(e+=Z++),e}(),o.id=e,R(e,`Added missing iframe ID: ${e} (${o.src})`)),e}(o.id);return function({enabled:e,iframeId:t}){j=e,$[t]||($[t]={console:v({label:k(t)})})}({enabled:Object.hasOwn(t,"log")?t.log:L.log,iframeId:f}),"iframeResizer"in o?S(f,`Ignored iframe (${f}), already setup.`):(function(e){var t,i;C[f]={...C[f],iframe:o,firstRun:!0,remoteHost:o?.src.split("/").slice(0,3).join("/"),...L,...r(e),mouseEvents:c(e),mode:d(e),syncTitle:a(f)},I(f,"setup"),function(){const{direction:e}=C[f];if("horizontal"===e)return C[f].sizeWidth=!0,C[f].sizeHeight=!1,void R(f,'Direction set to "horizontal"');if("none"===e)return C[f].sizeWidth=!1,C[f].sizeHeight=!1,C[f].autoResize=!1,void R(f,'Direction set to "none"');if("vertical"!==e)throw new TypeError(f,`Direction value of "${e}" is not valid`);R(f,'Direction set to "vertical"')}(),(t=e?.offsetSize||e?.offset)&&("vertical"===C[f].direction?(C[f].offsetHeight=t,R(f,`Offset height set to ${t}`)):(C[f].offsetWidth=t,R(f,`Offset width set to ${t}`))),e?.offset&&x(f,"<rb>Deprecated option</>\n\n The <b>offset</> option has been renamed to <b>offsetSize</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>."),null===C[f].postMessageTarget&&(C[f].postMessageTarget=o.contentWindow),C[f].targetOrigin=!0===C[f].checkOrigin?""===(i=C[f].remoteHost)||null!==i.match(/^(about:blank|javascript:|file:\/\/)/)?"*":i:"*"}(t),function(){const{mode:t}=C[f];t<0&&x("Parent",`${u(t+2)}${u(2)}`),X||t<0||(X=!0,function(e,t){"iframeResizer"in window||(window.iframeResizer={version:e}),!j&&t>0||queueMicrotask((()=>console.info(`%ciframe-resizer ${e}`,"font-weight: bold;")))}(`v${e} (${(e=>s(l[e]))(t)})`,t),t<1&&x("Parent",u(3)))}(),_(),function(){switch(R(f,`Iframe scrolling ${C[f]?.scrolling?"enabled":"disabled"} for ${f}`),o.style.overflow=!1===C[f]?.scrolling?"hidden":"auto",C[f]?.scrolling){case"omit":break;case!0:o.scrolling="yes";break;case!1:o.scrolling="no";break;default:o.scrolling=C[f]?C[f].scrolling:"no"}}(),function(){const{bodyMargin:e}=C[f];"number"!=typeof e&&"0"!==e||(C[f].bodyMargin=`${e}px`)}(),function(e){const{id:t}=o,{mode:r,waitForLoad:s}=C[t];-1!==r&&-2!==r&&(n(o,"load",(function(){U("iFrame.onload",`${e}:${G}`,t,!0),function(){const e=C[f]?.firstRun,t=C[f]?.heightCalculationMethod in i;!e&&t&&Q({iframe:o,height:0,width:0,type:"init"})}()})),!1===s&&U("init",`${e}:${G}`,t,!0))}(V(f)),function(){if(C[f]){const{iframe:e}=C[f],t={close:H.bind(null,e),disconnect:D.bind(null,e),removeListeners(){x(f,"\n<rb>Deprecated Method Name</>\n\nThe [removeListeners()</> method has been renamed to [disconnect()</>.\n"),this.disconnect()},resize:U.bind(null,"Window resize","resize",f),moveToAnchor(e){U("Move to anchor",`moveToAnchor:${e}`,f)},sendMessage(e){U("message",`message:${e=JSON.stringify(e)}`,f)}};e.iframeResizer=t,e.iFrameResizer=t}}()),o?.iFrameResizer};function K(){!1===document.hidden&&(R("document","Trigger event: Visibility change"),function(e,t){const i=e=>C[e]?.autoResize&&!C[e]?.firstRun;Object.keys(C).forEach((function(n){i(n)&&U(e,t,n)}))}("Tab Visible","resize"))}const _=(e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}})((()=>{n(window,"message",N),n(document,"visibilitychange",K),window.iframeParentListener=e=>setTimeout((()=>N({data:e,sameDomain:!0})))}));switch(!0){case void 0===window.jQuery:S("","Unable to bind to jQuery, it is not available.");break;case!window.jQuery.fn:S("","Unable to bind to jQuery, it is not fully loaded.");break;case window.jQuery.fn.iframeResize:S("","iframeResize is already assigned to jQuery.fn.");break;default:window.jQuery.fn.iframeResize=function(e){const t=Y(e);return this.filter("iframe").each(((e,i)=>t(i))).end()},window.jQuery.fn.iFrameResize=function(e){return E("iFrameResize()","iframeResize()","","jQuery"),this.iframeResize(e)}}}));
|
|
20
|
+
!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";const e="5.4.0-beta.3",t="[iFrameSizer]",i=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),n=(e,t,i,n)=>e.addEventListener(t,i,n||!1),o=(e,t,i)=>e.removeEventListener(t,i,!1),r=e=>{if(!e)return"";let t=-559038744,i=1103547984;for(let n,o=0;o<e.length;o++)n=e.codePointAt(o),t=Math.imul(t^n,2246822519),i=Math.imul(i^n,3266489917);return t^=Math.imul(t^i>>>15,1935289751),i^=Math.imul(i^t>>>15,3405138345),t^=i>>>16,i^=t>>>16,(2097152*(i>>>0)+(t>>>11)).toString(36)},s=e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))),a=["<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."],l=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],c=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)]))),u=e=>s(a[e]),d=e=>{const t=e[s("spjluzl")];if(!t)return-1;const i=t.split("-");let n=function(e=""){let t=-2;const i=r(s(e));return i in c&&(t=c[i]),t}(i[0]);return 0===n||(e=>e[2]===r(e[0]+e[1]))(i)||(n=-2),n},f=e=>e,p="default",m={collapsed:!1,defaultEvent:void 0,event:void 0,label:"Auto Group",showTime:!0},h={profile:0,profileEnd:0,timeStamp:0,trace:0};const{fromEntries:g,keys:y}=Object,b=e=>t=>[t,function(i){e[t]=i}],w=(e,t)=>g(y(e).map(t));function v(e){const t=[],i={},n={...m,...e};let o;function r(){t.length=0}function s(){delete n.event,r()}const a=()=>!t.some((([e])=>"error"===e||"warn"===e))&&n.collapsed;function l(){if(0!==t.length){console[a()?"groupCollapsed":"group"](`%c${n.label} %c${(e=>{const t=e.event||e.defaultEvent;return t?`${t} `:""})(n)}%c${n.showTime?o:""}`,"font-weight: normal;","font-weight: bold;","font-weight: normal;font-style: italic;");for(const[e,...i]of t)console[e](...i);console.groupEnd(),s()}else s()}function c(){o=function(){const e=new Date,t=(t,i)=>e[`get${t}`]().toString().padStart(i,"0");return`@ ${t("Hours",2)}:${t("Minutes",2)}:${t("Seconds",2)}.${t("Milliseconds",3)}`}(),queueMicrotask((()=>queueMicrotask(l)))}function u(e,...i){0===t.length&&c(),t.push([e,...i])}function d(e=p,...t){u("log",`${e}: ${performance.now()-i[e]} ms`,...t)}return{...w(n,b(n)),...w(console,(e=>[e,(...t)=>u(e,...t)])),...w(h,(e=>[e,console[e]])),endAutoGroup:l,purge:r,time:function(e=p){i[e]=performance.now()},timeEnd:function(e=p){d(e),delete i[e]},timeLog:d}}const z=e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m")):e((e=>e.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,""))(t));let $={},j=!1;const k=e=>window.top===window.self?`${e}(parent)`:`${e}(nested parent)`;const T=e=>(t,...i)=>$[t]?.console[e](...i),R=(M="log",(e,...t)=>!0===(e=>$[e]?$[e].log:j)(e)?T(M)(e,...t):null);var M;const S=T("warn"),I=T("event");const x=(e,t)=>$[e]?$[e].console.warn(z(f)(t)):queueMicrotask((()=>console?.warn(z((e=>(...t)=>[`iframeResizer(${e})`,...t].join(" "))(e))(t)))),O=(e=>(t,i="renamed to")=>(n,o,r="",s="")=>e(s,`<rb>Deprecated ${t}(${n.replace("()","")})</>\n\nThe <b>${n}</> ${t.toLowerCase()} has been ${i} <b>${o}</>. ${r}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))(x),E=O("Method"),W=O("Option"),C={},L=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyPadding:null,checkOrigin:!0,direction:"vertical",inPageLinks:!1,heightCalculationMethod:"auto",id:"iFrameResizer",log:!1,license:void 0,mouseEvents:!0,offsetHeight:null,offsetWidth:null,postMessageTarget:null,sameDomain:!1,scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,waitForLoad:!1,widthCalculationMethod:"auto",onClose:()=>!0,onClosed(){},onInit:!1,onMessage:null,onMouseEnter(){},onMouseLeave(){},onReady:e=>{"function"==typeof C[e.id].onInit&&(W("init()","onReady()","",e.id),C[e.id].onInit(e))},onResized(){},onScroll:()=>!0}),A={position:null,version:e};function N(i){function r(){J(k),B(T),$("onResized",k)}function s(e){if("border-box"!==e.boxSizing)return 0;return(e.paddingTop?parseInt(e.paddingTop,10):0)+(e.paddingBottom?parseInt(e.paddingBottom,10):0)}function a(e){if("border-box"!==e.boxSizing)return 0;return(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}const l=e=>j.slice(j.indexOf(":")+7+e);const c=(e,t)=>(i,n)=>{const o={};var r,s;r=function(){U(`${i} (${e})`,`${e}:${t()}`,n)},o[s=n]||(r(),o[s]=requestAnimationFrame((()=>{o[s]=null})))},u=(e,t)=>()=>{let i=!1;const r=t=>()=>{C[u]?i&&i!==t||(e(t,u),i=t,requestAnimationFrame((()=>{i=!1}))):c()},s=r("scroll"),a=r("resize window");function l(e,i){R(u,`${e} listeners for send${t}`),i(window,"scroll",s),i(window,"resize",a)}function c(){l("Remove ",o),d.disconnect(),f.disconnect()}const u=T,d=new ResizeObserver(r("pageObserver")),f=new ResizeObserver(r("iframeObserver"));l("Add ",n),d.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),f.observe(C[u].iframe,{attributes:!0,childList:!1,subtree:!1}),C[u]&&(C[u][`stop${t}`]=c)},d=e=>()=>{e in C[T]&&(C[T][e](),delete C[T][e])},f=c("pageInfo",(function(){const e=document.body.getBoundingClientRect(),t=k.iframe.getBoundingClientRect(),{scrollY:i,scrollX:n,innerHeight:o,innerWidth:r}=window,{clientHeight:s,clientWidth:a}=document.documentElement;return JSON.stringify({iframeHeight:t.height,iframeWidth:t.width,clientHeight:Math.max(s,o||0),clientWidth:Math.max(a,r||0),offsetTop:parseInt(t.top-e.top,10),offsetLeft:parseInt(t.left-e.left,10),scrollTop:i,scrollLeft:n,documentHeight:s,documentWidth:a,windowHeight:o,windowWidth:r})})),p=c("parentInfo",(function(){const{iframe:e}=k,{scrollWidth:t,scrollHeight:i}=document.documentElement,{width:n,height:o,offsetLeft:r,offsetTop:s,pageLeft:a,pageTop:l,scale:c}=window.visualViewport;return JSON.stringify({iframe:e.getBoundingClientRect(),document:{scrollWidth:t,scrollHeight:i},viewport:{width:n,height:o,offsetLeft:r,offsetTop:s,pageLeft:a,pageTop:l,scale:c}})})),m=u(f,"PageInfo"),h=u(p,"ParentInfo"),g=d("stopPageInfo"),y=d("stopParentInfo");function b(e){const t=e.getBoundingClientRect();return P(T),{x:Number(t.left)+Number(A.position.x),y:Number(t.top)+Number(A.position.y)}}function w(e){const t=e?b(k.iframe):{x:0,y:0};R(T,`Reposition requested from iFrame (offset x:${t.x} y:${t.y})`);const i=((e,t)=>({x:e.width+t.x,y:e.height+t.y}))(k,t),n=window.parentIframe||window.parentIFrame;n?function(t,i){t["scrollTo"+(e?"Offset":"")](i.x,i.y)}(n,i):function(e){A.position=e,v(T)}(i)}function v(e){const{x:t,y:i}=A.position,n=C[e]?.iframe;!1!==$("onScroll",{iframe:n,top:i,left:t,x:t,y:i})?B(e):q()}function z(e){let t={};if(0===k.width&&0===k.height){const e=l(9).split(":");t={x:e[1],y:e[0]}}else t={x:k.width,y:k.height};$(e,{iframe:k.iframe,screenX:Number(t.x),screenY:Number(t.y),type:k.type})}const $=(e,t)=>F(T,e,t);let j=i.data,k={},T=null;"[iFrameResizerChild]Ready"!==j?t===`${j}`.slice(0,13)&&j.slice(13).split(":")[0]in C?(k=function(){const e=j.slice(13).split(":"),t=e[1]?Number(e[1]):0,i=C[e[0]]?.iframe,n=getComputedStyle(i);return{iframe:i,id:e[0],height:t+s(n)+a(n),width:Number(e[2]),type:e[3],msg:e[4]}}(),T=k.id,I(T,k.type),T?(function(e){if(!C[e])throw new Error(`${k.type} No settings for ${e}. Message was: ${j}`)}(T),function(){const e=k.type in{true:1,false:1,undefined:1};return e&&R(T,"Ignoring init message from meta parent page"),e}()||(R(T,`Received: ${j}`),C[T].loaded=!0,(null!==k.iframe||(S(T,`The iframe (${k.id}) was not found.`),0))&&function(){const{origin:e,sameDomain:t}=i;if(t)return!0;let n=C[T]?.checkOrigin;if(n&&"null"!=`${e}`&&!(n.constructor===Array?function(){let t=0,i=!1;for(R(T,`Checking connection is from allowed list of origins: ${n}`);t<n.length;t++)if(n[t]===e){i=!0;break}return i}():function(){const t=C[T]?.remoteHost;return R(T,`Checking connection is from: ${t}`),e===t}()))throw new Error(`Unexpected message received from: ${e} for ${k.iframe.id}. Message was: ${i.data}. This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.`);return!0}()&&function(){switch(C[T]?.firstRun&&C[T]&&(C[T].firstRun=!1),k.type){case"close":H(k.iframe);break;case"message":i=l(6),R(T,`onMessage passed: {iframe: ${k.iframe.id}, message: ${i}}`),$("onMessage",{iframe:k.iframe,message:JSON.parse(i)});break;case"mouseenter":z("onMouseEnter");break;case"mouseleave":z("onMouseLeave");break;case"autoResize":C[T].autoResize=JSON.parse(l(9));break;case"scrollBy":!function(){const e=k.width,t=k.height,i=window.parentIframe||window.parentIFrame||window;R(T,`Scroll request received by parent: x: ${e} y: ${t}`),i.scrollBy(e,t)}();break;case"scrollTo":w(!1);break;case"scrollToOffset":w(!0);break;case"pageInfo":f("start",T),m();break;case"parentInfo":p("start",T),h();break;case"pageInfoStop":g();break;case"parentInfoStop":y();break;case"inPageLink":!function(e){const t=e.split("#")[1]||"",i=decodeURIComponent(t);let n=document.getElementById(i)||document.getElementsByName(i)[0];n?function(){const e=b(n);R(T,`Moving to in page link (#${t}) at x: ${e.x} y: ${e.y}`),A.position={x:e.x,y:e.y},v(T),window.location.hash=t,R(T,"--")}():window.top!==window.self?function(){const e=window.parentIframe||window.parentIFrame;e?e.moveToAnchor(t):R(T,`In page link #${t} not found and window.parentIframe not found`)}():R(T,`In page link #${t} not found`)}(l(9));break;case"title":!function(e,t){C[t]?.syncTitle&&(C[t].iframe.title=e,R(t,`Set title attribute to: ${e}`))}(k.msg,T);break;case"reset":Q(k);break;case"init":r(),function(e){try{C[e].sameDomain=!!C[e]?.iframe?.contentWindow?.iframeChildListener}catch(t){C[e].sameDomain=!1}R(e,`sameDomain: ${C[e].sameDomain}`)}(T),(t=k.msg)!==e&&(void 0!==t?R(T,`Version mismatch (Child: ${t} !== Parent: ${e})`):x(T,"<rb>Legacy version detected in iframe</>\n\nDetected legacy version of child page script. It is recommended to update the page in the iframe to use <b>@iframe-resizer/child</>.\n\nSee <u>https://iframe-resizer.com/setup/#child-page-setup</> for more details.\n")),G=!0,$("onReady",k.iframe);break;default:if(0===k.width&&0===k.height)return void S(T,`Unsupported message received (${k.type}), this is likely due to the iframe containing a later version of iframe-resizer than the parent page`);if(0===k.width||0===k.height)return void R(T,"Ignoring message with 0 height or width");if(document.hidden)return void R(T,"Page hidden - ignored resize request");r()}var t,i}())):S("","iframeResizer received messageData without id, message was: ",j)):null!==T&&R(T,"Ignored:",j):Object.keys(C).forEach((e=>{C[e].mode>=0&&U("iFrame requested init",V(e),e)}))}function F(e,t,i){let n=null,o=null;if(C[e]){if(n=C[e][t],"function"!=typeof n)throw new TypeError(`${t} on iFrame[${e}] is not a function`);if("onClose"===t||"onScroll"===t)try{o=n(i)}catch(i){console.error(i),S(e,`Error in ${t} callback`)}else setTimeout((()=>n(i)))}return o}function D(e){const{id:t}=e;R(t,"Disconnected from iframe"),delete C[t]}function H(e){const{id:t}=e;if(!1!==F(t,"onClose",t)){R(t,`Removing iFrame: ${t}`);try{e.parentNode&&e.remove()}catch(e){S(t,e)}F(t,"onClosed",t),D(e)}else R(t,"Close iframe cancelled by onClose event")}function P(e){null===A.position&&(A.position={x:window.scrollX,y:window.scrollY},R(e,`Get page position: ${A.position.x}, ${A.position.y}`))}function q(){A.position=null}function B(e){null!==A.position&&(window.scrollTo(A.position.x,A.position.y),R(e,`Set page position: ${A.position.x}, ${A.position.y}`),q())}function Q(e){R(e.id,"Size reset requested by "+("init"===e.type?"parent page":"child page")),P(e.id),J(e),U("reset","reset",e.id)}function J(e){function t(t){const n=`${e[t]}px`;e.iframe.style[t]=n,R(i,`Iframe (${i}) ${t} set to ${n}`)}const{id:i}=e,{sizeHeight:n,sizeWidth:o}=C[i];n&&t("height"),o&&t("width")}function U(e,i,n,o){I(n,e),C[n]&&(C[n]?.postMessageTarget?function(){const{iframe:e,postMessageTarget:o,sameDomain:r,targetOrigin:s}=C[n];if(r)try{return e.contentWindow.iframeChildListener(t+i),void R(n,`Sending message to iframe[${n}] (${i}) via sameDomain`)}catch(e){R(n,"Same domain connection failed. Trying cross domain")}R(n,`Sending message to iframe[${n}] (${i}) targetOrigin: ${s}`),o.postMessage(t+i,s)}():S(n,`Iframe(${n}) not found`),o&&C[n]?.warningTimeout&&(C[n].msgTimeout=setTimeout((function(){if(void 0===C[n])return;const{iframe:e,loaded:t,loadErrorShown:i,waitForLoad:o}=C[n],{sandbox:r}=e;t||i||(C[n].loadErrorShown=!0,x(n,`<rb>No response from iFrame</>\n \nThe iframe (<i>${n}</>) has not responded within ${C[n].warningTimeout/1e3} seconds. Check <b>@iframe-resizer/child</> package has been loaded in the iframe.\n${o?"\nThe <b>waitForLoad</> option is currently set to <i>'true'</>. If the iframe loads before the JavaScript runs, this option will prevent <i>iframe-resizer</> from initialising. To disable this, set the <b>waitForLoad</> option to <i>'false'</>. \n":""}${!(r?.length>0)||r.contains("allow-scripts")&&r.contains("allow-same-origin")?"":"\nThe iframe has the <b>sandbox</> attribute, please ensure it contains both the <i>'allow-same-origin'</> and <i>'allow-scripts'</> values.\n"} \n${!(r?.length>0)||r.contains("allow-scripts")&&r.contains("allow-same-origin")?"":"The iframe has the <b>sandbox</> attribute, please ensure it contains both the <i>'allow-same-origin'</> and <i>'allow-scripts'</> values.\n"}This message can be ignored if everything is working, or you can set the <b>warningTimeout</> option to a higher value or zero to suppress this warning.\n`))}),C[n].warningTimeout)))}function V(e){const t=C[e];return[e,"8",t.sizeWidth,t.log,"32",!0,t.autoResize,t.bodyMargin,t.heightCalculationMethod,t.bodyBackground,t.bodyPadding,t.tolerance,t.inPageLinks,"child",t.widthCalculationMethod,t.mouseEvents,t.offsetHeight,t.offsetWidth,t.sizeHeight,t.license,A.version,t.mode].join(":")}$=C;let Z=0,G=!1,X=!1;const Y=t=>o=>{function r(e){if(!e)return{};if("object"!=typeof e)throw new TypeError("Options is not an object");return("sizeWidth"in e||"sizeHeight"in e||"autoResize"in e)&&x(f,'<rb>Deprecated Option</>\n\nThe <b>sizeWidth</>, <b>sizeHeight</> and <b>autoResize</> options have been replaced with new <b>direction</> option which expects values of <i>"vertical"</>, <i>"horizontal"</> or <i>"horizontal"</>.\n'),e}function a(e){const t=C[e]?.iframe?.title;return""===t||void 0===t}const c=e=>Object.hasOwn(e,"onMouseEnter")||Object.hasOwn(e,"onMouseLeave");const f=function(e){if(e&&"string"!=typeof e)throw new TypeError("Invalid id for iFrame. Expected String");return""!==e&&e||(e=function(){let e=t?.id||L.id+Z++;return null!==document.getElementById(e)&&(e+=Z++),e}(),o.id=e,R(e,`Added missing iframe ID: ${e} (${o.src})`)),e}(o.id);return function({enabled:e,iframeId:t}){j=e,$[t]||($[t]={console:v({label:k(t)})})}({enabled:Object.hasOwn(t,"log")?t.log:L.log,iframeId:f}),"iframeResizer"in o?S(f,`Ignored iframe (${f}), already setup.`):(function(e){var t,i;C[f]={...C[f],iframe:o,firstRun:!0,remoteHost:o?.src.split("/").slice(0,3).join("/"),...L,...r(e),mouseEvents:c(e),mode:d(e),syncTitle:a(f)},I(f,"setup"),function(){const{direction:e}=C[f];if("horizontal"===e)return C[f].sizeWidth=!0,C[f].sizeHeight=!1,void R(f,'Direction set to "horizontal"');if("none"===e)return C[f].sizeWidth=!1,C[f].sizeHeight=!1,C[f].autoResize=!1,void R(f,'Direction set to "none"');if("vertical"!==e)throw new TypeError(f,`Direction value of "${e}" is not valid`);R(f,'Direction set to "vertical"')}(),(t=e?.offsetSize||e?.offset)&&("vertical"===C[f].direction?(C[f].offsetHeight=t,R(f,`Offset height set to ${t}`)):(C[f].offsetWidth=t,R(f,`Offset width set to ${t}`))),e?.offset&&x(f,"<rb>Deprecated option</>\n\n The <b>offset</> option has been renamed to <b>offsetSize</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>."),null===C[f].postMessageTarget&&(C[f].postMessageTarget=o.contentWindow),C[f].targetOrigin=!0===C[f].checkOrigin?""===(i=C[f].remoteHost)||null!==i.match(/^(about:blank|javascript:|file:\/\/)/)?"*":i:"*"}(t),function(){const{mode:t}=C[f];t<0&&x("Parent",`${u(t+2)}${u(2)}`),X||t<0||(X=!0,function(e,t){"iframeResizer"in window||(window.iframeResizer={version:e}),!j&&t>0||queueMicrotask((()=>console.info(`%ciframe-resizer ${e}`,"font-weight: bold;")))}(`v${e} (${(e=>s(l[e]))(t)})`,t),t<1&&x("Parent",u(3)))}(),_(),function(){switch(R(f,`Iframe scrolling ${C[f]?.scrolling?"enabled":"disabled"} for ${f}`),o.style.overflow=!1===C[f]?.scrolling?"hidden":"auto",C[f]?.scrolling){case"omit":break;case!0:o.scrolling="yes";break;case!1:o.scrolling="no";break;default:o.scrolling=C[f]?C[f].scrolling:"no"}}(),function(){const{bodyMargin:e}=C[f];"number"!=typeof e&&"0"!==e||(C[f].bodyMargin=`${e}px`)}(),function(e){const{id:t}=o,{mode:r,waitForLoad:s}=C[t];-1!==r&&-2!==r&&(n(o,"load",(function(){U("iFrame.onload",`${e}:${G}`,t,!0),function(){const e=C[f]?.firstRun,t=C[f]?.heightCalculationMethod in i;!e&&t&&Q({iframe:o,height:0,width:0,type:"init"})}()})),!1===s&&U("init",`${e}:${G}`,t,!0))}(V(f)),function(){if(C[f]){const{iframe:e}=C[f],t={close:H.bind(null,e),disconnect:D.bind(null,e),removeListeners(){x(f,"\n<rb>Deprecated Method Name</>\n\nThe [removeListeners()</> method has been renamed to [disconnect()</>.\n"),this.disconnect()},resize:U.bind(null,"Window resize","resize",f),moveToAnchor(e){U("Move to anchor",`moveToAnchor:${e}`,f)},sendMessage(e){U("message",`message:${e=JSON.stringify(e)}`,f)}};e.iframeResizer=t,e.iFrameResizer=t}}()),o?.iFrameResizer};function K(){!1===document.hidden&&(R("document","Trigger event: Visibility change"),function(e,t){const i=e=>C[e]?.autoResize&&!C[e]?.firstRun;Object.keys(C).forEach((function(n){i(n)&&U(e,t,n)}))}("Tab Visible","resize"))}const _=(e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}})((()=>{n(window,"message",N),n(document,"visibilitychange",K),window.iframeParentListener=e=>setTimeout((()=>N({data:e,sameDomain:!0})))}));switch(!0){case void 0===window.jQuery:S("","Unable to bind to jQuery, it is not available.");break;case!window.jQuery.fn:S("","Unable to bind to jQuery, it is not fully loaded.");break;case window.jQuery.fn.iframeResize:S("","iframeResize is already assigned to jQuery.fn.");break;default:window.jQuery.fn.iframeResize=function(e){const t=Y(e);return this.filter("iframe").each(((e,i)=>t(i))).end()},window.jQuery.fn.iFrameResize=function(e){return E("iFrameResize()","iframeResize()","","jQuery"),this.iframeResize(e)}}}));
|
|
21
21
|
//# sourceMappingURL=index.umd.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iframe-resizer/jquery",
|
|
3
|
-
"version": "5.4.0-beta.
|
|
3
|
+
"version": "5.4.0-beta.3",
|
|
4
4
|
"license": "GPL-3.0",
|
|
5
5
|
"homepage": "https://iframe-resizer.com",
|
|
6
6
|
"author": {
|
|
@@ -39,6 +39,6 @@
|
|
|
39
39
|
"jquery"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@iframe-resizer/core": "5.4.0-beta.
|
|
42
|
+
"@iframe-resizer/core": "5.4.0-beta.3"
|
|
43
43
|
}
|
|
44
44
|
}
|