1/* 2 iFrame Resizer (iframeSizer.min.js ) - v3.5.0 - 2015-10-26 3 Desc: Force cross domain iframes to size to content. 4 Requires: iframeResizer.contentWindow.min.js to be loaded into the target frame. 5 Copyright: (c) 2015 David J. Bradshaw - [email protected] 6 License: MIT 7*/ 8!function(h){function z(a,c,g){"addEventListener"in h?a.addEventListener(c,g,!1):"attachEvent"in h&&a.attachEvent("on"+c,g)}function ha(a,c,g){"removeEventListener"in h?a.removeEventListener(c,g,!1):"detachEvent"in h&&a.detachEvent("on"+c,g)}function ia(){var a,c=["moz","webkit","o","ms"];for(a=0;a<c.length&&!E;a+=1)E=h[c[a]+"RequestAnimationFrame"];E||m("setup","RequestAnimationFrame not supported")}function m(a,c){H("log",a,c,b[a]?b[a].log:I)}function F(a,c){H("warn",a,c,!0)}function H(a,c,g,e){if(!0=== 9e&&"object"==typeof h.console){e=console;a=e[a];var q=J+"[",B="Host page: "+c;c=(h.top!==h.self&&(B=h.parentIFrame&&h.parentIFrame.getId?h.parentIFrame.getId()+": "+c:"Nested host page: "+c),B);a.call(e,q+c+"]",g)}}function ja(a){function c(){e("Height");e("Width");Q(function(){R(p);S(f)},p,"init")}function g(){var d=x.substr(M).split(":");return{iframe:b[d[0]].iframe,id:d[0],height:d[1],width:d[2],type:d[3]}}function e(d){var n=Number(b[f]["max"+d]),r=Number(b[f]["min"+d]);d=d.toLowerCase();var v= 10Number(p[d]);m(f,"Checking "+d+" is in range "+r+"-"+n);r>v&&(v=r,m(f,"Set "+d+" to min value"));v>n&&(v=n,m(f,"Set "+d+" to max value"));p[d]=""+v}function q(){function d(){function v(){var A=0,G=!1;for(m(f,"Checking connection is from allowed list of origins: "+r);A<r.length;A++)if(r[A]===n){G=!0;break}return G}function C(){var A=b[f].remoteHost;return m(f,"Checking connection is from: "+A),n===A}return r.constructor===Array?v():C()}var n=a.origin,r=b[f].checkOrigin;if(r&&"null"!=""+n&&!d())throw Error("Unexpected message received from: "+ 11n+" for "+p.iframe.id+". Message was: "+a.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return!0}function B(){var d=p.type in{"true":1,"false":1,undefined:1};return d&&m(f,"Ignoring init message from meta parent page"),d}function k(d){m(f,"MessageCallback passed: {iframe: "+p.iframe.id+", message: "+d+"}");d={iframe:p.iframe,message:JSON.parse(d)};D(f,"messageCallback",d);m(f,"--")}function l(d,n){K(function(){var r=y;var v= 12document.body.getBoundingClientRect();var C=p.iframe.getBoundingClientRect();v=JSON.stringify({clientHeight:Math.max(document.documentElement.clientHeight,h.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,h.innerWidth||0),offsetTop:parseInt(C.top-v.top,10),offsetLeft:parseInt(C.left-v.left,10),scrollTop:h.pageYOffset,scrollLeft:h.pageXOffset});r("Send Page Info","pageInfo:"+v,d,n)},32)}function t(){function d(v,C){function A(){b[r]?l(b[r].iframe,r):n()}["scroll","resize"].forEach(function(G){m(r, 13v+G+" listener for sendPageInfo");C(h,G,A)})}function n(){d("Remove ",ha)}var r=f;d("Add ",z);b[r].stopPageInfo=n}function w(){var d=!0;return null===p.iframe&&(F(f,"IFrame ("+p.id+") not found"),d=!1),d}function T(d){d=d.getBoundingClientRect();return U(f),{x:Math.floor(Number(d.left)+Number(u.x)),y:Math.floor(Number(d.top)+Number(u.y))}}function V(d){var n=d?T(p.iframe):{x:0,y:0},r={x:Number(p.width)+n.x,y:Number(p.height)+n.y};m(f,"Reposition requested from iFrame (offset x:"+n.x+" y:"+n.y+")"); 14h.top!==h.self?h.parentIFrame?h.parentIFrame["scrollTo"+(d?"Offset":"")](r.x,r.y):F(f,"Unable to scroll to requested position, window.parentIFrame not found"):(u=r,W(),m(f,"--"))}function W(){!1!==D(f,"scrollCallback",u)?S(f):u=null}function ka(d){d=d.split("#")[1]||"";var n=decodeURIComponent(d);(n=document.getElementById(n)||document.getElementsByName(n)[0])?(n=T(n),m(f,"Moving to in page link (#"+d+") at x: "+n.x+" y: "+n.y),u={x:n.x,y:n.y},W(),m(f,"--")):h.top!==h.self?h.parentIFrame?h.parentIFrame.moveToAnchor(d): 15m(f,"In page link #"+d+" not found and window.parentIFrame not found"):m(f,"In page link #"+d+" not found")}function la(d){var n=!0;return b[d]||(n=!1,F(p.type+" No settings for "+d+". Message was: "+x)),n}function ma(){for(var d in b)y("iFrame requested init",X(d),document.getElementById(d),d)}var x=a.data,p={},f=null;if("[iFrameResizerChild]Ready"===x)ma();else if(J===(""+x).substr(0,M)&&x.substr(M).split(":")[0]in b){if(p=g(),f=p.id,!B()&&la(f)&&(m(f,"Received: "+x),w()&&q()))switch(b[f].firstRun&& 16(b[f].firstRun=!1),p.type){case "close":Y(p.iframe);break;case "message":k(x.substr(x.indexOf(":")+Z+6));break;case "scrollTo":V(!1);break;case "scrollToOffset":V(!0);break;case "pageInfo":l(b[f].iframe,f);t();break;case "pageInfoStop":b[f]&&b[f].stopPageInfo&&(b[f].stopPageInfo(),delete b[f].stopPageInfo);break;case "inPageLink":ka(x.substr(x.indexOf(":")+Z+9));break;case "reset":aa(p);break;case "init":c();D(f,"initCallback",p.iframe);D(f,"resizedCallback",p);break;default:c(),D(f,"resizedCallback", 17p)}}else H("info",f,"Ignored: "+x,b[f]?b[f].log:I)}function D(a,c,g){var e=null,q=null;if(b[a]){if(e=b[a][c],"function"!=typeof e)throw new TypeError(c+" on iFrame["+a+"] is not a function");q=e(g)}return q}function Y(a){var c=a.id;
17m(c,"Removing iFrame: "+c);a.parentNode.removeChild(a);D(c,"closedCallback",c);m(c,"--");delete b[c]}function U(a){null===u&&(u={x:void 0!==h.pageXOffset?h.pageXOffset:document.documentElement.scrollLeft,y:void 0!==h.pageYOffset?h.pageYOffset:document.documentElement.scrollTop}, 18m(a,"Get page position: "+u.x+","+u.y))}function S(a){null!==u&&(h.scrollTo(u.x,u.y),m(a,"Set page position: "+u.x+","+u.y),u=null)}function aa(a){m(a.id,"Size reset requested by "+("init"===a.type?"host page":"iFrame"));U(a.id);Q(function(){R(a);y("reset","reset",a.iframe,a.id)},a,"reset")}function R(a){function c(e){a.iframe.style[e]=a[e]+"px";m(a.id,"IFrame ("+g+") "+e+" set to "+a[e]+"px");ba||"0"!==a[e]||(ba=!0,m(g,"Hidden iFrame detected, creating visibility listener"),na())}var g=a.iframe.id; 19b[g]&&(b[g].sizeHeight&&c("height"),b[g].sizeWidth&&c("width"))}function Q(a,c,g){g!==c.type&&E?(m(c.id,"Requesting animation frame"),E(a)):a()}function y(a,c,g,e){e=e||g.id;if(b[e])if(g&&"contentWindow"in g&&null!==g.contentWindow){var q=b[e].targetOrigin;m(e,"["+a+"] Sending msg to iframe["+e+"] ("+c+") targetOrigin: "+q);g.contentWindow.postMessage(J+c,q)}else H("info",e,"["+a+"] IFrame("+e+") not found",b[e]?b[e].log:
19I),b[e]&&delete b[e]}function X(a){return a+":"+b[a].bodyMarginV1+":"+b[a].sizeWidth+ 20":"+b[a].log+":"+b[a].interval+":"+b[a].enablePublicMethods+":"+b[a].autoResize+":"+b[a].bodyMargin+":"+b[a].heightCalculationMethod+":"+b[a].bodyBackground+":"+b[a].bodyPadding+":"+b[a].tolerance+":"+b[a].inPageLinks+":"+b[a].resizeFrom+":"+b[a].widthCalculationMethod}function ca(a,c){function g(){function l(w){1/0!==b[k][w]&&0!==b[k][w]&&(a.style[w]=b[k][w]+"px",m(k,"Set "+w+" \x3d "+b[k][w]+"px"))}function t(w){if(b[k]["min"+w]>b[k]["max"+w])throw Error("Value for min"+w+" can not be greater than max"+ 21w);}t("Height");t("Width");l("maxHeight");l("minHeight");l("maxWidth");l("minWidth")}function e(){Function.prototype.bind&&(b[k].iframe.iFrameResizer={close:Y.bind(null,b[k].iframe),resize:y.bind(null,"Window resize","resize",b[k].iframe),moveToAnchor:function(l){y("Move to anchor","inPageLink:"+l,b[k].iframe,k)},sendMessage:function(l){l=JSON.stringify(l);y("Send Message","message:"+l,b[k].iframe,k)}})}function q(l){z(a,"load",function(){y("iFrame.onload",l,a);var t=b[k].heightCalculationMethod in 22oa;!b[k].firstRun&&t&&aa({iframe:a,height:0,width:0,type:"init"})});y("init",l,a)}function B(l){l=l||{};b[k]={firstRun:!0,iframe:a,remoteHost:a.src.split("/").slice(0,3).join("/")};if("object"!=typeof l)throw new TypeError("Options is not an object");for(var t in L)L.hasOwnProperty(t)&&(b[k][t]=l.hasOwnProperty(t)?l[t]:L[t]);t=b[k];!0===b[k].checkOrigin?(l=b[k].remoteHost,l=""===l||"file://"===l?"*":l):l="*";t.targetOrigin=l}var k=function(l){if(""===l){var t=c&&c.id||L.id+da++;l=(null!==document.getElementById(t)&& 23(t+=da++),t);a.id=l;I=(c||{}).log;m(l,"Added missing iframe ID: "+l+" ("+a.src+")")}return l}(a.id);k in b&&"iFrameResizer"in a?F(k,"Ignored iFrame, already setup."):(B(c),m(k,"IFrame scrolling "+(b[k].scrolling?"enabled":"disabled")+" for "+k),a.style.overflow=!1===b[k].scrolling?"hidden":"auto",a.scrolling=!1===b[k].scrolling?"no":"yes",g(),("number"==typeof b[k].bodyMargin||"0"===b[k].bodyMargin)&&(b[k].bodyMarginV1=b[k].bodyMargin,b[k].bodyMargin=""+b[k].bodyMargin+"px"),q(X(k)),e())}function K(a, 24c){null===N&&(N=setTimeout(function(){N=null;a()},c))}function na(){function a(){for(var q in b)null===b[q].iframe.offsetParent||"0px"!==b[q].iframe.style.height&&"0px"!==b[q].iframe.style.width||y("Visibility change","resize",b[q].iframe,q)}function c(q){m("window","Mutation observed: "+q[0].target+" "+q[0].type);K(a,16)}function g(){var q=document.querySelector("body");(new e(c)).observe(q,{attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0})}var e= 25h.MutationObserver||h.WebKitMutationObserver;e&&g()}function O(a){m("window","Trigger event: "+a);K(function(){ea("Window "+a,"resize")},16)}function fa(){function a(){ea("Tab Visable","resize")}"hidden"!==document.visibilityState&&(m("document","Trigger event: Visiblity change"),K(a,16))}function ea(a,c){for(var g in b)"parent"===b[g].resizeFrom&&b[g].autoResize&&!b[g].firstRun&&y(a,c,document.getElementById(g),g)}function pa(){z(h,"message",ja);z(h,"resize",function(){O("resize")});z(document,"visibilitychange", 26fa);z(document,"-webkit-visibilitychange",fa);z(h,"focusin",function(){O("focus")});z(h,"focus",function(){O("focus")})}function P(){function a(g,e){if(e){if(!e.tagName)throw new TypeError("Object is not a valid DOM element");if("IFRAME"!==e.tagName.toUpperCase())throw new TypeError("Expected \x3cIFRAME\x3e tag, found \x3c"+e.tagName+"\x3e");ca(e,g);c.push(e)}}var c;return ia(),pa(),function(g,e){switch(c=[],typeof e){case "undefined":case "string":Array.prototype.forEach.call(document.querySelectorAll(e|| 27"iframe"),a.bind(void 0,g));break;case "object":a(g,e);break;default:throw new TypeError("Unexpected data type ("+typeof e+")");}return c}}function qa(a){a.fn.iFrameResize=function(c){return this.filter("iframe").each(function(g,e){ca(e,c)}).end()}}var da=0,I=!1,ba=!1,Z=7,J="[iFrameSizer]",M=J.length,u=null,E=h.requestAnimationFrame,oa={max:1,scroll:1,bodyScroll:1,documentElementScroll:1},b={}
27,N=null,L={autoResize:!0,bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!0, 28inPageLinks:!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,tolerance:0,widthCalculationMethod:"scroll",closedCallback:function(){},initCallback:function(){},messageCallback:function(){F("MessageCallback function not defined")},resizedCallback:function(){},scrollCallback:function(){return!0}};h.jQuery&&qa(jQuery);"function"==typeof define&& 29define.amd?define([],P):"object"==typeof module&&"object"==typeof module.exports?module.exports=P():h.iFrameResize=h.iFrameResize||P()}(window||{});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.