e5b874cb5c9f3a822335797b9ce5ef7a08fc29ec8e14d84c5662d41745e24b12

Source Code:

!function(e){"use strict";function n(n,t,i){"addEventListener"in e?n.addEventListener(t,i,!1):"attachEvent"in e&&n.attachEvent("on"+t,i)}function t(n,t,i){"removeEventListener"in e?n.removeEventListener(t,i,!1):"detachEvent"in e&&n.detachEvent("on"+t,i)}function i(){var n,t=["moz","webkit","o","ms"];for(n=0;n<t.length&&!L;n+=1)L=e[t[n]+"RequestAnimationFrame"];L||c("setup","RequestAnimationFrame not supported")}function o(n){var t="Host page: "+n;return e.top!==e.self&&(t=e.parentIFrame&&e.parentIFrame.getId?e.parentIFrame.getId()+": "+n:"Nested host page: "+n),t}function r(e){return S+"["+o(e)+"]"}function a(e){return j[e]?j[e].log:N}function c(e,n){s("log",e,n,a(e))}function u(e,n){s("info",e,n,a(e))}function f(e,n){s("warn",e,n,!0)}function s(n,t,i,o){!0===o&&"object"==typeof e.console&&console[n](r(t),i)}function l(i){function o(){r("Height"),r("Width"),v(function(){y(L),p(A)},L,"init")}function r(e){var n=Number(j[A]["max"+e]),t=Number(j[A]["min"+e]),i=e.toLowerCase(),o=Number(L[i]);c(A,"Checking "+i+" is in range "+t+"-"+n),o<t&&(o=t,c(A,"Set "+i+" to min value")),o>n&&(o=n,c(A,"Set "+i+" to max value")),L[i]=""+o}function a(e){return T.substr(T.indexOf(":")+P+e)}function s(e){c(A,"MessageCallback passed: {iframe: "+L.iframe.id+", message: "+e+"}"),R("messageCallback",{iframe:L.iframe,message:JSON.parse(e)}),c(A,"--")}function l(){var n=document.body.getBoundingClientRect(),t=L.iframe.getBoundingClientRect();return JSON.stringify({clientHeight:Math.max(document.documentElement.clientHeight,e.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,e.innerWidth||0),offsetTop:parseInt(t.top-n.top,10),offsetLeft:parseInt(t.left-n.left,10),scrollTop:e.pageYOffset,scrollLeft:e.pageXOffset})}function x(e,n){I(function(){w("Send Page Info","pageInfo:"+l(),e,n)},32)}function F(){function i(n,t){function i(){j[r]?x(j[r].iframe,r):o()}["scroll","resize"].forEach(function(o){c(r,n+o+" listener for sendPageInfo"),t(e,o,i)})}function o(){i("Remove ",t)}var r=A;i("Add ",n),j[r].stopPageInfo=o}function M(){j[A]&&j[A].stopPageInfo&&(j[A].stopPageInfo(),delete j[A].stopPageInfo)}function z(e){var n=e.getBoundingClientRect();return g(A),{x:Math.floor(Number(n.left)+Number(H.x)),y:Math.floor(Number(n.top)+Number(H.y))}}function E(n){var t=n?z(L.iframe):{x:0,y:0},i={x:Number(L.width)+t.x,y:Number(L.height)+t.y};c(A,"Reposition requested from iFrame (offset x:"+t.x+" y:"+t.y+")"),e.top!==e.self?e.parentIFrame?e.parentIFrame["scrollTo"+(n?"Offset":"")](i.x,i.y):f(A,"Unable to scroll to requested position, window.parentIFrame not found"):(H=i,C(),c(A,"--"))}function C(){!1!==R("scrollCallback",H)?p(A):h()}function O(n){var t=n.split("#")[1]||"",i=decodeURIComponent(t),o=document.getElementById(i)||document.getElementsByName(i)[0];o?function(){var e=z(o);c(A,"Moving to in page link (#"+t+") at x: "+e.x+" y: "+e.y),H={x:e.x,y:e.y},C(),c(A,"--")}():e.top!==e.self?e.parentIFrame?e.parentIFrame.moveToAnchor(t):c(A,"In page link #"+t+" not found and window.parentIFrame not found"):c(A,"In page link #"+t+" not found")}function R(e,n){return d(A,e,n)}function N(){j[A].firstRun=!1}var T=i.data,L={},A=null;"[iFrameResizerChild]Ready"===T?function(){for(var e in j)w("iFrame requested init",k(e),document.getElementById(e),e)}():S===(""+T).substr(0,W)&&T.substr(W).split(":")[0]in j?(L=function(){var e=T.substr(W).split(":");return{iframe:j[e[0]].iframe,id:e[0],height:e[1],width:e[2],type:e[3]}}(),A=B=L.id,!function(){var e=L.type in{true:1,false:1,undefined:1};return e&&c(A,"Ignoring init message from meta parent page"),e}()&&function(e){var n=!0;return j[e]||(n=!1,f(L.type+" No settings for "+e+". Message was: "+T)),n}(A)&&(c(A,"Received: "+T),function(){var e=!0;return null===L.iframe&&(f(A,"IFrame ("+L.id+") not found"),e=!1),e}()&&function(){var e=i.origin,n=j[A].checkOrigin;if(n&&""+e!="null"&&!(n.constructor===Array?function(){var t=0,i=!1;for(c(A,"Checking connection is from allowed list of origins: "+n);t<n.length;t++)if(n[t]===e){i=!0;break}return i}():function(){var n=j[A].remoteHost;return c(A,"Checking connection is from: "+n),e===n}()))throw new Error("Unexpected message received from: "+e+" for "+L.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(j[A].firstRun&&N(),L.type){case"close":m(L.iframe);break;case"message":s(a(6));break;case"scrollTo":E(!1);break;case"scrollToOffset":E(!0);break;case"pageInfo":x(j[A].iframe,A),F();break;case"pageInfoStop":M();break;case"inPageLink":O(a(9));break;case"reset":b(L);break;case"init":o(),R("initCallback",L.iframe),R("resizedCallback",L);break;default:o(),R("resizedCallback",L)}}())):u(A,"Ignored: "+T)}function d(e,n,t){var i=null,o=null;if(j[e]){if("function"!=typeof(i=j[e][n]))throw new TypeError(n+" on iFrame["+e+"] is not a function");o=i(t)}return o}function m(e){var n=e.id;c(n,"Removing iFrame: "+n),e.parentNode.removeChild(e),d(n,"closedCallback",n),c(n,"--"),delete j[n]}function g(n){null===H&&(H={x:void 0!==e.pageXOffset?e.pageXOffset:document.documentElement.scrollLeft,y:void 0!==e.pageYOffset?e.pageYOffset:document.documentElement.scrollTop},c(n,"Get page position: "+H.x+","+H.y))}function p(n){null!==H&&(e.scrollTo(H.x,H.y),c(n,"Set page position: "+H.x+","+H.y),h())}function h(){H=null}function b(e){c(e.id,"Size reset requested by "+("init"===e.type?"host page":"iFrame")),g(e.id),v(function(){y(e),w("reset","reset",e.iframe,e.id)},e,"reset")}function y(e){function n(n){e.iframe.style[n]=e[n]+"px",c(e.id,"IFrame ("+o+") "+n+" set to "+e[n]+"px")}function t(n){T||"0"!==e[n]||(T=!0,c(o,"Hidden iFrame detected, creating visibility listener"),F())}function i(e){n(e),t(e)}var o=e.iframe.id;j[o]&&(j[o].sizeHeight&&i("height"),j[o].sizeWidth&&i("width"))}function v(e,n,t){t!==n.type&&L?(c(n.id,"Requesting animation frame"),L(e)):e()}function w(e,n,t,i){function o(){var o=j[i].targetOrigin;c(i,"["+e+"] Sending msg to iframe["+i+"] ("+n+") targetOrigin: "+o),t.contentWindow.postMessage(S+n,o)}function r(){u(i,"["+e+"] IFrame("+i+") not found"),j[i]&&delete j[i]}i=i||t.id,j[i]&&(t&&"contentWindow"in t&&null!==t.contentWindow?o():r())}function k(e){return e+":"+j[e].bodyMarginV1+":"+j[e].sizeWidth+":"+j[e].log+":"+j[e].interval+":"+j[e].enablePublicMethods+":"+j[e].autoResize+":"+j[e].bodyMargin+":"+j[e].heightCalculationMethod+":"+j[e].bodyBackground+":"+j[e].bodyPadding+":"+j[e].tolerance+":"+j[e].inPageLinks+":"+j[e].resizeFrom+":"+j[e].widthCalculationMethod}function x(e,t){function i(){var e=t&&t.id||V.id+R++;return null!==document.getElementById(e)&&(e+=R++),e}function o(){var n=j[s].firstRun,t=j[s].heightCalculationMethod in A;!n&&t&&b({iframe:e,height:0,width:0,type:"init"})}function r(e){if("object"!=typeof e)throw new TypeError("Options is not an object")}function a(e){for(var n in V)V.hasOwnProperty(n)&&(j[s][n]=e.hasOwnProperty(n)?e[n]:V[n])}function u(e){return""===e||"file://"===e?"*":e}var s=function(n){return B=n,""===n&&(e.id=n=i(),N=(t||{}).log,B=n,c(n,"Added missing iframe ID: "+n+" ("+e.src+")")),n}(e.id);s in j&&"iFrameResizer"in e?f(s,"Ignored iFrame, already setup."):(function(n){n=n||{},j[s]={firstRun:!0,iframe:e,remoteHost:e.src.split("/").slice(0,3).join("/")},r(n),a(n),j[s].targetOrigin=!0===j[s].checkOrigin?u(j[s].remoteHost):"*"}(t),c(s,"IFrame scrolling "+(j[s].scrolling?"enabled":"disabled")+" for "+s),e.style.overflow=!1===j[s].scrolling?"hidden":"auto",e.scrolling=!1===j[s].scrolling?"no":"yes",function(){function n(n){1/0!==j[s][n]&&0!==j[s][n]&&(e.style[n]=j[s][n]+"px",c(s,"Set "+n+" = "+j[s][n]+"px"))}function t(e){if(j[s]["min"+e]>j[s]["max"+e])throw new Error("Value for min"+e+" can not be greater than max"+e)}t("Height"),t("Width"),n("maxHeight"),n("minHeight"),n("maxWidth"),n("minWidth")}(),"number"!=typeof j[s].bodyMargin&&"0"!==j[s].bodyMargin||(j[s].bodyMarginV1=j[s].bodyMargin,j[s].bodyMargin=j[s].bodyMargin+"px"),function(t){n(e,"load",function(){w("iFrame.onload",t,e),o()}),w("init",t,e)}(k(s)),Function.prototype.bind&&(j[s].iframe.iFrameResizer={close:m.bind(null,j[s].iframe),resize:w.bind(null,"Window resize","resize",j[s].iframe),moveToAnchor:function(e){w("Move to anchor","inPageLink:"+e,j[s].iframe,s)},sendMessage:function(e){w("Send Message","message:"+(e=JSON.stringify(e)),j[s].iframe,s)}}))}function I(e,n){null===q&&(q=setTimeout(function(){q=null,e()},n))}function F(){function n(){for(var e in j)!function(e){function n(n){return"0px"===j[e].iframe.style[n]}(function(e){return null!==e.offsetParent})(j[e].iframe)&&(n("height")||n("width"))&&w("Visibility change","resize",j[e].iframe,e)}(e)}function t(e){c("window","Mutation observed: "+e[0].target+" "+e[0].type),I(n,16)}var i=e.MutationObserver||e.WebKitMutationObserver;i&&function(){var e=document.querySelector("body"),n={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0};new i(t).observe(e,n)}()}function M(e){c("window","Trigger event: "+e),I(function(){E("Window "+e,"resize")},16)}function z(){"hidden"!==document.visibilityState&&(c("document","Trigger event: Visiblity change"),I(function(){E("Tab Visable","resize")},16))}function E(e,n){for(var t in j)(function(e){return"parent"===j[e].resizeFrom&&j[e].autoResize&&!j[e].firstRun})(t)&&w(e,n,document.getElementById(t),t)}function C(){n(e,"message",l),n(e,"resize",function(){M("resize")}),n(document,"visibilitychange",z),n(document,"-webkit-visibilitychange",z),n(e,"focusin",function(){M("focus")}),n(e,"focus",function(){M("focus")})}function O(){function e(e,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 <IFRAME> tag, found <"+t.tagName+">")}(),x(t,e),n.push(t))}var n;return i(),C(),function(t,i){switch(n=[],typeof i){case"undefined":case"string":Array.prototype.forEach.call(document.querySelectorAll(i||"iframe"),e.bind(void 0,t));break;case"object":e(t,i);break;default:throw new TypeError("Unexpected data type ("+typeof i+")")}return n}}var R=0,N=!1,T=!1,P="message".length,S="[iFrameSizer]",W=S.length,H=null,L=e.requestAnimationFrame,A={max:1,scroll:1,bodyScroll:1,documentElementScroll:1},j={},q=null,B="Host Page",V={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,tolerance:0,widthCalculationMethod:"scroll",closedCallback:function(){},initCallback:function(){},messageCallback:function(){f("MessageCallback function not defined")},resizedCallback:function(){},scrollCallback:function(){return!0}};e.jQuery&&function(e){e.fn.iFrameResize=function(e){return this.filter("iframe").each(function(n,t){x(t,e)}).end()}}(jQuery),"function"==typeof define&&define.amd&&define([],O),"object"==typeof module&&"object"==typeof module.exports&&(module.exports=O()),void 0!==e&&(e.iFrameResize=e.iFrameResize||O())}(window||{});