rails-iframe-resizer 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iframeResizer.contentWindow.min.js","sources":["iframeResizer.contentWindow.js"],"names":["addEventListener","el","evt","func","window","attachEvent","formatLogMsg","msg","msgID","myID","log","logging","console","warn","init","readData","setMargin","setBodyStyle","bodyBackground","bodyPadding","injectClearFixIntoBodyElement","checkHeightMode","stopInfiniteResizingOfIFrame","setupPublicMethods","startEventListeners","sendSize","strBool","str","data","initMsg","substr","msgIdLen","split","bodyMargin","undefined","Number","calculateWidth","interval","publicMethods","autoResize","bodyMarginStr","heightCalcMode","tolerance","chkCSS","attr","value","indexOf","document","body","style","documentElement","height","initWindowResizeListener","initWindowClickListener","heightCalcModeDefault","getHeight","setupMutationObserver","clearFix","createElement","clear","display","appendChild","parentIFrame","close","getId","reset","resetIFrame","scrollTo","x","y","sendMsg","scrollToOffset","sendMessage","targetOrigin","JSON","stringify","setHeightCalculationMethod","heightCalculationMethod","setTargetOrigin","targetOriginDefault","size","customHeight","customWidth","valString","lockTrigger","initInterval","setInterval","Math","abs","setupInjectElementLoadListners","mutations","addLoadListener","element","width","src","forEach","mutation","type","attributeName","target","images","querySelectorAll","Array","prototype","call","image","createMutationObserver","querySelector","config","attributes","attributeOldValue","characterData","characterDataOldValue","childList","subtree","observer","MutationObserver","observe","WebKitMutationObserver","getBodyOffsetHeight","getComputedBodyStyle","prop","convertUnitsToPxForIE8","PIXEL","test","parseInt","base","left","runtimeStyle","currentStyle","pixelLeft","retVal","defaultView","getComputedStyle","offsetHeight","getBodyScrollHeight","scrollHeight","getDEOffsetHeight","getDEScrollHeight","getLowestElementHeight","allElements","allElementsLength","length","maxBottomVal","timer","Date","getTime","i","getBoundingClientRect","bottom","getAllHeights","getMaxHeight","max","apply","getMinHeight","min","getBestHeight","getWidth","scrollWidth","triggerEvent","triggerEventDesc","recordTrigger","resetPage","resizeIFrame","currentHeight","currentWidth","isDoubleFiredEvent","triggerLocked","doubleEventList","isSizeChangeDetected","checkTolarance","a","b","isForceResizableEvent","isForceResizableHeightCalcMode","resetRequiredMethods","logIgnored","checkDownSizing","clearTimeout","triggerLockedTimer","setTimeout","eventCancelTimer","triggerReset","hcm","sendToParent","message","postMessage","receiver","event","isMessageForUs","initFromParent","source","firstRun","initLock","resetFromParent","getMessageType","isMiddleTier","isInitMsg","true","false","resize","click","scroll","bodyScroll","documentElementScroll","parent","offset","bodyOffset","documentElementOffset","grow","lowestElement"],"mappings":";;;;;;;;CASC,WACA,YAiCA,SAASA,GAAiBC,EAAGC,EAAIC,GAC5B,oBAAsBC,QACzBH,EAAGD,iBAAiBE,EAAIC,GAAM,GACpB,eAAiBC,SAC3BH,EAAGI,YAAY,KAAKH,EAAIC,GAI1B,QAASG,GAAaC,GACrB,MAAOC,GAAQ,IAAMC,GAAO,KAAYF,EAGzC,QAASG,GAAIH,GACRI,GAAY,gBAAoBP,QAAOQ,SAC1CA,QAAQF,IAAIJ,EAAaC,IAI3B,QAASM,GAAKN,GACT,gBAAoBH,QAAOQ,SAC9BA,QAAQC,KAAKP,EAAaC,IAK5B,QAASO,KACRJ,EAAI,uBACJK,IACAC,IACAC,EAAa,aAAaC,GAC1BD,EAAa,UAAUE,GACvBC,IACAC,IACAC,IACAC,IACAC,IACAC,EAAS,OAAO,+BAGjB,QAASV,KAIR,QAASW,GAAQC,GAChB,MAAO,SAAWA,GAAM,GAAO,EAHhC,GAAIC,GAAOC,EAAQC,OAAOC,GAAUC,MAAM,IAM1CvB,IAAmBmB,EAAK,GACxBK,EAAoBC,SAAcN,EAAK,GAAMO,OAAOP,EAAK,IAAQK,EACjEG,EAAoBF,SAAcN,EAAK,GAAMF,EAAQE,EAAK,IAAOQ,EACjEzB,EAAoBuB,SAAcN,EAAK,GAAMF,EAAQE,EAAK,IAAOjB,EACjE0B,EAAoBH,SAAcN,EAAK,GAAMO,OAAOP,EAAK,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GAAMhK,KAAKI,MAAM,KAAK,GAG9B,QAASoK,KACR,MAAQ,gBAAkBhM,QAG3B,QAASiM,KAGR,MAAOT,GAAMhK,KAAKI,MAAM,KAAK,KAAOsK,OAAO,EAAEC,QAAQ,GAGlDV,MACCG,GAAYK,IACfP,IACU,UAAYK,IACtBD,IACUN,EAAMhK,OAASC,GAAYuK,KACrCvL,EAAK,uBAAuB+K,EAAMhK,KAAK,MA9iB1C,GACCW,IAAwB,EACxBuF,EAAwB,GACxB5G,EAAwB,GACxBe,EAAwB,EACxBO,EAAwB,GACxBrB,EAAwB,GACxBiB,GAAwB,EACxBoI,GAAyBgC,OAAS,EAAEC,MAAQ,GAC5CpB,EAAwB,IACxBlI,EAAwB,EACxB6I,GAAwB,EACxB1I,EAAwB,SACxBb,EAAwBa,EACxB2I,GAAwB,EACxBpK,EAAwB,GACxBQ,EAAwB,GACxB1B,GAAwB,EACxBH,EAAwB,gBACxBuB,EAAwBvB,EAAMsI,OAC9BrI,GAAwB,GACxB6B,IAAwB,EACxByI,IAAyBvB,IAAI,EAAEkD,OAAO,EAAEC,WAAW,EAAEC,sBAAsB,GAC3E7H,GAAwB,IACxBoB,GAAwB/F,OAAOyM,OAC/BnK,GAAwB,EACxB6H,IAAwB,EACxBY,GAAwB,KACxBtF,GAAwB,EAuVrBtC,IACHuJ,OAAwBvF,EACxBwF,WAAwBxF,EACxBoF,WAAwBpE,EACxByE,sBAAwBvE,EACxBiE,OAAwBhE,EACxBkE,sBAAwBlE,EACxBc,IAAwBD,EACxBI,IAAwBD,EACxBuD,KAAwB1D,EACxB2D,cAAwBtD,EAsLzB5J,GAAiBI,OAAQ,UAAWuL","sourcesContent":["/*\n * File: iframeSizer.contentWindow.js\n * Desc: Include this file in any page being loaded into an iframe\n * to force the iframe to resize to the content size.\n * Requires: iframeResizer.js on host page.\n * Author: David J. Bradshaw - dave@bradshaw.net\n * Contributor: Jure Mav - jure.mav@gmail.com\n */\n\n;(function() {\n\t'use strict';\n\n\tvar\n\t\tautoResize = true,\n\t\tbase = 10,\n\t\tbodyBackground = '',\n\t\tbodyMargin = 0,\n\t\tbodyMarginStr = '',\n\t\tbodyPadding = '',\n\t\tcalculateWidth = false,\n\t\tdoubleEventList = {'resize':1,'click':1},\n\t\teventCancelTimer = 128,\n\t\theight = 1,\n\t\tfirstRun = true,\n\t\theightCalcModeDefault = 'offset',\n\t\theightCalcMode = heightCalcModeDefault,\n\t\tinitLock = true,\n\t\tinitMsg = '',\n\t\tinterval = 32,\n\t\tlogging = false,\n\t\tmsgID = '[iFrameSizer]', //Must match host page msg ID\n\t\tmsgIdLen = msgID.length,\n\t\tmyID = '',\n\t\tpublicMethods = false,\n\t\tresetRequiredMethods = {max:1,scroll:1,bodyScroll:1,documentElementScroll:1},\n\t\ttargetOriginDefault = '*',\n\t\ttarget = window.parent,\n\t\ttolerance = 0,\n\t\ttriggerLocked = false,\n\t\ttriggerLockedTimer = null,\n\t\twidth = 1;\n\n\n\tfunction addEventListener(el,evt,func){\n\t\tif ('addEventListener' in window){\n\t\t\tel.addEventListener(evt,func, false);\n\t\t} else if ('attachEvent' in window){ //IE\n\t\t\tel.attachEvent('on'+evt,func);\n\t\t}\n\t}\n\n\tfunction formatLogMsg(msg){\n\t\treturn msgID + '[' + myID + ']' + ' ' + msg;\n\t}\n\n\tfunction log(msg){\n\t\tif (logging && ('object' === typeof window.console)){\n\t\t\tconsole.log(formatLogMsg(msg));\n\t\t}\n\t}\n\n\tfunction warn(msg){\n\t\tif ('object' === typeof window.console){\n\t\t\tconsole.warn(formatLogMsg(msg));\n\t\t}\n\t}\n\n\n\tfunction init(){\n\t\tlog('Initialising iFrame');\n\t\treadData();\n\t\tsetMargin();\n\t\tsetBodyStyle('background',bodyBackground);\n\t\tsetBodyStyle('padding',bodyPadding);\n\t\tinjectClearFixIntoBodyElement();\n\t\tcheckHeightMode();\n\t\tstopInfiniteResizingOfIFrame();\n\t\tsetupPublicMethods();\n\t\tstartEventListeners();\n\t\tsendSize('init','Init message from host page');\n\t}\n\n\tfunction readData(){\n\n\t\tvar data = initMsg.substr(msgIdLen).split(':');\n\n\t\tfunction strBool(str){\n\t\t\treturn 'true' === str ? true : false;\n\t\t}\n\n\t\tmyID = data[0];\n\t\tbodyMargin = (undefined !== data[1]) ? Number(data[1]) : bodyMargin; //For V1 compatibility\n\t\tcalculateWidth = (undefined !== data[2]) ? strBool(data[2]) : calculateWidth;\n\t\tlogging = (undefined !== data[3]) ? strBool(data[3]) : logging;\n\t\tinterval = (undefined !== data[4]) ? Number(data[4]) : interval;\n\t\tpublicMethods = (undefined !== data[5]) ? strBool(data[5]) : publicMethods;\n\t\tautoResize = (undefined !== data[6]) ? strBool(data[6]) : autoResize;\n\t\tbodyMarginStr = data[7];\n\t\theightCalcMode = (undefined !== data[8]) ? data[8] : heightCalcMode;\n\t\tbodyBackground = data[9];\n\t\tbodyPadding = data[10];\n\t\ttolerance = (undefined !== data[11]) ? Number(data[11]) : tolerance;\n\t}\n\n\tfunction chkCSS(attr,value){\n\t\tif (-1 !== value.indexOf('-')){\n\t\t\twarn('Negative CSS value ignored for '+attr);\n\t\t\tvalue='';\n\t\t}\n\t\treturn value;\n\t}\n\n\tfunction setBodyStyle(attr,value){\n\t\tif ((undefined !== value) && ('' !== value) && ('null' !== value)){\n\t\t\tdocument.body.style[attr] = value;\n\t\t\tlog('Body '+attr+' set to \"'+value+'\"');\n\t\t}\n\t}\n\n\tfunction setMargin(){\n\t\t//If called via V1 script, convert bodyMargin from int to str \n\t\tif (undefined === bodyMarginStr){\n\t\t\tbodyMarginStr = bodyMargin+'px';\n\t\t}\n\t\tchkCSS('margin',bodyMarginStr);\n\t\tsetBodyStyle('margin',bodyMarginStr);\n\t}\n\n\tfunction stopInfiniteResizingOfIFrame(){\n\t\tdocument.documentElement.style.height = '';\n\t\tdocument.body.style.height = '';\n\t\tlog('HTML & body height set to \"auto\"');\n\t}\n\n\tfunction initWindowResizeListener(){\n\t\taddEventListener(window,'resize', function(){\n\t\t\tsendSize('resize','Window resized');\n\t\t});\n\t}\n\n\tfunction initWindowClickListener(){\n\t\taddEventListener(window,'click', function(){\n\t\t\tsendSize('click','Window clicked');\n\t\t});\n\t}\n\n\tfunction checkHeightMode(){\n\t\tif (heightCalcModeDefault !== heightCalcMode){\n\t\t\tif (!(heightCalcMode in getHeight)){\n\t\t\t\twarn(heightCalcMode + ' is not a valid option for heightCalculationMethod.');\n\t\t\t\theightCalcMode='bodyScroll';\n\t\t\t}\n\t\t\tlog('Height calculation method set to \"'+heightCalcMode+'\"');\n\t\t}\n\t}\n\n\tfunction startEventListeners(){\n\t\tif ( true === autoResize ) {\n\t\t\tinitWindowResizeListener();\n\t\t\tinitWindowClickListener();\n\t\t\tsetupMutationObserver();\n\t\t}\n\t\telse {\n\t\t\tlog('Auto Resize disabled');\n\t\t}\n\t}\n\n\tfunction injectClearFixIntoBodyElement(){\n\t\tvar clearFix = document.createElement('div');\n\t\tclearFix.style.clear = 'both';\n\t\tclearFix.style.display = 'block'; //Guard against this having been globally redefined in CSS.\n\t\tdocument.body.appendChild(clearFix);\n\t}\n\n\tfunction setupPublicMethods(){\n\t\tif (publicMethods) {\n\t\t\tlog('Enable public methods');\n\n\t\t\twindow.parentIFrame = {\n\t\t\t\tclose: function closeF(){\n\t\t\t\t\tsendSize('close','parentIFrame.close()', 0, 0);\n\t\t\t\t},\n\t\t\t\tgetId: function getIdF(){\n\t\t\t\t\treturn myID;\n\t\t\t\t},\n\t\t\t\treset: function resetF(){\n\t\t\t\t\tresetIFrame('parentIFrame.size');\n\t\t\t\t},\n\t\t\t\tscrollTo: function scrollToF(x,y){\n\t\t\t\t\tsendMsg(y,x,'scrollTo'); // X&Y reversed at sendMsg uses hieght/width\n\t\t\t\t},\n\t\t\t\tscrollToOffset: function scrollToF(x,y){\n\t\t\t\t\tsendMsg(y,x,'scrollToOffset'); // X&Y reversed at sendMsg uses hieght/width\n\t\t\t\t},\n\t\t\t\tsendMessage: function sendMessageF(msg,targetOrigin){\n\t\t\t\t\tsendMsg(0,0,'message',JSON.stringify(msg),targetOrigin);\n\t\t\t\t},\n\t\t\t\tsetHeightCalculationMethod: function setHeightCalculationMethodF(heightCalculationMethod){\n\t\t\t\t\theightCalcMode = heightCalculationMethod;\n\t\t\t\t\tcheckHeightMode();\n\t\t\t\t},\n\t\t\t\tsetTargetOrigin: function setTargetOriginF(targetOrigin){\n\t\t\t\t\tlog('Set targetOrigin: '+targetOrigin);\n\t\t\t\t\ttargetOriginDefault = targetOrigin;\n\t\t\t\t},\n\t\t\t\tsize: function sizeF(customHeight, customWidth){\n\t\t\t\t\tvar valString = ''+(customHeight?customHeight:'')+(customWidth?','+customWidth:'');\n\t\t\t\t\tlockTrigger();\n\t\t\t\t\tsendSize('size','parentIFrame.size('+valString+')', customHeight, customWidth);\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t}\n\n\tfunction initInterval(){\n\t\tif ( 0 !== interval ){\n\t\t\tlog('setInterval: '+interval+'ms');\n\t\t\tsetInterval(function(){\n\t\t\t\tsendSize('interval','setInterval: '+interval);\n\t\t\t},Math.abs(interval));\n\t\t}\n\t}\n\n\tfunction setupInjectElementLoadListners(mutations){\n\t\tfunction addLoadListener(element){\n\t\t\tif (element.height === undefined || element.width === undefined || 0 === element.height || 0 === element.width){\n\t\t\t\tlog('Attach listerner to '+element.src);\n\t\t\t\taddEventListener(element,'load', function imageLoaded(){\n\t\t\t\t\tsendSize('imageLoad','Image loaded');\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tmutations.forEach(function (mutation) {\n\t\t\tif (mutation.type === 'attributes' && mutation.attributeName === 'src'){\n\t\t\t\taddLoadListener(mutation.target);\n\t\t\t} else if (mutation.type === 'childList'){\n\t\t\t\tvar images = mutation.target.querySelectorAll('img');\n\t\t\t\tArray.prototype.forEach.call(images,function (image) {\n\t\t\t\t\taddLoadListener(image);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n\n\tfunction setupMutationObserver(){\n\n\t\tvar MutationObserver = window.MutationObserver || window.WebKitMutationObserver;\n\n\t\tfunction createMutationObserver(){\n\t\t\tvar\n\t\t\t\ttarget = document.querySelector('body'),\n\n\t\t\t\tconfig = {\n\t\t\t\t\tattributes : true,\n\t\t\t\t\tattributeOldValue : false,\n\t\t\t\t\tcharacterData : true,\n\t\t\t\t\tcharacterDataOldValue : false,\n\t\t\t\t\tchildList : true,\n\t\t\t\t\tsubtree : true\n\t\t\t\t},\n\n\t\t\t\tobserver = new MutationObserver(function(mutations) {\n\t\t\t\t\tsendSize('mutationObserver','mutationObserver: ' + mutations[0].target + ' ' + mutations[0].type);\n\t\t\t\t\tsetupInjectElementLoadListners(mutations); //Deal with WebKit asyncing image loading when tags are injected into the page\n\t\t\t\t});\n\n\t\t\tlog('Enable MutationObserver');\n\t\t\tobserver.observe(target, config);\n\t\t}\n\n\t\tif (MutationObserver){\n\t\t\tif (0 > interval) {\n\t\t\t\tinitInterval();\n\t\t\t} else {\n\t\t\t\tcreateMutationObserver();\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\twarn('MutationObserver not supported in this browser!');\n\t\t\tinitInterval();\n\t\t}\n\t}\n\n\n\t// document.documentElement.offsetHeight is not reliable, so\n\t// we have to jump through hoops to get a better value.\n\tfunction getBodyOffsetHeight(){\n\t\tfunction getComputedBodyStyle(prop) {\n\t\t\tfunction convertUnitsToPxForIE8(value) {\n\t\t\t\tvar PIXEL = /^\\d+(px)?$/i;\n\n\t\t\t\tif (PIXEL.test(value)) {\n\t\t\t\t\treturn parseInt(value,base);\n\t\t\t\t}\n\n\t\t\t\tvar\n\t\t\t\t\tstyle = el.style.left,\n\t\t\t\t\truntimeStyle = el.runtimeStyle.left;\n\n\t\t\t\tel.runtimeStyle.left = el.currentStyle.left;\n\t\t\t\tel.style.left = value || 0;\n\t\t\t\tvalue = el.style.pixelLeft;\n\t\t\t\tel.style.left = style;\n\t\t\t\tel.runtimeStyle.left = runtimeStyle;\n\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\tvar\n\t\t\t\tel = document.body,\n\t\t\t\tretVal = 0;\n\n\t\t\tif (('defaultView' in document) && ('getComputedStyle' in document.defaultView)) {\n\t\t\t\tretVal = document.defaultView.getComputedStyle(el, null);\n\t\t\t\tretVal = (null !== retVal) ? retVal[prop] : 0;\n\t\t\t} else {//IE8\n\t\t\t\tretVal = convertUnitsToPxForIE8(el.currentStyle[prop]);\n\t\t\t}\n\n\t\t\treturn parseInt(retVal,base);\n\t\t}\n\n\t\treturn document.body.offsetHeight +\n\t\t\t\tgetComputedBodyStyle('marginTop') +\n\t\t\t\tgetComputedBodyStyle('marginBottom');\n\t}\n\n\tfunction getBodyScrollHeight(){\n\t\treturn document.body.scrollHeight;\n\t}\n\n\tfunction getDEOffsetHeight(){\n\t\treturn document.documentElement.offsetHeight;\n\t}\n\n\tfunction getDEScrollHeight(){\n\t\treturn document.documentElement.scrollHeight;\n\t}\n\n\t//From https://github.com/guardian/iframe-messenger\n\tfunction getLowestElementHeight() {\n\t\tvar\n\t\t\tallElements = document.querySelectorAll('body *'),\n\t\t\tallElementsLength = allElements.length,\n\t\t\tmaxBottomVal = 0,\n\t\t\ttimer = new Date().getTime();\n\n\t\tfor (var i = 0; i < allElementsLength; i++) {\n\t\t\tif (allElements[i].getBoundingClientRect().bottom > maxBottomVal) {\n\t\t\t\tmaxBottomVal = allElements[i].getBoundingClientRect().bottom;\n\t\t\t}\n\t\t}\n\n\t\ttimer = new Date().getTime() - timer;\n\n\t\tlog('Parsed '+allElementsLength+' HTML elements');\n\t\tlog('LowestElement bottom position calculated in ' + timer + 'ms');\n\n\t\treturn maxBottomVal;\n\t}\n\n\tfunction getAllHeights(){\n\t\treturn [\n\t\t\tgetBodyOffsetHeight(),\n\t\t\tgetBodyScrollHeight(),\n\t\t\tgetDEOffsetHeight(),\n\t\t\tgetDEScrollHeight()\n\t\t];\n\t}\n\n\tfunction getMaxHeight(){\n\t\treturn Math.max.apply(null,getAllHeights());\n\t}\n\n\tfunction getMinHeight(){\n\t\treturn Math.min.apply(null,getAllHeights());\n\t}\n\n\tfunction getBestHeight(){\n\t\treturn Math.max(getBodyOffsetHeight(),getLowestElementHeight());\n\t}\n\n\tvar getHeight = {\n\t\toffset : getBodyOffsetHeight, //Backward compatability\n\t\tbodyOffset : getBodyOffsetHeight,\n\t\tbodyScroll : getBodyScrollHeight,\n\t\tdocumentElementOffset : getDEOffsetHeight,\n\t\tscroll : getDEScrollHeight, //Backward compatability\n\t\tdocumentElementScroll : getDEScrollHeight,\n\t\tmax : getMaxHeight,\n\t\tmin : getMinHeight,\n\t\tgrow : getMaxHeight,\n\t\tlowestElement : getBestHeight\n\t};\n\n\tfunction getWidth(){\n\t\treturn Math.max(\n\t\t\tdocument.documentElement.scrollWidth,\n\t\t\tdocument.body.scrollWidth\n\t\t);\n\t}\n\n\tfunction sendSize(triggerEvent, triggerEventDesc, customHeight, customWidth){\n\n\t\tvar\tcurrentHeight,currentWidth;\n\n\t\tfunction recordTrigger(){\n\t\t\tif (!(triggerEvent in {'reset':1,'resetPage':1,'init':1})){\n\t\t\t\tlog( 'Trigger event: ' + triggerEventDesc );\n\t\t\t}\n\t\t}\n\n\t\tfunction resizeIFrame(){\n\t\t\theight = currentHeight;\n\t\t\twidth = currentWidth;\n\n\t\t\tsendMsg(height,width,triggerEvent);\n\t\t}\n\n\t\tfunction isDoubleFiredEvent(){\n\t\t\treturn triggerLocked && (triggerEvent in doubleEventList);\n\t\t}\n\n\t\tfunction isSizeChangeDetected(){\n\t\t\tfunction checkTolarance(a,b){\n\t\t\t\tvar retVal = Math.abs(a-b) <= tolerance;\n\t\t\t\treturn !retVal;\n\t\t\t}\n\n\t\t\tcurrentHeight = (undefined !== customHeight) ? customHeight : getHeight[heightCalcMode]();\n\t\t\tcurrentWidth = (undefined !== customWidth ) ? customWidth : getWidth();\n\n\t\t\treturn\tcheckTolarance(height,currentHeight) ||\n\t\t\t\t\t(calculateWidth && checkTolarance(width,currentWidth));\n\n\t\t\t//return\t(height !== currentHeight) ||\n\t\t\t//\t\t(calculateWidth && width !== currentWidth);\n\t\t}\n\n\t\tfunction isForceResizableEvent(){\n\t\t\treturn !(triggerEvent in {'init':1,'interval':1,'size':1});\n\t\t}\n\n\t\tfunction isForceResizableHeightCalcMode(){\n\t\t\treturn (heightCalcMode in resetRequiredMethods);\n\t\t}\n\n\t\tfunction logIgnored(){\n\t\t\tlog('No change in size detected');\n\t\t}\n\n\t\tfunction checkDownSizing(){\n\t\t\tif (isForceResizableEvent() && isForceResizableHeightCalcMode()){\n\t\t\t\tresetIFrame(triggerEventDesc);\n\t\t\t} else if (!(triggerEvent in {'interval':1})){\n\t\t\t\trecordTrigger();\n\t\t\t\tlogIgnored();\n\t\t\t}\n\t\t}\n\n\t\tif (!isDoubleFiredEvent()){\n\t\t\tif (isSizeChangeDetected()){\n\t\t\t\trecordTrigger();\n\t\t\t\tlockTrigger();\n\t\t\t\tresizeIFrame();\n\t\t\t} else {\n\t\t\t\tcheckDownSizing();\n\t\t\t}\n\t\t} else {\n\t\t\tlog('Trigger event cancelled: '+triggerEvent);\n\t\t}\n\t}\n\n\tfunction lockTrigger(){\n\t\tif (!triggerLocked){\n\t\t\ttriggerLocked = true;\n\t\t\tlog('Trigger event lock on');\n\t\t}\n\t\tclearTimeout(triggerLockedTimer);\n\t\ttriggerLockedTimer = setTimeout(function(){\n\t\t\ttriggerLocked = false;\n\t\t\tlog('Trigger event lock off');\n\t\t\tlog('--');\n\t\t},eventCancelTimer);\n\t}\n\n\tfunction triggerReset(triggerEvent){\n\t\theight = getHeight[heightCalcMode]();\n\t\twidth = getWidth();\n\n\t\tsendMsg(height,width,triggerEvent);\n\t}\n\n\tfunction resetIFrame(triggerEventDesc){\n\t\tvar hcm = heightCalcMode;\n\t\theightCalcMode = heightCalcModeDefault;\n\n\t\tlog('Reset trigger event: ' + triggerEventDesc);\n\t\tlockTrigger();\n\t\ttriggerReset('reset');\n\n\t\theightCalcMode = hcm;\n\t}\n\n\tfunction sendMsg(height,width,triggerEvent,msg,targetOrigin){\n\t\tfunction setTargetOrigin(){\n\t\t\tif (undefined === targetOrigin){\n\t\t\t\ttargetOrigin = targetOriginDefault;\n\t\t\t} else {\n\t\t\t\tlog('Message targetOrigin: '+targetOrigin);\n\t\t\t}\n\t\t}\n\n\t\tfunction sendToParent(){\n\t\t\tvar\n\t\t\t\tsize = height + ':' + width,\n\t\t\t\tmessage = myID + ':' + size + ':' + triggerEvent + (undefined !== msg ? ':' + msg : '');\n\n\t\t\tlog('Sending message to host page (' + message + ')');\n\t\t\ttarget.postMessage( msgID + message, targetOrigin);\n\t\t}\n\n\t\tsetTargetOrigin();\n\t\tsendToParent();\n\t}\n\n\tfunction receiver(event) {\n\t\tfunction isMessageForUs(){\n\t\t\treturn msgID === (''+event.data).substr(0,msgIdLen); //''+ Protects against non-string messages\n\t\t}\n\n\t\tfunction initFromParent(){\n\t\t\tinitMsg = event.data;\n\t\t\ttarget = event.source;\n\n\t\t\tinit();\n\t\t\tfirstRun = false;\n\t\t\tsetTimeout(function(){ initLock = false;},eventCancelTimer);\n\t\t}\n\n\t\tfunction resetFromParent(){\n\t\t\tif (!initLock){\n\t\t\t\tlog('Page size reset by host page');\n\t\t\t\ttriggerReset('resetPage');\n\t\t\t} else {\n\t\t\t\tlog('Page reset ignored by init');\n\t\t\t}\n\t\t}\n\n\t\tfunction getMessageType(){\n\t\t\treturn event.data.split(']')[1];\n\t\t}\n\n\t\tfunction isMiddleTier(){\n\t\t\treturn ('iFrameResize' in window);\n\t\t}\n\n\t\tfunction isInitMsg(){\n\t\t\t//test if this message is from a child below us. This is an ugly test, however, updating\n\t\t\t//the message format would break backwards compatibity.\n\t\t\treturn event.data.split(':')[2] in {'true':1,'false':1};\n\t\t}\n\n\t\tif (isMessageForUs()){\n\t\t\tif (firstRun && isInitMsg()){ //Check msg ID\n\t\t\t\tinitFromParent();\n\t\t\t} else if ('reset' === getMessageType()){\n\t\t\t\tresetFromParent();\n\t\t\t} else if (event.data !== initMsg && !isMiddleTier()){\n\t\t\t\twarn('Unexpected message ('+event.data+')');\n\t\t\t}\n\t\t}\n\t}\n\n\taddEventListener(window, 'message', receiver);\n\n})();\n"]}
@@ -0,0 +1,9 @@
1
+ /*! iFrame Resizer (iframeSizer.contentWindow.min.js) - v2.7.1 - 2014-12-12
2
+ * Desc: Include this file in any page being loaded into an iframe
3
+ * to force the iframe to resize to the content size.
4
+ * Requires: iframeResizer.min.js on host page.
5
+ * Copyright: (c) 2014 David J. Bradshaw - dave@bradshaw.net
6
+ * License: MIT
7
+ */
8
+
9
+ !function(){"use strict";function a(a,b,c){"addEventListener"in window?a.addEventListener(b,c,!1):"attachEvent"in window&&a.attachEvent("on"+b,c)}function b(a){return $+"["+ab+"] "+a}function c(a){Z&&"object"==typeof window.console&&console.log(b(a))}function d(a){"object"==typeof window.console&&console.warn(b(a))}function e(){c("Initialising iFrame"),f(),i(),h("background",L),h("padding",O),o(),m(),j(),p(),n(),D("init","Init message from host page")}function f(){function a(a){return"true"===a?!0:!1}var b=X.substr(_).split(":");ab=b[0],M=void 0!==b[1]?Number(b[1]):M,P=void 0!==b[2]?a(b[2]):P,Z=void 0!==b[3]?a(b[3]):Z,Y=void 0!==b[4]?Number(b[4]):Y,bb=void 0!==b[5]?a(b[5]):bb,J=void 0!==b[6]?a(b[6]):J,N=b[7],V=void 0!==b[8]?b[8]:V,L=b[9],O=b[10],fb=void 0!==b[11]?Number(b[11]):fb}function g(a,b){return-1!==b.indexOf("-")&&(d("Negative CSS value ignored for "+a),b=""),b}function h(a,b){void 0!==b&&""!==b&&"null"!==b&&(document.body.style[a]=b,c("Body "+a+' set to "'+b+'"'))}function i(){void 0===N&&(N=M+"px"),g("margin",N),h("margin",N)}function j(){document.documentElement.style.height="",document.body.style.height="",c('HTML & body height set to "auto"')}function k(){a(window,"resize",function(){D("resize","Window resized")})}function l(){a(window,"click",function(){D("click","Window clicked")})}function m(){U!==V&&(V in jb||(d(V+" is not a valid option for heightCalculationMethod."),V="bodyScroll"),c('Height calculation method set to "'+V+'"'))}function n(){!0===J?(k(),l(),s()):c("Auto Resize disabled")}function o(){var a=document.createElement("div");a.style.clear="both",a.style.display="block",document.body.appendChild(a)}function p(){bb&&(c("Enable public methods"),window.parentIFrame={close:function(){D("close","parentIFrame.close()",0,0)},getId:function(){return ab},reset:function(){G("parentIFrame.size")},scrollTo:function(a,b){H(b,a,"scrollTo")},scrollToOffset:function(a,b){H(b,a,"scrollToOffset")},sendMessage:function(a,b){H(0,0,"message",JSON.stringify(a),b)},setHeightCalculationMethod:function(a){V=a,m()},setTargetOrigin:function(a){c("Set targetOrigin: "+a),db=a},size:function(a,b){var c=""+(a?a:"")+(b?","+b:"");E(),D("size","parentIFrame.size("+c+")",a,b)}})}function q(){0!==Y&&(c("setInterval: "+Y+"ms"),setInterval(function(){D("interval","setInterval: "+Y)},Math.abs(Y)))}function r(b){function d(b){(void 0===b.height||void 0===b.width||0===b.height||0===b.width)&&(c("Attach listerner to "+b.src),a(b,"load",function(){D("imageLoad","Image loaded")}))}b.forEach(function(a){if("attributes"===a.type&&"src"===a.attributeName)d(a.target);else if("childList"===a.type){var b=a.target.querySelectorAll("img");Array.prototype.forEach.call(b,function(a){d(a)})}})}function s(){function a(){var a=document.querySelector("body"),d={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0},e=new b(function(a){D("mutationObserver","mutationObserver: "+a[0].target+" "+a[0].type),r(a)});c("Enable MutationObserver"),e.observe(a,d)}var b=window.MutationObserver||window.WebKitMutationObserver;b?0>Y?q():a():(d("MutationObserver not supported in this browser!"),q())}function t(){function a(a){function b(a){var b=/^\d+(px)?$/i;if(b.test(a))return parseInt(a,K);var d=c.style.left,e=c.runtimeStyle.left;return c.runtimeStyle.left=c.currentStyle.left,c.style.left=a||0,a=c.style.pixelLeft,c.style.left=d,c.runtimeStyle.left=e,a}var c=document.body,d=0;return"defaultView"in document&&"getComputedStyle"in document.defaultView?(d=document.defaultView.getComputedStyle(c,null),d=null!==d?d[a]:0):d=b(c.currentStyle[a]),parseInt(d,K)}return document.body.offsetHeight+a("marginTop")+a("marginBottom")}function u(){return document.body.scrollHeight}function v(){return document.documentElement.offsetHeight}function w(){return document.documentElement.scrollHeight}function x(){for(var a=document.querySelectorAll("body *"),b=a.length,d=0,e=(new Date).getTime(),f=0;b>f;f++)a[f].getBoundingClientRect().bottom>d&&(d=a[f].getBoundingClientRect().bottom);return e=(new Date).getTime()-e,c("Parsed "+b+" HTML elements"),c("LowestElement bottom position calculated in "+e+"ms"),d}function y(){return[t(),u(),v(),w()]}function z(){return Math.max.apply(null,y())}function A(){return Math.min.apply(null,y())}function B(){return Math.max(t(),x())}function C(){return Math.max(document.documentElement.scrollWidth,document.body.scrollWidth)}function D(a,b,d,e){function f(){a in{reset:1,resetPage:1,init:1}||c("Trigger event: "+b)}function g(){S=n,ib=o,H(S,ib,a)}function h(){return gb&&a in Q}function i(){function a(a,b){var c=Math.abs(a-b)<=fb;return!c}return n=void 0!==d?d:jb[V](),o=void 0!==e?e:C(),a(S,n)||P&&a(ib,o)}function j(){return!(a in{init:1,interval:1,size:1})}function k(){return V in cb}function l(){c("No change in size detected")}function m(){j()&&k()?G(b):a in{interval:1}||(f(),l())}var n,o;h()?c("Trigger event cancelled: "+a):i()?(f(),E(),g()):m()}function E(){gb||(gb=!0,c("Trigger event lock on")),clearTimeout(hb),hb=setTimeout(function(){gb=!1,c("Trigger event lock off"),c("--")},R)}function F(a){S=jb[V](),ib=C(),H(S,ib,a)}function G(a){var b=V;V=U,c("Reset trigger event: "+a),E(),F("reset"),V=b}function H(a,b,d,e,f){function g(){void 0===f?f=db:c("Message targetOrigin: "+f)}function h(){var g=a+":"+b,h=ab+":"+g+":"+d+(void 0!==e?":"+e:"");c("Sending message to host page ("+h+")"),eb.postMessage($+h,f)}g(),h()}function I(a){function b(){return $===(""+a.data).substr(0,_)}function f(){X=a.data,eb=a.source,e(),T=!1,setTimeout(function(){W=!1},R)}function g(){W?c("Page reset ignored by init"):(c("Page size reset by host page"),F("resetPage"))}function h(){return a.data.split("]")[1]}function i(){return"iFrameResize"in window}function j(){return a.data.split(":")[2]in{"true":1,"false":1}}b()&&(T&&j()?f():"reset"===h()?g():a.data===X||i()||d("Unexpected message ("+a.data+")"))}var J=!0,K=10,L="",M=0,N="",O="",P=!1,Q={resize:1,click:1},R=128,S=1,T=!0,U="offset",V=U,W=!0,X="",Y=32,Z=!1,$="[iFrameSizer]",_=$.length,ab="",bb=!1,cb={max:1,scroll:1,bodyScroll:1,documentElementScroll:1},db="*",eb=window.parent,fb=0,gb=!1,hb=null,ib=1,jb={offset:t,bodyOffset:t,bodyScroll:u,documentElementOffset:v,scroll:w,documentElementScroll:w,max:z,min:A,grow:z,lowestElement:B};a(window,"message",I)}();
@@ -0,0 +1,10 @@
1
+ /*! iFrame Resizer (iframeSizer.contentWindow.min.js) - v2.7.1 - 2014-12-12
2
+ * Desc: Include this file in any page being loaded into an iframe
3
+ * to force the iframe to resize to the content size.
4
+ * Requires: iframeResizer.min.js on host page.
5
+ * Copyright: (c) 2014 David J. Bradshaw - dave@bradshaw.net
6
+ * License: MIT
7
+ */
8
+
9
+ !function(){"use strict";function a(a,b,c){"addEventListener"in window?a.addEventListener(b,c,!1):"attachEvent"in window&&a.attachEvent("on"+b,c)}function b(a){return $+"["+ab+"] "+a}function c(a){Z&&"object"==typeof window.console&&console.log(b(a))}function d(a){"object"==typeof window.console&&console.warn(b(a))}function e(){c("Initialising iFrame"),f(),i(),h("background",L),h("padding",O),o(),m(),j(),p(),n(),D("init","Init message from host page")}function f(){function a(a){return"true"===a?!0:!1}var b=X.substr(_).split(":");ab=b[0],M=void 0!==b[1]?Number(b[1]):M,P=void 0!==b[2]?a(b[2]):P,Z=void 0!==b[3]?a(b[3]):Z,Y=void 0!==b[4]?Number(b[4]):Y,bb=void 0!==b[5]?a(b[5]):bb,J=void 0!==b[6]?a(b[6]):J,N=b[7],V=void 0!==b[8]?b[8]:V,L=b[9],O=b[10],fb=void 0!==b[11]?Number(b[11]):fb}function g(a,b){return-1!==b.indexOf("-")&&(d("Negative CSS value ignored for "+a),b=""),b}function h(a,b){void 0!==b&&""!==b&&"null"!==b&&(document.body.style[a]=b,c("Body "+a+' set to "'+b+'"'))}function i(){void 0===N&&(N=M+"px"),g("margin",N),h("margin",N)}function j(){document.documentElement.style.height="",document.body.style.height="",c('HTML & body height set to "auto"')}function k(){a(window,"resize",function(){D("resize","Window resized")})}function l(){a(window,"click",function(){D("click","Window clicked")})}function m(){U!==V&&(V in jb||(d(V+" is not a valid option for heightCalculationMethod."),V="bodyScroll"),c('Height calculation method set to "'+V+'"'))}function n(){!0===J?(k(),l(),s()):c("Auto Resize disabled")}function o(){var a=document.createElement("div");a.style.clear="both",a.style.display="block",document.body.appendChild(a)}function p(){bb&&(c("Enable public methods"),window.parentIFrame={close:function(){D("close","parentIFrame.close()",0,0)},getId:function(){return ab},reset:function(){G("parentIFrame.size")},scrollTo:function(a,b){H(b,a,"scrollTo")},scrollToOffset:function(a,b){H(b,a,"scrollToOffset")},sendMessage:function(a,b){H(0,0,"message",JSON.stringify(a),b)},setHeightCalculationMethod:function(a){V=a,m()},setTargetOrigin:function(a){c("Set targetOrigin: "+a),db=a},size:function(a,b){var c=""+(a?a:"")+(b?","+b:"");E(),D("size","parentIFrame.size("+c+")",a,b)}})}function q(){0!==Y&&(c("setInterval: "+Y+"ms"),setInterval(function(){D("interval","setInterval: "+Y)},Math.abs(Y)))}function r(b){function d(b){(void 0===b.height||void 0===b.width||0===b.height||0===b.width)&&(c("Attach listerner to "+b.src),a(b,"load",function(){D("imageLoad","Image loaded")}))}b.forEach(function(a){if("attributes"===a.type&&"src"===a.attributeName)d(a.target);else if("childList"===a.type){var b=a.target.querySelectorAll("img");Array.prototype.forEach.call(b,function(a){d(a)})}})}function s(){function a(){var a=document.querySelector("body"),d={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0},e=new b(function(a){D("mutationObserver","mutationObserver: "+a[0].target+" "+a[0].type),r(a)});c("Enable MutationObserver"),e.observe(a,d)}var b=window.MutationObserver||window.WebKitMutationObserver;b?0>Y?q():a():(d("MutationObserver not supported in this browser!"),q())}function t(){function a(a){function b(a){var b=/^\d+(px)?$/i;if(b.test(a))return parseInt(a,K);var d=c.style.left,e=c.runtimeStyle.left;return c.runtimeStyle.left=c.currentStyle.left,c.style.left=a||0,a=c.style.pixelLeft,c.style.left=d,c.runtimeStyle.left=e,a}var c=document.body,d=0;return"defaultView"in document&&"getComputedStyle"in document.defaultView?(d=document.defaultView.getComputedStyle(c,null),d=null!==d?d[a]:0):d=b(c.currentStyle[a]),parseInt(d,K)}return document.body.offsetHeight+a("marginTop")+a("marginBottom")}function u(){return document.body.scrollHeight}function v(){return document.documentElement.offsetHeight}function w(){return document.documentElement.scrollHeight}function x(){for(var a=document.querySelectorAll("body *"),b=a.length,d=0,e=(new Date).getTime(),f=0;b>f;f++)a[f].getBoundingClientRect().bottom>d&&(d=a[f].getBoundingClientRect().bottom);return e=(new Date).getTime()-e,c("Parsed "+b+" HTML elements"),c("LowestElement bottom position calculated in "+e+"ms"),d}function y(){return[t(),u(),v(),w()]}function z(){return Math.max.apply(null,y())}function A(){return Math.min.apply(null,y())}function B(){return Math.max(t(),x())}function C(){return Math.max(document.documentElement.scrollWidth,document.body.scrollWidth)}function D(a,b,d,e){function f(){a in{reset:1,resetPage:1,init:1}||c("Trigger event: "+b)}function g(){S=n,ib=o,H(S,ib,a)}function h(){return gb&&a in Q}function i(){function a(a,b){var c=Math.abs(a-b)<=fb;return!c}return n=void 0!==d?d:jb[V](),o=void 0!==e?e:C(),a(S,n)||P&&a(ib,o)}function j(){return!(a in{init:1,interval:1,size:1})}function k(){return V in cb}function l(){c("No change in size detected")}function m(){j()&&k()?G(b):a in{interval:1}||(f(),l())}var n,o;h()?c("Trigger event cancelled: "+a):i()?(f(),E(),g()):m()}function E(){gb||(gb=!0,c("Trigger event lock on")),clearTimeout(hb),hb=setTimeout(function(){gb=!1,c("Trigger event lock off"),c("--")},R)}function F(a){S=jb[V](),ib=C(),H(S,ib,a)}function G(a){var b=V;V=U,c("Reset trigger event: "+a),E(),F("reset"),V=b}function H(a,b,d,e,f){function g(){void 0===f?f=db:c("Message targetOrigin: "+f)}function h(){var g=a+":"+b,h=ab+":"+g+":"+d+(void 0!==e?":"+e:"");c("Sending message to host page ("+h+")"),eb.postMessage($+h,f)}g(),h()}function I(a){function b(){return $===(""+a.data).substr(0,_)}function f(){X=a.data,eb=a.source,e(),T=!1,setTimeout(function(){W=!1},R)}function g(){W?c("Page reset ignored by init"):(c("Page size reset by host page"),F("resetPage"))}function h(){return a.data.split("]")[1]}function i(){return"iFrameResize"in window}function j(){return a.data.split(":")[2]in{"true":1,"false":1}}b()&&(T&&j()?f():"reset"===h()?g():a.data===X||i()||d("Unexpected message ("+a.data+")"))}var J=!0,K=10,L="",M=0,N="",O="",P=!1,Q={resize:1,click:1},R=128,S=1,T=!0,U="offset",V=U,W=!0,X="",Y=32,Z=!1,$="[iFrameSizer]",_=$.length,ab="",bb=!1,cb={max:1,scroll:1,bodyScroll:1,documentElementScroll:1},db="*",eb=window.parent,fb=0,gb=!1,hb=null,ib=1,jb={offset:t,bodyOffset:t,bodyScroll:u,documentElementOffset:v,scroll:w,documentElementScroll:w,max:z,min:A,grow:z,lowestElement:B};a(window,"message",I)}();
10
+ //# sourceMappingURL=../src/iframeResizer.contentWindow.map
@@ -0,0 +1,460 @@
1
+ /*
2
+ * File: iframeReizer.js
3
+ * Desc: Force iframes to size to content.
4
+ * Requires: iframeResizer.contentWindow.js to be loaded into the target frame.
5
+ * Author: David J. Bradshaw - dave@bradshaw.net
6
+ * Contributor: Jure Mav - jure.mav@gmail.com
7
+ */
8
+ ;(function() {
9
+ 'use strict';
10
+
11
+ var
12
+ count = 0,
13
+ firstRun = true,
14
+ msgHeader = 'message',
15
+ msgHeaderLen = msgHeader.length,
16
+ msgId = '[iFrameSizer]', //Must match iframe msg ID
17
+ msgIdLen = msgId.length,
18
+ page = '', //:'+location.href, //Uncoment to debug nested iFrames
19
+ pagePosition = null,
20
+ requestAnimationFrame = window.requestAnimationFrame,
21
+ resetRequiredMethods = {max:1,scroll:1,bodyScroll:1,documentElementScroll:1},
22
+ settings = {},
23
+
24
+ defaults = {
25
+ autoResize : true,
26
+ bodyBackground : null,
27
+ bodyMargin : null,
28
+ bodyMarginV1 : 8,
29
+ bodyPadding : null,
30
+ checkOrigin : true,
31
+ enablePublicMethods : false,
32
+ heightCalculationMethod : 'offset',
33
+ interval : 32,
34
+ log : false,
35
+ maxHeight : Infinity,
36
+ maxWidth : Infinity,
37
+ minHeight : 0,
38
+ minWidth : 0,
39
+ scrolling : false,
40
+ sizeHeight : true,
41
+ sizeWidth : false,
42
+ tolerance : 0,
43
+ closedCallback : function(){},
44
+ initCallback : function(){},
45
+ messageCallback : function(){},
46
+ resizedCallback : function(){}
47
+ };
48
+
49
+ function addEventListener(obj,evt,func){
50
+ if ('addEventListener' in window){
51
+ obj.addEventListener(evt,func, false);
52
+ } else if ('attachEvent' in window){//IE
53
+ obj.attachEvent('on'+evt,func);
54
+ }
55
+ }
56
+
57
+ function setupRequestAnimationFrame(){
58
+ var
59
+ vendors = ['moz', 'webkit', 'o', 'ms'],
60
+ x;
61
+
62
+ // Remove vendor prefixing if prefixed and break early if not
63
+ for (x = 0; x < vendors.length && !requestAnimationFrame; x += 1) {
64
+ requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
65
+ }
66
+
67
+ if (!(requestAnimationFrame)){
68
+ log(' RequestAnimationFrame not supported');
69
+ }
70
+ }
71
+
72
+ function log(msg){
73
+ if (settings.log && (typeof console === 'object')){
74
+ console.log(msgId + '[Host page'+page+']' + msg);
75
+ }
76
+ }
77
+
78
+
79
+ function iFrameListener(event){
80
+ function resizeIFrame(){
81
+ function resize(){
82
+ setSize(messageData);
83
+ setPagePosition();
84
+ settings.resizedCallback(messageData);
85
+ }
86
+
87
+ ensureInRange('Height');
88
+ ensureInRange('Width');
89
+
90
+ syncResize(resize,messageData,'resetPage');
91
+ }
92
+
93
+ function closeIFrame(iframe){
94
+ var iframeID = iframe.id;
95
+
96
+ log(' Removing iFrame: '+iframeID);
97
+ iframe.parentNode.removeChild(iframe);
98
+ settings.closedCallback(iframeID);
99
+ log(' --');
100
+ }
101
+
102
+ function processMsg(){
103
+ var data = msg.substr(msgIdLen).split(':');
104
+
105
+ return {
106
+ iframe: document.getElementById(data[0]),
107
+ id: data[0],
108
+ height: data[1],
109
+ width: data[2],
110
+ type: data[3]
111
+ };
112
+ }
113
+
114
+ function ensureInRange(Dimension){
115
+ var
116
+ max = Number(settings['max'+Dimension]),
117
+ min = Number(settings['min'+Dimension]),
118
+ dimension = Dimension.toLowerCase(),
119
+ size = Number(messageData[dimension]);
120
+
121
+ if (min>max){
122
+ throw new Error('Value for min'+Dimension+' can not be greater than max'+Dimension);
123
+ }
124
+
125
+ log(' Checking '+dimension+' is in range '+min+'-'+max);
126
+
127
+ if (size<min) {
128
+ size=min;
129
+ log(' Set '+dimension+' to min value');
130
+ }
131
+
132
+ if (size>max) {
133
+ size=max;
134
+ log(' Set '+dimension+' to max value');
135
+ }
136
+
137
+ messageData[dimension]=''+size;
138
+ }
139
+
140
+ function isMessageFromIFrame(){
141
+
142
+ var
143
+ origin = event.origin,
144
+ remoteHost = messageData.iframe.src.split('/').slice(0,3).join('/');
145
+
146
+ if (settings.checkOrigin) {
147
+ log(' Checking connection is from: '+remoteHost);
148
+
149
+ if ((''+origin !== 'null') && (origin !== remoteHost)) {
150
+ throw new Error(
151
+ 'Unexpected message received from: ' + origin +
152
+ ' for ' + messageData.iframe.id +
153
+ '. Message was: ' + event.data +
154
+ '. This error can be disabled by adding the checkOrigin: false option.'
155
+ );
156
+ }
157
+ }
158
+
159
+ return true;
160
+ }
161
+
162
+ function isMessageForUs(){
163
+ return msgId === ('' + msg).substr(0,msgIdLen); //''+Protects against non-string msg
164
+ }
165
+
166
+ function isMessageFromMetaParent(){
167
+ //test if this message is from a parent above us. This is an ugly test, however, updating
168
+ //the message format would break backwards compatibity.
169
+ var retCode = messageData.type in {'true':1,'false':1};
170
+
171
+ if (retCode){
172
+ log(' Ignoring init message from meta parent page');
173
+ }
174
+
175
+ return retCode;
176
+ }
177
+
178
+ function forwardMsgFromIFrame(){
179
+ var msgBody = msg.substr(msg.indexOf(':')+msgHeaderLen+6); //6 === ':0:0:' + ':' (Ideas to name this magic number most welcome)
180
+
181
+ log(' MessageCallback passed: {iframe: '+ messageData.iframe.id + ', message: ' + msgBody + '}');
182
+ settings.messageCallback({
183
+ iframe: messageData.iframe,
184
+ message: JSON.parse(msgBody)
185
+ });
186
+ log(' --');
187
+ }
188
+
189
+ function checkIFrameExists(){
190
+ if (null === messageData.iframe) {
191
+ throw new Error('iFrame ('+messageData.id+') does not exist on ' + page);
192
+ }
193
+ return true;
194
+ }
195
+
196
+ function getIFramePosition(){
197
+ var iFramePosition = messageData.iframe.getBoundingClientRect();
198
+
199
+ getPagePosition();
200
+
201
+ return {
202
+ x: Number(iFramePosition.left) + Number(pagePosition.x),
203
+ y: Number(iFramePosition.top) + Number(pagePosition.y)
204
+ };
205
+ }
206
+
207
+ function scrollRequestFromChild(addOffset){
208
+ var offset = addOffset ? getIFramePosition() : {x:0,y:0};
209
+
210
+ log(' Reposition requested from iFrame (offset x:'+offset.x+' y:'+offset.y+')');
211
+ pagePosition = {
212
+ x: Number(messageData.width) + offset.x,
213
+ y: Number(messageData.height) + offset.y
214
+ };
215
+ setPagePosition();
216
+ }
217
+
218
+ function actionMsg(){
219
+ switch(messageData.type){
220
+ case 'close':
221
+ closeIFrame(messageData.iframe);
222
+ settings.resizedCallback(messageData); //To be removed.
223
+ break;
224
+ case 'message':
225
+ forwardMsgFromIFrame();
226
+ break;
227
+ case 'scrollTo':
228
+ scrollRequestFromChild(false);
229
+ break;
230
+ case 'scrollToOffset':
231
+ scrollRequestFromChild(true);
232
+ break;
233
+ case 'reset':
234
+ resetIFrame(messageData);
235
+ break;
236
+ case 'init':
237
+ resizeIFrame();
238
+ settings.initCallback(messageData.iframe);
239
+ break;
240
+ default:
241
+ resizeIFrame();
242
+ }
243
+ }
244
+
245
+ var
246
+ msg = event.data,
247
+ messageData = {};
248
+
249
+ if (isMessageForUs()){
250
+ log(' Received: '+msg);
251
+ messageData = processMsg();
252
+
253
+ if ( !isMessageFromMetaParent() && checkIFrameExists() && isMessageFromIFrame() ){
254
+ actionMsg();
255
+ firstRun = false;
256
+ }
257
+ }
258
+ }
259
+
260
+
261
+ function getPagePosition (){
262
+ if(null === pagePosition){
263
+ pagePosition = {
264
+ x: (window.pageXOffset !== undefined) ? window.pageXOffset : document.documentElement.scrollLeft,
265
+ y: (window.pageYOffset !== undefined) ? window.pageYOffset : document.documentElement.scrollTop
266
+ };
267
+ log(' Get position: '+pagePosition.x+','+pagePosition.y);
268
+ }
269
+ }
270
+
271
+ function setPagePosition(){
272
+ if(null !== pagePosition){
273
+ window.scrollTo(pagePosition.x,pagePosition.y);
274
+ log(' Set position: '+pagePosition.x+','+pagePosition.y);
275
+ pagePosition = null;
276
+ }
277
+ }
278
+
279
+ function resetIFrame(messageData){
280
+ function reset(){
281
+ setSize(messageData);
282
+ trigger('reset','reset',messageData.iframe);
283
+ }
284
+
285
+ log(' Size reset requested by '+('init'===messageData.type?'host page':'iFrame'));
286
+ getPagePosition();
287
+ syncResize(reset,messageData,'init');
288
+ }
289
+
290
+ function setSize(messageData){
291
+ function setDimension(dimension){
292
+ messageData.iframe.style[dimension] = messageData[dimension] + 'px';
293
+ log(
294
+ ' IFrame (' + messageData.iframe.id +
295
+ ') ' + dimension +
296
+ ' set to ' + messageData[dimension] + 'px'
297
+ );
298
+ }
299
+
300
+ if( settings.sizeHeight) { setDimension('height'); }
301
+ if( settings.sizeWidth ) { setDimension('width'); }
302
+ }
303
+
304
+ function syncResize(func,messageData,doNotSync){
305
+ if(doNotSync!==messageData.type && requestAnimationFrame){
306
+ log(' Requesting animation frame');
307
+ requestAnimationFrame(func);
308
+ } else {
309
+ func();
310
+ }
311
+ }
312
+
313
+ function trigger(calleeMsg,msg,iframe){
314
+ log('[' + calleeMsg + '] Sending msg to iframe ('+msg+')');
315
+ iframe.contentWindow.postMessage( msgId + msg, '*' );
316
+ }
317
+
318
+
319
+ function setupIFrame(){
320
+ function setLimits(){
321
+ function addStyle(style){
322
+ if ((Infinity !== settings[style]) && (0 !== settings[style])){
323
+ iframe.style[style] = settings[style] + 'px';
324
+ log(' Set '+style+' = '+settings[style]+'px');
325
+ }
326
+ }
327
+
328
+ addStyle('maxHeight');
329
+ addStyle('minHeight');
330
+ addStyle('maxWidth');
331
+ addStyle('minWidth');
332
+ }
333
+
334
+ function ensureHasId(iframeID){
335
+ if (''===iframeID){
336
+ iframe.id = iframeID = 'iFrameResizer' + count++;
337
+ log(' Added missing iframe ID: '+ iframeID +' (' + iframe.src + ')');
338
+ }
339
+
340
+ return iframeID;
341
+ }
342
+
343
+ function setScrolling(){
344
+ log(' IFrame scrolling ' + (settings.scrolling ? 'enabled' : 'disabled') + ' for ' + iframeID);
345
+ iframe.style.overflow = false === settings.scrolling ? 'hidden' : 'auto';
346
+ iframe.scrolling = false === settings.scrolling ? 'no' : 'yes';
347
+ }
348
+
349
+ //The V1 iFrame script expects an int, where as in V2 expects a CSS
350
+ //string value such as '1px 3em', so if we have an int for V2, set V1=V2
351
+ //and then convert V2 to a string PX value.
352
+ function setupBodyMarginValues(){
353
+ if (('number'===typeof(settings.bodyMargin)) || ('0'===settings.bodyMargin)){
354
+ settings.bodyMarginV1 = settings.bodyMargin;
355
+ settings.bodyMargin = '' + settings.bodyMargin + 'px';
356
+ }
357
+ }
358
+
359
+ function createOutgoingMsg(){
360
+ return iframeID +
361
+ ':' + settings.bodyMarginV1 +
362
+ ':' + settings.sizeWidth +
363
+ ':' + settings.log +
364
+ ':' + settings.interval +
365
+ ':' + settings.enablePublicMethods +
366
+ ':' + settings.autoResize +
367
+ ':' + settings.bodyMargin +
368
+ ':' + settings.heightCalculationMethod +
369
+ ':' + settings.bodyBackground +
370
+ ':' + settings.bodyPadding +
371
+ ':' + settings.tolerance;
372
+ }
373
+
374
+ function init(msg){
375
+ //We have to call trigger twice, as we can not be sure if all
376
+ //iframes have completed loading when this code runs. The
377
+ //event listener also catches the page changing in the iFrame.
378
+ addEventListener(iframe,'load',function(){
379
+ var fr = firstRun; // Reduce scope of var to function, because IE8's JS execution
380
+ // context stack is borked and this value gets externally
381
+ // changed midway through running this function.
382
+ trigger('iFrame.onload',msg,iframe);
383
+ if (!fr && settings.heightCalculationMethod in resetRequiredMethods){
384
+ resetIFrame({
385
+ iframe:iframe,
386
+ height:0,
387
+ width:0,
388
+ type:'init'
389
+ });
390
+ }
391
+ });
392
+ trigger('init',msg,iframe);
393
+ }
394
+
395
+ var
396
+ /*jshint validthis:true */
397
+ iframe = this,
398
+ iframeID = ensureHasId(iframe.id);
399
+
400
+ setScrolling();
401
+ setLimits();
402
+ setupBodyMarginValues();
403
+ init(createOutgoingMsg());
404
+ }
405
+
406
+ function checkOptions(options){
407
+ if ('object' !== typeof options){
408
+ throw new TypeError('Options is not an object.');
409
+ }
410
+ }
411
+
412
+ function createNativePublicFunction(){
413
+ function init(element){
414
+ if('IFRAME' !== element.tagName.toUpperCase()) {
415
+ throw new TypeError('Expected <IFRAME> tag, found <'+element.tagName+'>.');
416
+ } else {
417
+ setupIFrame.call(element);
418
+ }
419
+ }
420
+
421
+ function processOptions(options){
422
+ options = options || {};
423
+ checkOptions(options);
424
+
425
+ for (var option in defaults) {
426
+ if (defaults.hasOwnProperty(option)){
427
+ settings[option] = options.hasOwnProperty(option) ? options[option] : defaults[option];
428
+ }
429
+ }
430
+ }
431
+
432
+ return function iFrameResizeF(options,selecter){
433
+ processOptions(options);
434
+ Array.prototype.forEach.call( document.querySelectorAll( selecter || 'iframe' ), init );
435
+ };
436
+ }
437
+
438
+ function createJQueryPublicMethod($){
439
+ $.fn.iFrameResize = function $iFrameResizeF(options) {
440
+ options = options || {};
441
+ checkOptions(options);
442
+ settings = $.extend( {}, defaults, options );
443
+ return this.filter('iframe').each( setupIFrame ).end();
444
+ };
445
+ }
446
+
447
+ setupRequestAnimationFrame();
448
+ addEventListener(window,'message',iFrameListener);
449
+
450
+ if (window.jQuery) { createJQueryPublicMethod(jQuery); }
451
+
452
+ if (typeof define === 'function' && define.amd) {
453
+ define([],createNativePublicFunction);
454
+ } else if (typeof exports === 'object') { //Node for browserfy
455
+ module.exports = createNativePublicFunction();
456
+ } else {
457
+ window.iFrameResize = createNativePublicFunction();
458
+ }
459
+
460
+ })();