opnform-host-nginx/client/public/widgets/iframe.min.js

2 lines
14 KiB
JavaScript
Raw Normal View History

2024-06-27 17:06:19 +02:00
!function(e){var n,t,i,o,r,a,s,f,l,c,d,u,m,g;function h(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function p(e,n,t){e.addEventListener(n,t,!1)}function b(e,n,t){e.removeEventListener(n,t,!1)}function y(e){return c[e]?c[e].log:t}function v(e,n){_("log",e,n,y(e))}function $(e,n){_("info",e,n,y(e))}function w(e,n){_("warn",e,n,!0)}function _(e,n,t,i){var o,a;!0===i&&"object"==typeof window.console&&console[e](r+"["+(a="Host page: "+(o=n),a=window.top!==window.self?window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+o:"Nested host page: "+o:a)+"]",t)}function x(e){function n(){t("Height"),t("Width"),W(function(){O(L),I(j),h("onResized",L)},L,"init")}function t(e){var n=Number(c[j]["max"+e]),t=Number(c[j]["min"+e]),e=e.toLowerCase(),i=Number(L[e]);v(j,"Checking "+e+" is in range "+t+"-"+n),i<t&&(i=t,v(j,"Set "+e+" to min value")),n<i&&(i=n,v(j,"Set "+e+" to max value")),L[e]=""+i}function i(e){return P.slice(P.indexOf(":")+o+e)}function f(e,n){var t,i,o;t=function(){var t,i;T("Send Page Info","pageInfo:"+(t=document.body.getBoundingClientRect(),JSON.stringify({iframeHeight:(i=L.iframe.getBoundingClientRect()).height,iframeWidth:i.width,clientHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),offsetTop:parseInt(i.top-t.top,10),offsetLeft:parseInt(i.left-t.left,10),scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,documentHeight:document.documentElement.clientHeight,documentWidth:document.documentElement.clientWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth})),e,n)},i=32,m[o=n]||(m[o]=setTimeout(function(){m[o]=null,t()},i))}function l(e){return e=e.getBoundingClientRect(),M(j),{x:Math.floor(Number(e.left)+Number(s.x)),y:Math.floor(Number(e.top)+Number(s.y))}}function d(e){var n=e?l(L.iframe):{x:0,y:0},t={x:Number(L.width)+n.x,y:Number(L.height)+n.y};v(j,"Reposition requested from iFrame (offset x:"+n.x+" y:"+n.y+")"),window.top===window.self?(s=t,u(),v(j,"--")):window.parentIFrame?window.parentIFrame["scrollTo"+(e?"Offset":"")](t.x,t.y):w(j,"Unable to scroll to requested position, window.parentIFrame not found")}function u(){!1===h("onScroll",s)?R():I(j)}function g(e){var n,t={};t=0===Number(L.width)&&0===Number(L.height)?{x:(n=i(9).split(":"))[1],y:n[0]}:{x:L.width,y:L.height},h(e,{iframe:L.iframe,screenX:Number(t.x),screenY:Number(t.y),type:L.type})}function h(e,n){return k(j,e,n)}var y,_,x,F,H,S,P=e.data,L={},j=null;if("[iFrameResizerChild]Ready"===P)for(var A in c)T("iFrame requested init",C(A),c[A].iframe,A);else r===(""+P).slice(0,a)&&P.slice(a).split(":")[0]in c?(c[j=(L=(_=(y=P.slice(a).split(":"))[1]?parseInt(y[1],10):0,F=getComputedStyle(x=c[y[0]]&&c[y[0]].iframe),{iframe:x,id:y[0],height:_+function(e){if("border-box"!==e.boxSizing)return 0;var n=e.paddingTop?parseInt(e.paddingTop,10):0,e=e.paddingBottom?parseInt(e.paddingBottom,10):0;return n+e}(F)+function(e){if("border-box"!==e.boxSizing)return 0;var n=e.borderTopWidth?parseInt(e.borderTopWidth,10):0,e=e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0;return n+e}(F),width:y[2],type:y[3]})).id]&&(c[j].loaded=!0),(S=L.type in{true:1,false:1,undefined:1})&&v(j,"Ignoring init message from meta parent page"),!S&&(S=!0,c[H=j]||(S=!1,w(L.type+" No settings for "+H+". Message was: "+P)),S)&&(v(j,"Received: "+P),H=!0,null===L.iframe&&(w(j,"IFrame ("+L.id+") not found"),H=!1),H&&function n(){var t=e.origin,i=c[j]&&c[j].checkOrigin;if(i&&""+t!="null"&&!function(){if(i.constructor!==Array)return e=c[j]&&c[j].remoteHost,v(j,"Checking connection is from: "+e),t===e;var e,n=0,o=!1;for(v(j,"Checking connection is from allowed list of origins: "+i);n<i.length;n++)if(i[n]===t){o=!0;break}return o}())throw Error("Unexpected message received from: "+t+" for "+L.iframe.id+". Message was: "+e.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return 1}()&&function e(){var t,o,r,a;switch(c[j]&&c[j].fir