diff --git a/dist/cjs/extension.js b/dist/cjs/extension.js index 85189748be..8809e19a1a 100644 --- a/dist/cjs/extension.js +++ b/dist/cjs/extension.js @@ -1,3 +1,3 @@ /*! For license information please see extension.js.LICENSE.txt */ -(()=>{var n={3347(n,t,e){"use strict";n.exports=e(344)},5990(n){!function(t){"use strict";if("undefined"!=typeof window){var e=!0,r="",i=0,o="",u=null,a="",c=!1,f={resize:1,click:1},s=128,l=!0,h=1,p="bodyOffset",d=p,v=!0,g="",y={},_=32,m=null,b=!1,w="[iFrameSizer]",E="",x={max:1,min:1,bodyScroll:1,documentElementScroll:1},O="child",S=!0,T=window.parent,I="*",A=0,k=!1,j=null,R=16,N=1,C="scroll",z=C,M=window,L=function(){an("MessageCallback function not defined")},P=function(){},F=function(){},W={height:function(){return an("Custom height calculation function not defined"),document.documentElement.offsetHeight},width:function(){return an("Custom width calculation function not defined"),document.body.scrollWidth}},D={},U=!1;try{var B=Object.create({},{passive:{get:function(){U=!0}},once:{get:function(){}}});window.addEventListener("test",nn,B),window.removeEventListener("test",nn,B)}catch(n){}var H,$,q,V,G,X,Y,K=Date.now||function(){return(new Date).getTime()},Z={bodyOffset:function(){return document.body.offsetHeight+_n("marginTop")+_n("marginBottom")},offset:function(){return Z.bodyOffset()},bodyScroll:function(){return document.body.scrollHeight},custom:function(){return W.height()},documentElementOffset:function(){return document.documentElement.offsetHeight},documentElementScroll:function(){return document.documentElement.scrollHeight},max:function(){return Math.max.apply(null,bn(Z))},min:function(){return Math.min.apply(null,bn(Z))},grow:function(){return Z.max()},lowestElement:function(){return Math.max(Z.bodyOffset()||Z.documentElementOffset(),mn("bottom",En()))},taggedElement:function(){return wn("bottom","data-iframe-height")}},J={bodyScroll:function(){return document.body.scrollWidth},bodyOffset:function(){return document.body.offsetWidth},custom:function(){return W.width()},documentElementScroll:function(){return document.documentElement.scrollWidth},documentElementOffset:function(){return document.documentElement.offsetWidth},scroll:function(){return Math.max(J.bodyScroll(),J.documentElementScroll())},max:function(){return Math.max.apply(null,bn(J))},min:function(){return Math.min.apply(null,bn(J))},rightMostElement:function(){return mn("right",En())},taggedElement:function(){return wn("right","data-iframe-width")}},Q=(H=xn,G=null,X=0,Y=function(){X=K(),G=null,V=H.apply($,q),G||($=q=null)},function(){var n=K();X||(X=n);var t=R-(n-X);return $=this,q=arguments,t<=0||t>R?(G&&(clearTimeout(G),G=null),X=n,V=H.apply($,q),G||($=q=null)):G||(G=setTimeout(Y,t)),V});tn(window,"message",kn),tn(window,"readystatechange",jn),jn()}function nn(){}function tn(n,t,e,r){"addEventListener"in window?n.addEventListener(t,e,!!U&&(r||{})):"attachEvent"in window&&n.attachEvent("on"+t,e)}function en(n,t,e){"removeEventListener"in window?n.removeEventListener(t,e,!1):"detachEvent"in window&&n.detachEvent("on"+t,e)}function rn(n){return n.charAt(0).toUpperCase()+n.slice(1)}function on(n){return w+"["+E+"] "+n}function un(n){b&&"object"==typeof window.console&&console.log(on(n))}function an(n){"object"==typeof window.console&&console.warn(on(n))}function cn(){var n,u;!function(){function n(n){return"true"===n}var u=g.substr(13).split(":");E=u[0],i=t!==u[1]?Number(u[1]):i,c=t!==u[2]?n(u[2]):c,b=t!==u[3]?n(u[3]):b,_=t!==u[4]?Number(u[4]):_,e=t!==u[6]?n(u[6]):e,o=u[7],d=t!==u[8]?u[8]:d,r=u[9],a=u[10],A=t!==u[11]?Number(u[11]):A,y.enable=t!==u[12]&&n(u[12]),O=t!==u[13]?u[13]:O,z=t!==u[14]?u[14]:z}(),un("Initialising iFrame ("+location.href+")"),function(){function n(n,t){return"function"==typeof n&&(un("Setup custom "+t+"CalcMethod"),W[t]=n,n="custom"),n}var t;"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(t=window.iFrameResizer,un("Reading data from page: "+JSON.stringify(t)),L="messageCallback"in t?t.messageCallback:L,P="readyCallback"in t?t.readyCallback:P,I="targetOrigin"in t?t.targetOrigin:I,d="heightCalculationMethod"in t?t.heightCalculationMethod:d,z="widthCalculationMethod"in t?t.widthCalculationMethod:z,d=n(d,"height"),z=n(z,"width")),un("TargetOrigin for parent set to: "+I)}(),t===o&&(o=i+"px"),fn("margin",(-1!==(u=o).indexOf("-")&&(an("Negative CSS value ignored for margin"),u=""),u)),fn("background",r),fn("padding",a),(n=document.createElement("div")).style.clear="both",n.style.display="block",document.body.appendChild(n),pn(),dn(),document.documentElement.style.height="",document.body.style.height="",un('HTML & body height set to "auto"'),un("Enable public methods"),M.parentIFrame={autoResize:function(n){return!0===n&&!1===e?(e=!0,vn()):!1===n&&!0===e&&(e=!1,gn()),e},close:function(){An(0,0,"close"),un("Disable outgoing messages"),S=!1,un("Remove event listener: Message"),en(window,"message",kn),!0===e&&gn()},getId:function(){return E},getPageInfo:function(n){"function"==typeof n?(F=n,An(0,0,"pageInfo")):(F=function(){},An(0,0,"pageInfoStop"))},moveToAnchor:function(n){y.findTarget(n)},reset:function(){In("parentIFrame.reset")},scrollTo:function(n,t){An(t,n,"scrollTo")},scrollToOffset:function(n,t){An(t,n,"scrollToOffset")},sendMessage:function(n,t){An(0,0,"message",JSON.stringify(n),t)},setHeightCalculationMethod:function(n){d=n,pn()},setWidthCalculationMethod:function(n){z=n,dn()},setTargetOrigin:function(n){un("Set targetOrigin: "+n),I=n},size:function(n,t){On("size","parentIFrame.size("+(n||"")+(t?","+t:"")+")",n,t)}},vn(),y=function(){function n(n){var e=n.getBoundingClientRect(),r={x:window.pageXOffset!==t?window.pageXOffset:document.documentElement.scrollLeft,y:window.pageYOffset!==t?window.pageYOffset:document.documentElement.scrollTop};return{x:parseInt(e.left,10)+parseInt(r.x,10),y:parseInt(e.top,10)+parseInt(r.y,10)}}function e(e){var r=e.split("#")[1]||e,i=decodeURIComponent(r),o=document.getElementById(i)||document.getElementsByName(i)[0];t!==o?function(t){var e=n(t);un("Moving to in page link (#"+r+") at x: "+e.x+" y: "+e.y),An(e.y,e.x,"scrollToOffset")}(o):(un("In page link (#"+r+") not found in iFrame, so sending to parent"),An(0,0,"inPageLink","#"+r))}function r(){""!==location.hash&&"#"!==location.hash&&e(location.href)}return y.enable?Array.prototype.forEach&&document.querySelectorAll?(un("Setting up location.hash handlers"),Array.prototype.forEach.call(document.querySelectorAll('a[href^="#"]'),function(n){"#"!==n.getAttribute("href")&&tn(n,"click",function(n){n.preventDefault(),e(this.getAttribute("href"))})}),tn(window,"hashchange",r),setTimeout(r,s)):an("In page linking not fully supported in this browser! (See README.md for IE8 workaround)"):un("In page linking not enabled"),{findTarget:e}}(),On("init","Init message from host page"),P()}function fn(n,e){t!==e&&""!==e&&"null"!==e&&(document.body.style[n]=e,un("Body "+n+' set to "'+e+'"'))}function sn(n){var t={add:function(t){function e(){On(n.eventName,n.eventType)}D[t]=e,tn(window,t,e,{passive:!0})},remove:function(n){var t=D[n];delete D[n],en(window,n,t)}};n.eventNames&&Array.prototype.map?(n.eventName=n.eventNames[0],n.eventNames.map(t[n.method])):t[n.method](n.eventName),un(rn(n.method)+" event listener: "+n.eventType)}function ln(n){sn({method:n,eventType:"Animation Start",eventNames:["animationstart","webkitAnimationStart"]}),sn({method:n,eventType:"Animation Iteration",eventNames:["animationiteration","webkitAnimationIteration"]}),sn({method:n,eventType:"Animation End",eventNames:["animationend","webkitAnimationEnd"]}),sn({method:n,eventType:"Input",eventName:"input"}),sn({method:n,eventType:"Mouse Up",eventName:"mouseup"}),sn({method:n,eventType:"Mouse Down",eventName:"mousedown"}),sn({method:n,eventType:"Orientation Change",eventName:"orientationchange"}),sn({method:n,eventType:"Print",eventName:["afterprint","beforeprint"]}),sn({method:n,eventType:"Ready State Change",eventName:"readystatechange"}),sn({method:n,eventType:"Touch Start",eventName:"touchstart"}),sn({method:n,eventType:"Touch End",eventName:"touchend"}),sn({method:n,eventType:"Touch Cancel",eventName:"touchcancel"}),sn({method:n,eventType:"Transition Start",eventNames:["transitionstart","webkitTransitionStart","MSTransitionStart","oTransitionStart","otransitionstart"]}),sn({method:n,eventType:"Transition Iteration",eventNames:["transitioniteration","webkitTransitionIteration","MSTransitionIteration","oTransitionIteration","otransitioniteration"]}),sn({method:n,eventType:"Transition End",eventNames:["transitionend","webkitTransitionEnd","MSTransitionEnd","oTransitionEnd","otransitionend"]}),"child"===O&&sn({method:n,eventType:"IFrame Resized",eventName:"resize"})}function hn(n,t,e,r){return t!==n&&(n in e||(an(n+" is not a valid option for "+r+"CalculationMethod."),n=t),un(r+' calculation method set to "'+n+'"')),n}function pn(){d=hn(d,p,Z,"height")}function dn(){z=hn(z,C,J,"width")}function vn(){var n;!0===e?(ln("add"),n=0>_,window.MutationObserver||window.WebKitMutationObserver?n?yn():u=function(){function n(n){function t(n){!1===n.complete&&(un("Attach listeners to "+n.src),n.addEventListener("load",i,!1),n.addEventListener("error",o,!1),a.push(n))}"attributes"===n.type&&"src"===n.attributeName?t(n.target):"childList"===n.type&&Array.prototype.forEach.call(n.target.querySelectorAll("img"),t)}function e(n){un("Remove listeners from "+n.src),n.removeEventListener("load",i,!1),n.removeEventListener("error",o,!1),function(n){a.splice(a.indexOf(n),1)}(n)}function r(n,r,i){e(n.target),On(r,i+": "+n.target.src,t,t)}function i(n){r(n,"imageLoad","Image loaded")}function o(n){r(n,"imageLoadFailed","Image load failed")}function u(t){On("mutationObserver","mutationObserver: "+t[0].target+" "+t[0].type),t.forEach(n)}var a=[],c=window.MutationObserver||window.WebKitMutationObserver,f=function(){var n=document.querySelector("body");return f=new c(u),un("Create body MutationObserver"),f.observe(n,{attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0}),f}();return{disconnect:function(){"disconnect"in f&&(un("Disconnect body MutationObserver"),f.disconnect(),a.forEach(e))}}}():(un("MutationObserver not supported in this browser!"),yn())):un("Auto Resize disabled")}function gn(){ln("remove"),null!==u&&u.disconnect(),clearInterval(m)}function yn(){0!==_&&(un("setInterval: "+_+"ms"),m=setInterval(function(){On("interval","setInterval: "+_)},Math.abs(_)))}function _n(n,t){var e=0;return t=t||document.body,e="defaultView"in document&&"getComputedStyle"in document.defaultView?null!==(e=document.defaultView.getComputedStyle(t,null))?e[n]:0:function(n){if(/^\d+(px)?$/i.test(n))return parseInt(n,10);var e=t.style.left,r=t.runtimeStyle.left;return t.runtimeStyle.left=t.currentStyle.left,t.style.left=n||0,n=t.style.pixelLeft,t.style.left=e,t.runtimeStyle.left=r,n}(t.currentStyle[n]),parseInt(e,10)}function mn(n,t){for(var e=t.length,r=0,i=0,o=rn(n),u=K(),a=0;ai&&(i=r);return u=K()-u,un("Parsed "+e+" HTML elements"),un("Element position calculated in "+u+"ms"),function(n){n>R/2&&un("Event throttle increased to "+(R=2*n)+"ms")}(u),i}function bn(n){return[n.bodyOffset(),n.bodyScroll(),n.documentElementOffset(),n.documentElementScroll()]}function wn(n,t){var e=document.querySelectorAll("["+t+"]");return 0===e.length&&(an("No tagged elements ("+t+") found on page"),document.querySelectorAll("body *")),mn(n,e)}function En(){return document.querySelectorAll("body *")}function xn(n,e,r,i){var o,u;!function(){function n(n,t){return!(Math.abs(n-t)<=A)}return o=t!==r?r:Z[d](),u=t!==i?i:J[z](),n(h,o)||c&&n(N,u)}()&&"init"!==n?!(n in{init:1,interval:1,size:1})&&(d in x||c&&z in x)?In(e):n in{interval:1}||un("No change in size detected"):(Sn(),An(h=o,N=u,n))}function On(n,t,e,r){k&&n in f?un("Trigger event cancelled: "+n):(n in{reset:1,resetPage:1,init:1}||un("Trigger event: "+t),"init"===n?xn(n,t,e,r):Q(n,t,e,r))}function Sn(){k||(k=!0,un("Trigger event lock on")),clearTimeout(j),j=setTimeout(function(){k=!1,un("Trigger event lock off"),un("--")},s)}function Tn(n){h=Z[d](),N=J[z](),An(h,N,n)}function In(n){var t=d;d=p,un("Reset trigger event: "+n),Sn(),Tn("reset"),d=t}function An(n,e,r,i,o){var u;!0===S&&(t===o?o=I:un("Message targetOrigin: "+o),un("Sending message to host page ("+(u=E+":"+n+":"+e+":"+r+(t!==i?":"+i:""))+")"),T.postMessage(w+u,o))}function kn(t){var e,r={init:function(){g=t.data,T=t.source,cn(),l=!1,setTimeout(function(){v=!1},s)},reset:function(){v?un("Page reset ignored by init"):(un("Page size reset by host page"),Tn("resetPage"))},resize:function(){On("resizeParent","Parent window requested size check")},moveToAnchor:function(){y.findTarget(o())},inPageLink:function(){this.moveToAnchor()},pageInfo:function(){var n=o();un("PageInfoFromParent called from parent: "+n),F(JSON.parse(n)),un(" --")},message:function(){var n=o();un("MessageCallback called from parent: "+n),L(JSON.parse(n)),un(" --")}};function i(){return t.data.split("]")[1].split(":")[0]}function o(){return t.data.substr(t.data.indexOf(":")+1)}function u(){return t.data.split(":")[2]in{true:1,false:1}}w===(""+t.data).substr(0,13)&&(!1===l?(e=i())in r?r[e]():!n.exports&&"iFrameResize"in window||"jQuery"in window&&"iFrameResize"in window.jQuery.prototype||u()||an("Unexpected message ("+t.data+")"):u()?r.init():un('Ignored message of type "'+i()+'". Received before initialization.'))}function jn(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}}()},7521(n){!function(t){"use strict";if("undefined"!=typeof window){var e,r=0,i=!1,o=!1,u="[iFrameSizer]",a=null,c=window.requestAnimationFrame,f={max:1,scroll:1,bodyScroll:1,documentElementScroll:1},s={},l=null,h={autoResize:!0,bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!0,inPageLinks:!1,enablePublicMethods:!0,heightCalculationMethod:"bodyOffset",id:"iFrameResizer",interval:32,log:!1,maxHeight:1/0,maxWidth:1/0,minHeight:0,minWidth:0,resizeFrom:"parent",scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,widthCalculationMethod:"scroll",closedCallback:function(){},initCallback:function(){},messageCallback:function(){b("MessageCallback function not defined")},resizedCallback:function(){},scrollCallback:function(){return!0}},p={};window.jQuery&&((e=window.jQuery).fn?e.fn.iFrameResize||(e.fn.iFrameResize=function(n){return this.filter("iframe").each(function(t,e){z(e,n)}).end()}):m("","Unable to bind to jQuery, it is not fully loaded.")),"function"==typeof define&&define.amd?define([],W):"object"==typeof n.exports&&(n.exports=W()),window.iFrameResize=window.iFrameResize||W()}function d(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function v(n,t,e){"addEventListener"in window?n.addEventListener(t,e,!1):"attachEvent"in window&&n.attachEvent("on"+t,e)}function g(n,t,e){"removeEventListener"in window?n.removeEventListener(t,e,!1):"detachEvent"in window&&n.detachEvent("on"+t,e)}function y(n){return s[n]?s[n].log:i}function _(n,t){w("log",n,t,y(n))}function m(n,t){w("info",n,t,y(n))}function b(n,t){w("warn",n,t,!0)}function w(n,t,e,r){!0===r&&"object"==typeof window.console&&console[n](function(n){return u+"["+function(n){var t="Host page: "+n;return window.top!==window.self&&(t=window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+n:"Nested host page: "+n),t}(n)+"]"}(t),e)}function E(n){function t(){e("Height"),e("Width"),R(function(){j(E),I(O),l("resizedCallback",E)},E,"init")}function e(n){var t=Number(s[O]["max"+n]),e=Number(s[O]["min"+n]),r=n.toLowerCase(),i=Number(E[r]);_(O,"Checking "+r+" is in range "+e+"-"+t),it&&(i=t,_(O,"Set "+r+" to max value")),E[r]=""+i}function r(n){return w.substr(w.indexOf(":")+7+n)}function i(n,t){var e,r;e=function(){var e,r;N("Send Page Info","pageInfo:"+(e=document.body.getBoundingClientRect(),r=E.iframe.getBoundingClientRect(),JSON.stringify({iframeHeight:r.height,iframeWidth:r.width,clientHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),offsetTop:parseInt(r.top-e.top,10),offsetLeft:parseInt(r.left-e.left,10),scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset})),n,t)},p[r=t]||(p[r]=setTimeout(function(){p[r]=null,e()},32))}function o(n){var t=n.getBoundingClientRect();return T(O),{x:Math.floor(Number(t.left)+Number(a.x)),y:Math.floor(Number(t.top)+Number(a.y))}}function c(n){var t=n?o(E.iframe):{x:0,y:0},e={x:Number(E.width)+t.x,y:Number(E.height)+t.y};_(O,"Reposition requested from iFrame (offset x:"+t.x+" y:"+t.y+")"),window.top!==window.self?window.parentIFrame?window.parentIFrame["scrollTo"+(n?"Offset":"")](e.x,e.y):b(O,"Unable to scroll to requested position, window.parentIFrame not found"):(a=e,f(),_(O,"--"))}function f(){!1!==l("scrollCallback",a)?I(O):A()}function l(n,t){return x(O,n,t)}var h,d,y,w=n.data,E={},O=null;"[iFrameResizerChild]Ready"===w?function(){for(var n in s)N("iFrame requested init",C(n),document.getElementById(n),n)}():u===(""+w).substr(0,13)&&w.substr(13).split(":")[0]in s?(y=w.substr(13).split(":"),E={iframe:s[y[0]]&&s[y[0]].iframe,id:y[0],height:y[1],width:y[2],type:y[3]},O=E.id,s[O]&&(s[O].loaded=!0),(d=E.type in{true:1,false:1,undefined:1})&&_(O,"Ignoring init message from meta parent page"),!d&&function(n){var t=!0;return s[n]||(t=!1,b(E.type+" No settings for "+n+". Message was: "+w)),t}(O)&&(_(O,"Received: "+w),h=!0,null===E.iframe&&(b(O,"IFrame ("+E.id+") not found"),h=!1),h&&function(){var t,e=n.origin,r=s[O]&&s[O].checkOrigin;if(r&&""+e!="null"&&!(r.constructor===Array?function(){var n=0,t=!1;for(_(O,"Checking connection is from allowed list of origins: "+r);ns[a]["max"+n])throw new Error("Value for min"+n+" can not be greater than max"+n)}e("Height"),e("Width"),t("maxHeight"),t("minHeight"),t("maxWidth"),t("minWidth")}(),"number"!=typeof(s[a]&&s[a].bodyMargin)&&"0"!==(s[a]&&s[a].bodyMargin)||(s[a].bodyMarginV1=s[a].bodyMargin,s[a].bodyMargin=s[a].bodyMargin+"px"),o=C(a),(u=d())&&function(t){n.parentNode&&new t(function(t){t.forEach(function(t){Array.prototype.slice.call(t.removedNodes).forEach(function(t){t===n&&S(n)})})}).observe(n.parentNode,{childList:!0})}(u),v(n,"load",function(){var e,r;N("iFrame.onload",o,n,t,!0),e=s[a]&&s[a].firstRun,r=s[a]&&s[a].heightCalculationMethod in f,!e&&r&&k({iframe:n,height:0,width:0,type:"init"})}),N("init",o,n,t,!0),Function.prototype.bind&&s[a]&&(s[a].iframe.iFrameResizer={close:S.bind(null,s[a].iframe),removeListeners:O.bind(null,s[a].iframe),resize:N.bind(null,"Window resize","resize",s[a].iframe),moveToAnchor:function(n){N("Move to anchor","moveToAnchor:"+n,s[a].iframe,a)},sendMessage:function(n){N("Send Message","message:"+(n=JSON.stringify(n)),s[a].iframe,a)}}))}function M(n,t){null===l&&(l=setTimeout(function(){l=null,n()},t))}function L(n){_("window","Trigger event: "+n),M(function(){F("Window "+n,"resize")},16)}function P(){"hidden"!==document.visibilityState&&(_("document","Trigger event: Visiblity change"),M(function(){F("Tab Visable","resize")},16))}function F(n,t){function e(n){return s[n]&&"parent"===s[n].resizeFrom&&s[n].autoResize&&!s[n].firstRun}for(var r in s)e(r)&&N(n,t,document.getElementById(r),r)}function W(){function n(n,t){t&&(function(){if(!t.tagName)throw new TypeError("Object is not a valid DOM element");if("IFRAME"!==t.tagName.toUpperCase())throw new TypeError("Expected