{"version":3,"file":"iframeResizer.min.js","sources":["iframeResizer.js"],"names":["undefined","addEventListener","obj","evt","func","window","attachEvent","removeEventListener","el","detachEvent","setupRequestAnimationFrame","x","vendors","length","requestAnimationFrame","log","getMyID","iframeId","retStr","top","self","parentIFrame","getId","formatLogHeader","msgId","isLogEnabled","settings","logEnabled","msg","output","info","warn","type","enabled","console","iFrameListener","event","resizeIFrame","resize","setSize","messageData","setPagePosition","callback","ensureInRange","syncResize","processMsg","data","substr","msgIdLen","split","iframe","id","height","width","Dimension","max","Number","min","dimension","toLowerCase","size","isMessageFromIFrame","checkAllowedOrigin","checkList","i","retCode","checkOrigin","origin","checkSingle","remoteHost","constructor","Array","Error","isMessageForUs","isMessageFromMetaParent","true","false","getMsgBody","offset","indexOf","msgHeaderLen","forwardMsgFromIFrame","msgBody","message","JSON","parse","getPageInfo","bodyPosition","document","body","getBoundingClientRect","iFramePosition","stringify","iframeHeight","iframeWidth","clientHeight","Math","documentElement","innerHeight","clientWidth","innerWidth","offsetTop","parseInt","offsetLeft","left","scrollTop","pageYOffset","scrollLeft","pageXOffset","sendPageInfoToIframe","debouncedTrigger","trigger","debouce","startPageInfoMonitor","setListener","sendPageInfo","stop","forEach","start","stopPageInfo","stopPageInfoMonitor","checkIFrameExists","retBool","getElementPosition","target","getPagePosition","floor","pagePosition","y","scrollRequestFromChild","addOffset","reposition","newPosition","scrollTo","calcOffset","scrollParent","unsetPagePosition","findTarget","location","jumpToTarget","jumpPosition","hash","jumpToParent","moveToAnchor","hashData","decodeURIComponent","getElementById","getElementsByName","funcName","val","chkCallback","actionMsg","firstRun","closeRequestCallback","closeIFrame","resetIFrame","hasSettings","iFrameReadyMsgReceived","createOutgoingMsg","logId","loaded","retVal","TypeError","parentNode","removeChild","reset","setDimension","style","chkZero","hiddenCheckEnabled","fixHiddenIFrames","processDimension","sizeHeight","sizeWidth","doNotSync","calleeMsg","noResponseWarning","postMessageToIFrame","targetOrigin","contentWindow","postMessage","iFrameNotFound","chkAndSend","warnOnNoResponse","warning","errorShown","warningTimeout","msgTimeout","setTimeout","bodyMarginV1","interval","enablePublicMethods","autoResize","bodyMargin","heightCalculationMethod","bodyBackground","bodyPadding","tolerance","inPageLinks","resizeFrom","widthCalculationMethod","setupIFrame","options","setLimits","addStyle","Infinity","chkMinMax","newId","defaults","count","ensureHasId","src","setScrolling","scrolling","overflow","setupBodyMarginValues","checkReset","resetRequertMethod","resetRequiredMethods","setupIFrameObject","Function","prototype","bind","iFrameResizer","close","anchor","sendMessage","init","iFrameLoaded","checkOptions","copyOptions","option","hasOwnProperty","getTargetOrigin","processOptions","slice","join","beenHere","fn","time","timer","checkIFrames","checkIFrame","settingId","chkDimension","isVisible","offsetParent","mutationObserved","mutations","createMutationObserver","querySelector","config","attributes","attributeOldValue","characterData","characterDataOldValue","childList","subtree","observer","MutationObserver","observe","WebKitMutationObserver","resizeIFrames","sendTriggerMsg","tabVisible","visibilityState","eventName","isIFrameResizeEnabled","setupEventListeners","factory","element","chkType","tagName","toUpperCase","iFrames","push","warnDeprecatedOptions","call","querySelectorAll","createJQueryPublicMethod","$","iFrameResize","index","this","filter","each","end","msgHeader","scroll","bodyScroll","documentElementScroll","maxHeight","maxWidth","minHeight","minWidth","closedCallback","initCallback","messageCallback","resizedCallback","scrollCallback","jQuery","define","amd","module","exports"],"mappings":";;;;;;;CAWC,SAAUA,GACT,YAkDA,SAASC,GAAiBC,EAAIC,EAAIC,GAE5B,oBAAsBC,QACxBH,EAAID,iBAAiBE,EAAIC,GAAM,GACtB,eAAiBC,SAC1BH,EAAII,YAAY,KAAKH,EAAIC,GAI7B,QAASG,GAAoBC,EAAGL,EAAIC,GAE9B,uBAAyBC,QAC3BG,EAAGD,oBAAoBJ,EAAIC,GAAM,GACxB,eAAiBC,SAC1BG,EAAGC,YAAY,KAAKN,EAAIC,GAI5B,QAASM,KACP,GAEEC,GADAC,GAAW,MAAO,SAAU,IAAK,KAInC,KAAKD,EAAI,EAAGA,EAAIC,EAAQC,SAAWC,E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B,YAExBiD,GACEhB,YAA4B,EAC5BG,eAA4B,KAC5BF,WAA4B,KAC5BJ,aAA4B,EAC5BO,YAA4B,KAC5BlI,aAA4B,EAC5BoI,aAA4B,EAC5BP,qBAA4B,EAC5BG,wBAA4B,aAC5B/I,GAA4B,gBAC5B2I,SAA4B,GAC5B/K,KAA4B,EAC5BoR,UAA4BtF,EAAAA,EAC5BuF,SAA4BvF,EAAAA,EAC5BwF,UAA4B,EAC5BC,SAA4B,EAC5B/F,WAA4B,SAC5Bc,WAA4B,EAC5BzC,YAA4B,EAC5BC,WAA4B,EAC5Ba,eAA4B,IAC5BW,UAA4B,EAC5BG,uBAA4B,SAC5B+F,eAA4B,aAC5BC,aAA4B,aAC5BC,gBAA4B,WAAY1Q,EAAK,yCAC7C2Q,gBAA4B,aAC5BC,eAA4B,WAAY,OAAO,GAs9B/CtS,QAAOuS,QAAUrB,EAAyBlR,OAAOuS,QAE/B,kBAAXC,SAAyBA,OAAOC,IACzCD,UAAUhC,GACiB,gBAAXkC,SAAiD,gBAAnBA,QAAOC,QACrDD,OAAOC,QAAUnC,IAEjBxQ,OAAOoR,aAAepR,OAAOoR,cAAgBZ","sourcesContent":["/*\n * File: iframeResizer.js\n * Desc: Force iframes to size to content.\n * Requires: iframeResizer.contentWindow.js to be loaded into the target frame.\n * Doc: https://github.com/davidjbradshaw/iframe-resizer\n * Author: David J. Bradshaw - dave@bradshaw.net\n * Contributor: Jure Mav - jure.mav@gmail.com\n * Contributor: Reed Dadoune - reed@dadoune.com\n */\n\n\n;(function(undefined) {\n  'use strict';\n\n  if(typeof window === 'undefined') return; // don't run for server side render\n\n  var\n    count                 = 0,\n    logEnabled            = false,\n    hiddenCheckEnabled    = false,\n    msgHeader             = 'message',\n    msgHeaderLen          = msgHeader.length,\n    msgId                 = '[iFrameSizer]', //Must match iframe msg ID\n    msgIdLen              = msgId.length,\n    pagePosition          = null,\n    requestAnimationFrame = window.requestAnimationFrame,\n    resetRequiredMethods  = {max:1,scroll:1,bodyScroll:1,documentElementScroll:1},\n    settings              = {},\n    timer                 = null,\n    logId                 = 'Host Page',\n\n    defaults              = {\n      autoResize                : true,\n      bodyBackground            : null,\n      bodyMargin                : null,\n      bodyMarginV1              : 8,\n      bodyPadding               : null,\n      checkOrigin               : true,\n      inPageLinks               : false,\n      enablePublicMethods       : true,\n      heightCalculationMethod   : 'bodyOffset',\n      id                        : 'iFrameResizer',\n      interval                  : 32,\n      log                       : false,\n      maxHeight                 : Infinity,\n      maxWidth                  : Infinity,\n      minHeight                 : 0,\n      minWidth                  : 0,\n      resizeFrom                : 'parent',\n      scrolling                 : false,\n      sizeHeight                : true,\n      sizeWidth                 : false,\n      warningTimeout            : 5000,\n      tolerance                 : 0,\n      widthCalculationMethod    : 'scroll',\n      closedCallback            : function() {},\n      initCallback              : function() {},\n      messageCallback           : function() {warn('MessageCallback function not defined');},\n      resizedCallback           : function() {},\n      scrollCallback            : function() {return true;}\n    };\n\n  function addEventListener(obj,evt,func) {\n    /* istanbul ignore else */ // Not testable in PhantonJS\n    if ('addEventListener' in window) {\n      obj.addEventListener(evt,func, false);\n    } else if ('attachEvent' in window) {//IE\n      obj.attachEvent('on'+evt,func);\n    }\n  }\n\n  function removeEventListener(el,evt,func) {\n    /* istanbul ignore else */ // Not testable in phantonJS\n    if ('removeEventListener' in window) {\n      el.removeEventListener(evt,func, false);\n    } else if ('detachEvent' in window) { //IE\n      el.detachEvent('on'+evt,func);\n    }\n  }\n\n  function setupRequestAnimationFrame() {\n    var\n      vendors = ['moz', 'webkit', 'o', 'ms'],\n      x;\n\n    // Remove vendor prefixing if prefixed and break early if not\n    for (x = 0; x < vendors.length && !requestAnimationFrame; x += 1) {\n      requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];\n    }\n\n    if (!(requestAnimationFrame)) {\n      log('setup','RequestAnimationFrame not supported');\n    }\n  }\n\n  function getMyID(iframeId) {\n    var retStr = 'Host page: '+iframeId;\n\n    if (window.top !== window.self) {\n      if (window.parentIFrame && window.parentIFrame.getId) {\n        retStr = window.parentIFrame.getId()+': '+iframeId;\n      } else {\n        retStr = 'Nested host page: '+iframeId;\n      }\n    }\n\n    return retStr;\n  }\n\n  function formatLogHeader(iframeId) {\n    return msgId + '[' + getMyID(iframeId) + ']';\n  }\n\n  function isLogEnabled(iframeId) {\n    return settings[iframeId] ? settings[iframeId].log : logEnabled;\n  }\n\n  function log(iframeId,msg) {\n    output('log',iframeId,msg,isLogEnabled(iframeId));\n  }\n\n  function info(iframeId,msg) {\n    output('info',iframeId,msg,isLogEnabled(iframeId));\n  }\n\n  function warn(iframeId,msg) {\n    output('warn',iframeId,msg,true);\n  }\n\n  function output(type,iframeId,msg,enabled) {\n    if (true === enabled && 'object' === typeof window.console) {\n      console[type](formatLogHeader(iframeId),msg);\n    }\n  }\n\n  function iFrameListener(event) {\n    function resizeIFrame() {\n      function resize() {\n        setSize(messageData);\n        setPagePosition(iframeId);\n        callback('resizedCallback',messageData);\n      }\n\n      ensureInRange('Height');\n      ensureInRange('Width');\n\n      syncResize(resize,messageData,'init');\n    }\n\n    function processMsg() {\n      var data = msg.substr(msgIdLen).split(':');\n\n      return {\n        iframe: settings[data[0]] && settings[data[0]].iframe,\n        id:     data[0],\n        height: data[1],\n        width:  data[2],\n        type:   data[3]\n      };\n    }\n\n    function ensureInRange(Dimension) {\n      var\n        max  = Number(settings[iframeId]['max' + Dimension]),\n        min  = Number(settings[iframeId]['min' + Dimension]),\n        dimension = Dimension.toLowerCase(),\n        size = Number(messageData[dimension]);\n\n      log(iframeId,'Checking ' + dimension + ' is in range ' + min + '-' + max);\n\n      if (size<min) {\n        size=min;\n        log(iframeId,'Set ' + dimension + ' to min value');\n      }\n\n      if (size>max) {\n        size=max;\n        log(iframeId,'Set ' + dimension + ' to max value');\n      }\n\n      messageData[dimension] = '' + size;\n    }\n\n\n    function isMessageFromIFrame() {\n      function checkAllowedOrigin() {\n        function checkList() {\n          var\n            i = 0,\n            retCode = false;\n\n          log(iframeId,'Checking connection is from allowed list of origins: ' + checkOrigin);\n\n          for (; i < checkOrigin.length; i++) {\n            if (checkOrigin[i] === origin) {\n              retCode = true;\n              break;\n            }\n          }\n          return retCode;\n        }\n\n        function checkSingle() {\n          var remoteHost  = settings[iframeId] && settings[iframeId].remoteHost;\n          log(iframeId,'Checking connection is from: '+remoteHost);\n          return origin === remoteHost;\n        }\n\n        return checkOrigin.constructor === Array ? checkList() : checkSingle();\n      }\n\n      var\n        origin      = event.origin,\n        checkOrigin = settings[iframeId] && settings[iframeId].checkOrigin;\n\n      if (checkOrigin && (''+origin !== 'null') && !checkAllowedOrigin()) {\n        throw new Error(\n          'Unexpected message received from: ' + origin +\n          ' for ' + messageData.iframe.id +\n          '. Message was: ' + event.data +\n          '. This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.'\n        );\n      }\n\n      return true;\n    }\n\n    function isMessageForUs() {\n      return msgId === (('' + msg).substr(0,msgIdLen)) && (msg.substr(msgIdLen).split(':')[0] in settings); //''+Protects against non-string msg\n    }\n\n    function isMessageFromMetaParent() {\n      //Test if this message is from a parent above us. This is an ugly test, however, updating\n      //the message format would break backwards compatibity.\n      var retCode = messageData.type in {'true':1,'false':1,'undefined':1};\n\n      if (retCode) {\n        log(iframeId,'Ignoring init message from meta parent page');\n      }\n\n      return retCode;\n    }\n\n    function getMsgBody(offset) {\n      return msg.substr(msg.indexOf(':')+msgHeaderLen+offset);\n    }\n\n    function forwardMsgFromIFrame(msgBody) {\n      log(iframeId,'MessageCallback passed: {iframe: '+ messageData.iframe.id + ', message: ' + msgBody + '}');\n      callback('messageCallback',{\n        iframe: messageData.iframe,\n        message: JSON.parse(msgBody)\n      });\n      log(iframeId,'--');\n    }\n\n    function getPageInfo() {\n      var\n        bodyPosition   = document.body.getBoundingClientRect(),\n        iFramePosition = messageData.iframe.getBoundingClientRect();\n\n      return JSON.stringify({\n        iframeHeight: iFramePosition.height,\n        iframeWidth:  iFramePosition.width,\n        clientHeight: Math.max(document.documentElement.clientHeight, window.innerHeight || 0),\n        clientWidth:  Math.max(document.documentElement.clientWidth,  window.innerWidth  || 0),\n        offsetTop:    parseInt(iFramePosition.top  - bodyPosition.top,  10),\n        offsetLeft:   parseInt(iFramePosition.left - bodyPosition.left, 10),\n        scrollTop:    window.pageYOffset,\n        scrollLeft:   window.pageXOffset\n      });\n    }\n\n    function sendPageInfoToIframe(iframe,iframeId) {\n      function debouncedTrigger() {\n        trigger(\n          'Send Page Info',\n          'pageInfo:' + getPageInfo(),\n          iframe,\n          iframeId\n        );\n      }\n\n      debouce(debouncedTrigger,32);\n    }\n\n\n    function startPageInfoMonitor() {\n      function setListener(type,func) {\n        function sendPageInfo() {\n          if (settings[id]) {\n            sendPageInfoToIframe(settings[id].iframe,id);\n          } else {\n            stop();\n          }\n        }\n\n        ['scroll','resize'].forEach(function(evt) {\n          log(id, type +  evt + ' listener for sendPageInfo');\n          func(window,evt,sendPageInfo);\n        });\n      }\n\n      function stop() {\n        setListener('Remove ', removeEventListener);\n      }\n\n      function start() {\n        setListener('Add ', addEventListener);\n      }\n\n      var id = iframeId; //Create locally scoped copy of iFrame ID\n\n      start();\n\n      if (settings[id]) {\n        settings[id].stopPageInfo = stop;\n      }\n    }\n\n    function stopPageInfoMonitor() {\n      if (settings[iframeId] && settings[iframeId].stopPageInfo) {\n        settings[iframeId].stopPageInfo();\n        delete settings[iframeId].stopPageInfo;\n      }\n    }\n\n    function checkIFrameExists() {\n      var retBool = true;\n\n      if (null === messageData.iframe) {\n        warn(iframeId,'IFrame ('+messageData.id+') not found');\n        retBool = false;\n      }\n      return retBool;\n    }\n\n    function getElementPosition(target) {\n      var iFramePosition = target.getBoundingClientRect();\n\n      getPagePosition(iframeId);\n\n      return {\n        x: Math.floor( Number(iFramePosition.left) + Number(pagePosition.x) ),\n        y: Math.floor( Number(iFramePosition.top)  + Number(pagePosition.y) )\n      };\n    }\n\n    function scrollRequestFromChild(addOffset) {\n      /* istanbul ignore next */  //Not testable in Karma\n      function reposition() {\n        pagePosition = newPosition;\n        scrollTo();\n        log(iframeId,'--');\n      }\n\n      function calcOffset() {\n        return {\n          x: Number(messageData.width) + offset.x,\n          y: Number(messageData.height) + offset.y\n        };\n      }\n\n      function scrollParent() {\n        if (window.parentIFrame) {\n          window.parentIFrame['scrollTo'+(addOffset?'Offset':'')](newPosition.x,newPosition.y);\n        } else {\n          warn(iframeId,'Unable to scroll to requested position, window.parentIFrame not found');\n        }\n      }\n\n      var\n        offset = addOffset ? getElementPosition(messageData.iframe) : {x:0,y:0},\n        newPosition = calcOffset();\n\n      log(iframeId,'Reposition requested from iFrame (offset x:'+offset.x+' y:'+offset.y+')');\n\n      if(window.top !== window.self) {\n        scrollParent();\n      } else {\n        reposition();\n      }\n    }\n\n    function scrollTo() {\n      if (false !== callback('scrollCallback',pagePosition)) {\n        setPagePosition(iframeId);\n      } else {\n        unsetPagePosition();\n      }\n    }\n\n    function findTarget(location) {\n      function jumpToTarget() {\n        var jumpPosition = getElementPosition(target);\n\n        log(iframeId,'Moving to in page link (#'+hash+') at x: '+jumpPosition.x+' y: '+jumpPosition.y);\n        pagePosition = {\n          x: jumpPosition.x,\n          y: jumpPosition.y\n        };\n\n        scrollTo();\n        log(iframeId,'--');\n      }\n\n      function jumpToParent() {\n        if (window.parentIFrame) {\n          window.parentIFrame.moveToAnchor(hash);\n        } else {\n          log(iframeId,'In page link #'+hash+' not found and window.parentIFrame not found');\n        }\n      }\n\n      var\n        hash     = location.split('#')[1] || '',\n        hashData = decodeURIComponent(hash),\n        target   = document.getElementById(hashData) || document.getElementsByName(hashData)[0];\n\n      if (target) {\n        jumpToTarget();\n      } else if(window.top!==window.self) {\n        jumpToParent();\n      } else {\n        log(iframeId,'In page link #'+hash+' not found');\n      }\n    }\n\n    function callback(funcName,val) {\n      return chkCallback(iframeId,funcName,val);\n    }\n\n    function actionMsg() {\n\n      if(settings[iframeId] && settings[iframeId].firstRun) firstRun();\n\n      switch(messageData.type) {\n      case 'close':\n        if(settings[iframeId].closeRequestCallback) chkCallback(iframeId, 'closeRequestCallback', settings[iframeId].iframe);\n        else closeIFrame(messageData.iframe);\n        break;\n      case 'message':\n        forwardMsgFromIFrame(getMsgBody(6));\n        break;\n      case 'scrollTo':\n        scrollRequestFromChild(false);\n        break;\n      case 'scrollToOffset':\n        scrollRequestFromChild(true);\n        break;\n      case 'pageInfo':\n        sendPageInfoToIframe(settings[iframeId] && settings[iframeId].iframe,iframeId);\n        startPageInfoMonitor();\n        break;\n      case 'pageInfoStop':\n        stopPageInfoMonitor();\n        break;\n      case 'inPageLink':\n        findTarget(getMsgBody(9));\n        break;\n      case 'reset':\n        resetIFrame(messageData);\n        break;\n      case 'init':\n        resizeIFrame();\n        callback('initCallback',messageData.iframe);\n        break;\n      default:\n        resizeIFrame();\n      }\n    }\n\n    function hasSettings(iframeId) {\n      var retBool = true;\n\n      if (!settings[iframeId]) {\n        retBool = false;\n        warn(messageData.type + ' No settings for ' + iframeId + '. Message was: ' + msg);\n      }\n\n      return retBool;\n    }\n\n    function iFrameReadyMsgReceived() {\n      for (var iframeId in settings) {\n        trigger('iFrame requested init',createOutgoingMsg(iframeId),document.getElementById(iframeId),iframeId);\n      }\n    }\n\n    function firstRun() {\n      if (settings[iframeId]) {\n        settings[iframeId].firstRun = false;\n      }\n    }\n\n    function clearWarningTimeout() {\n      if (settings[iframeId]) {\n        clearTimeout(settings[iframeId].msgTimeout);\n        settings[iframeId].warningTimeout = 0;\n      }\n    }\n\n    var\n      msg = event.data,\n      messageData = {},\n      iframeId = null;\n\n    if('[iFrameResizerChild]Ready' === msg) {\n      iFrameReadyMsgReceived();\n    } else if (isMessageForUs()) {\n      messageData = processMsg();\n      iframeId    = logId = messageData.id;\n      if (settings[iframeId]) {\n        settings[iframeId].loaded = true;\n      }\n\n      if (!isMessageFromMetaParent() && hasSettings(iframeId)) {\n        log(iframeId,'Received: '+msg);\n\n        if ( checkIFrameExists() && isMessageFromIFrame() ) {\n          actionMsg();\n        }\n      }\n    } else {\n      info(iframeId,'Ignored: '+msg);\n    }\n\n  }\n\n\n  function chkCallback(iframeId,funcName,val) {\n    var\n      func = null,\n      retVal = null;\n\n    if(settings[iframeId]) {\n      func = settings[iframeId][funcName];\n\n      if( 'function' === typeof func) {\n        retVal = func(val);\n      } else {\n        throw new TypeError(funcName+' on iFrame['+iframeId+'] is not a function');\n      }\n    }\n\n    return retVal;\n  }\n\n  function closeIFrame(iframe) {\n    var iframeId = iframe.id;\n\n    log(iframeId,'Removing iFrame: '+iframeId);\n    if (iframe.parentNode) { iframe.parentNode.removeChild(iframe); }\n    chkCallback(iframeId,'closedCallback',iframeId);\n    log(iframeId,'--');\n    delete settings[iframeId];\n  }\n\n  function getPagePosition(iframeId) {\n    if(null === pagePosition) {\n      pagePosition = {\n        x: (window.pageXOffset !== undefined) ? window.pageXOffset : document.documentElement.scrollLeft,\n        y: (window.pageYOffset !== undefined) ? window.pageYOffset : document.documentElement.scrollTop\n      };\n      log(iframeId,'Get page position: '+pagePosition.x+','+pagePosition.y);\n    }\n  }\n\n  function setPagePosition(iframeId) {\n    if(null !== pagePosition) {\n      window.scrollTo(pagePosition.x,pagePosition.y);\n      log(iframeId,'Set page position: '+pagePosition.x+','+pagePosition.y);\n      unsetPagePosition();\n    }\n  }\n\n  function unsetPagePosition() {\n    pagePosition = null;\n  }\n\n  function resetIFrame(messageData) {\n    function reset() {\n      setSize(messageData);\n      trigger('reset','reset',messageData.iframe,messageData.id);\n    }\n\n    log(messageData.id,'Size reset requested by '+('init'===messageData.type?'host page':'iFrame'));\n    getPagePosition(messageData.id);\n    syncResize(reset,messageData,'reset');\n  }\n\n  function setSize(messageData) {\n    function setDimension(dimension) {\n      messageData.iframe.style[dimension] = messageData[dimension] + 'px';\n      log(\n        messageData.id,\n        'IFrame (' + iframeId +\n        ') ' + dimension +\n        ' set to ' + messageData[dimension] + 'px'\n      );\n    }\n\n    function chkZero(dimension) {\n      //FireFox sets dimension of hidden iFrames to zero.\n      //So if we detect that set up an event to check for\n      //when iFrame becomes visible.\n\n      /* istanbul ignore next */  //Not testable in PhantomJS\n      if (!hiddenCheckEnabled && '0' === messageData[dimension]) {\n        hiddenCheckEnabled = true;\n        log(iframeId,'Hidden iFrame detected, creating visibility listener');\n        fixHiddenIFrames();\n      }\n    }\n\n    function processDimension(dimension) {\n      setDimension(dimension);\n      chkZero(dimension);\n    }\n\n    var iframeId = messageData.iframe.id;\n\n    if(settings[iframeId]) {\n      if( settings[iframeId].sizeHeight) { processDimension('height'); }\n      if( settings[iframeId].sizeWidth ) { processDimension('width'); }\n    }\n  }\n\n  function syncResize(func,messageData,doNotSync) {\n    /* istanbul ignore if */  //Not testable in PhantomJS\n    if(doNotSync!==messageData.type && requestAnimationFrame) {\n      log(messageData.id,'Requesting animation frame');\n      requestAnimationFrame(func);\n    } else {\n      func();\n    }\n  }\n\n  function trigger(calleeMsg, msg, iframe, id, noResponseWarning) {\n    function postMessageToIFrame() {\n      var target = settings[id] && settings[id].targetOrigin;\n      log(id,'[' + calleeMsg + '] Sending msg to iframe['+id+'] ('+msg+') targetOrigin: '+target);\n      iframe.contentWindow.postMessage( msgId + msg, target );\n    }\n\n    function iFrameNotFound() {\n      warn(id,'[' + calleeMsg + '] IFrame('+id+') not found');\n    }\n\n    function chkAndSend() {\n      if(iframe && 'contentWindow' in iframe && (null !== iframe.contentWindow)) { //Null test for PhantomJS\n        postMessageToIFrame();\n      } else {\n        iFrameNotFound();\n      }\n    }\n\n    function warnOnNoResponse() {\n      function warning() {\n        if (settings[id] && !settings[id].loaded && !errorShown) {\n          errorShown = true;\n          warn(id, 'IFrame has not responded within '+ settings[id].warningTimeout/1000 +' seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ingored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning.');\n        }\n      }\n\n      if (!!noResponseWarning && settings[id] && !!settings[id].warningTimeout) {\n        settings[id].msgTimeout = setTimeout(warning, settings[id].warningTimeout);\n      }\n    }\n\n    var errorShown = false;\n\n    id = id || iframe.id;\n\n    if(settings[id]) {\n      chkAndSend();\n      warnOnNoResponse();\n    }\n\n  }\n\n  function createOutgoingMsg(iframeId) {\n    return iframeId +\n      ':' + settings[iframeId].bodyMarginV1 +\n      ':' + settings[iframeId].sizeWidth +\n      ':' + settings[iframeId].log +\n      ':' + settings[iframeId].interval +\n      ':' + settings[iframeId].enablePublicMethods +\n      ':' + settings[iframeId].autoResize +\n      ':' + settings[iframeId].bodyMargin +\n      ':' + settings[iframeId].heightCalculationMethod +\n      ':' + settings[iframeId].bodyBackground +\n      ':' + settings[iframeId].bodyPadding +\n      ':' + settings[iframeId].tolerance +\n      ':' + settings[iframeId].inPageLinks +\n      ':' + settings[iframeId].resizeFrom +\n      ':' + settings[iframeId].widthCalculationMethod;\n  }\n\n  function setupIFrame(iframe,options) {\n    function setLimits() {\n      function addStyle(style) {\n        if ((Infinity !== settings[iframeId][style]) && (0 !== settings[iframeId][style])) {\n          iframe.style[style] = settings[iframeId][style] + 'px';\n          log(iframeId,'Set '+style+' = '+settings[iframeId][style]+'px');\n        }\n      }\n\n      function chkMinMax(dimension) {\n        if (settings[iframeId]['min'+dimension]>settings[iframeId]['max'+dimension]) {\n          throw new Error('Value for min'+dimension+' can not be greater than max'+dimension);\n        }\n      }\n\n      chkMinMax('Height');\n      chkMinMax('Width');\n\n      addStyle('maxHeight');\n      addStyle('minHeight');\n      addStyle('maxWidth');\n      addStyle('minWidth');\n    }\n\n    function newId() {\n      var id = ((options && options.id) || defaults.id + count++);\n      if  (null !== document.getElementById(id)) {\n        id = id + count++;\n      }\n      return id;\n    }\n\n    function ensureHasId(iframeId) {\n      logId=iframeId;\n      if (''===iframeId) {\n        iframe.id = iframeId =  newId();\n        logEnabled = (options || {}).log;\n        logId=iframeId;\n        log(iframeId,'Added missing iframe ID: '+ iframeId +' (' + iframe.src + ')');\n      }\n\n\n      return iframeId;\n    }\n\n    function setScrolling() {\n      log(iframeId,'IFrame scrolling ' + (settings[iframeId] && settings[iframeId].scrolling ? 'enabled' : 'disabled') + ' for ' + iframeId);\n      iframe.style.overflow = false === (settings[iframeId] && settings[iframeId].scrolling) ? 'hidden' : 'auto';\n      switch(settings[iframeId] && settings[iframeId].scrolling) {\n        case true:\n          iframe.scrolling = 'yes';\n          break;\n        case false:\n          iframe.scrolling = 'no';\n          break;\n        default:\n          iframe.scrolling = settings[iframeId] ? settings[iframeId].scrolling : 'no';\n      }\n    }\n\n    //The V1 iFrame script expects an int, where as in V2 expects a CSS\n    //string value such as '1px 3em', so if we have an int for V2, set V1=V2\n    //and then convert V2 to a string PX value.\n    function setupBodyMarginValues() {\n      if (('number'===typeof(settings[iframeId] && settings[iframeId].bodyMargin)) || ('0'===(settings[iframeId] && settings[iframeId].bodyMargin))) {\n        settings[iframeId].bodyMarginV1 = settings[iframeId].bodyMargin;\n        settings[iframeId].bodyMargin   = '' + settings[iframeId].bodyMargin + 'px';\n      }\n    }\n\n    function checkReset() {\n      // Reduce scope of firstRun to function, because IE8's JS execution\n      // context stack is borked and this value gets externally\n      // changed midway through running this function!!!\n      var\n        firstRun           = settings[iframeId] && settings[iframeId].firstRun,\n        resetRequertMethod = settings[iframeId] && settings[iframeId].heightCalculationMethod in resetRequiredMethods;\n\n      if (!firstRun && resetRequertMethod) {\n        resetIFrame({iframe:iframe, height:0, width:0, type:'init'});\n      }\n    }\n\n    function setupIFrameObject() {\n      if(Function.prototype.bind && settings[iframeId]) { //Ignore unpolyfilled IE8.\n        settings[iframeId].iframe.iFrameResizer = {\n\n          close        : closeIFrame.bind(null,settings[iframeId].iframe),\n\n          resize       : trigger.bind(null,'Window resize', 'resize', settings[iframeId].iframe),\n\n          moveToAnchor : function(anchor) {\n            trigger('Move to anchor','moveToAnchor:'+anchor, settings[iframeId].iframe,iframeId);\n          },\n\n          sendMessage  : function(message) {\n            message = JSON.stringify(message);\n            trigger('Send Message','message:'+message, settings[iframeId].iframe, iframeId);\n          }\n        };\n      }\n    }\n\n    //We have to call trigger twice, as we can not be sure if all\n    //iframes have completed loading when this code runs. The\n    //event listener also catches the page changing in the iFrame.\n    function init(msg) {\n      function iFrameLoaded() {\n        trigger('iFrame.onload', msg, iframe, undefined , true);\n        checkReset();\n      }\n\n      addEventListener(iframe,'load',iFrameLoaded);\n      trigger('init', msg, iframe, undefined, true);\n    }\n\n    function checkOptions(options) {\n      if ('object' !== typeof options) {\n        throw new TypeError('Options is not an object');\n      }\n    }\n\n    function copyOptions(options) {\n      for (var option in defaults) {\n        if (defaults.hasOwnProperty(option)) {\n          settings[iframeId][option] = options.hasOwnProperty(option) ? options[option] : defaults[option];\n        }\n      }\n    }\n\n    function getTargetOrigin (remoteHost) {\n      return ('' === remoteHost || 'file://' === remoteHost) ? '*' : remoteHost;\n    }\n\n    function processOptions(options) {\n      options = options || {};\n      settings[iframeId] = {\n        firstRun\t: true,\n        iframe\t\t: iframe,\n        remoteHost\t: iframe.src.split('/').slice(0,3).join('/')\n      };\n\n      checkOptions(options);\n      copyOptions(options);\n\n      if (settings[iframeId]) {\n        settings[iframeId].targetOrigin = true === settings[iframeId].checkOrigin ? getTargetOrigin(settings[iframeId].remoteHost) : '*';\n      }\n    }\n\n    function beenHere() {\n      return (iframeId in settings && 'iFrameResizer' in iframe);\n    }\n\n    var iframeId = ensureHasId(iframe.id);\n\n    if (!beenHere()) {\n      processOptions(options);\n      setScrolling();\n      setLimits();\n      setupBodyMarginValues();\n      init(createOutgoingMsg(iframeId));\n      setupIFrameObject();\n    } else {\n      warn(iframeId,'Ignored iFrame, already setup.');\n    }\n  }\n\n  function debouce(fn,time) {\n    if (null === timer) {\n      timer = setTimeout(function() {\n        timer = null;\n        fn();\n      }, time);\n    }\n  }\n\n  /* istanbul ignore next */  //Not testable in PhantomJS\n  function fixHiddenIFrames() {\n    function checkIFrames() {\n      function checkIFrame(settingId) {\n        function chkDimension(dimension) {\n          return '0px' === (settings[settingId] && settings[settingId].iframe.style[dimension]);\n        }\n\n        function isVisible(el) {\n          return (null !== el.offsetParent);\n        }\n\n        if (settings[settingId] && isVisible(settings[settingId].iframe) && (chkDimension('height') || chkDimension('width'))) {\n          trigger('Visibility change', 'resize', settings[settingId].iframe, settingId);\n        }\n      }\n\n      for (var settingId in settings) {\n        checkIFrame(settingId);\n      }\n    }\n\n    function mutationObserved(mutations) {\n      log('window','Mutation observed: ' + mutations[0].target + ' ' + mutations[0].type);\n      debouce(checkIFrames,16);\n    }\n\n    function createMutationObserver() {\n      var\n        target = document.querySelector('body'),\n\n        config = {\n          attributes            : true,\n          attributeOldValue     : false,\n          characterData         : true,\n          characterDataOldValue : false,\n          childList             : true,\n          subtree               : true\n        },\n\n        observer = new MutationObserver(mutationObserved);\n\n      observer.observe(target, config);\n    }\n\n    var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;\n\n    if (MutationObserver) createMutationObserver();\n  }\n\n\n  function resizeIFrames(event) {\n    function resize() {\n      sendTriggerMsg('Window '+event,'resize');\n    }\n\n    log('window','Trigger event: '+event);\n    debouce(resize,16);\n  }\n\n  /* istanbul ignore next */  //Not testable in PhantomJS\n  function tabVisible() {\n    function resize() {\n      sendTriggerMsg('Tab Visable','resize');\n    }\n\n    if('hidden' !== document.visibilityState) {\n      log('document','Trigger event: Visiblity change');\n      debouce(resize,16);\n    }\n  }\n\n  function sendTriggerMsg(eventName,event) {\n    function isIFrameResizeEnabled(iframeId) {\n      return\tsettings[iframeId] &&\n          'parent' === settings[iframeId].resizeFrom &&\n          settings[iframeId].autoResize &&\n          !settings[iframeId].firstRun;\n    }\n\n    for (var iframeId in settings) {\n      if(isIFrameResizeEnabled(iframeId)) {\n        trigger(eventName, event, document.getElementById(iframeId), iframeId);\n      }\n    }\n  }\n\n  function setupEventListeners() {\n    addEventListener(window,'message',iFrameListener);\n\n    addEventListener(window,'resize', function() {resizeIFrames('resize');});\n\n    addEventListener(document,'visibilitychange',tabVisible);\n    addEventListener(document,'-webkit-visibilitychange',tabVisible); //Andriod 4.4\n    addEventListener(window,'focusin',function() {resizeIFrames('focus');}); //IE8-9\n    addEventListener(window,'focus',function() {resizeIFrames('focus');});\n  }\n\n\n  function factory() {\n    function init(options,element) {\n      function chkType() {\n        if(!element.tagName) {\n          throw new TypeError('Object is not a valid DOM element');\n        } else if ('IFRAME' !== element.tagName.toUpperCase()) {\n          throw new TypeError('Expected <IFRAME> tag, found <'+element.tagName+'>');\n        }\n      }\n\n      if(element) {\n        chkType();\n        setupIFrame(element, options);\n        iFrames.push(element);\n      }\n    }\n\n    function warnDeprecatedOptions(options) {\n      if (options && options.enablePublicMethods) {\n        warn('enablePublicMethods option has been removed, public methods are now always available in the iFrame');\n      }\n    }\n\n    var iFrames;\n\n    setupRequestAnimationFrame();\n    setupEventListeners();\n\n    return function iFrameResizeF(options,target) {\n      iFrames = []; //Only return iFrames past in on this call\n\n      warnDeprecatedOptions(options);\n\n      switch (typeof(target)) {\n      case 'undefined':\n      case 'string':\n        Array.prototype.forEach.call(\n          document.querySelectorAll( target || 'iframe' ),\n          init.bind(undefined, options)\n        );\n        break;\n      case 'object':\n        init(options,target);\n        break;\n      default:\n        throw new TypeError('Unexpected data type ('+typeof(target)+')');\n      }\n\n      return iFrames;\n    };\n  }\n\n  function createJQueryPublicMethod($) {\n    if (!$.fn) {\n      info('','Unable to bind to jQuery, it is not fully loaded.');\n    } else if (!$.fn.iFrameResize) {\n      $.fn.iFrameResize = function $iFrameResizeF(options) {\n        function init(index, element) {\n          setupIFrame(element, options);\n        }\n\n        return this.filter('iframe').each(init).end();\n      };\n    }\n  }\n\n  if (window.jQuery) { createJQueryPublicMethod(window.jQuery); }\n\n  if (typeof define === 'function' && define.amd) {\n    define([],factory);\n  } else if (typeof module === 'object' && typeof module.exports === 'object') { //Node for browserfy\n    module.exports = factory();\n  } else {\n    window.iFrameResize = window.iFrameResize || factory();\n  }\n\n})();\n"]}