1/*! iFrame Resizer (iframeSizer.min.js ) - v4.3.5 - 2023-03-08 2 * Desc: Force cross domain iframes to size to content. 3 * Requires: iframeResizer.contentWindow.min.js to be loaded into the target frame. 4 * Copyright: (c) 2023 David J. Bradshaw - [email protected] 5 * License: MIT 6 */ 7! function(d) { var c, u, a, v, x, I, M, r, f, k, i, l, z; 8 9 function m() { return window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver } 10 11 function F(e, n, i) { e.addEventListener(n, i, !1) } 12 13 function B(e, n, i) { e.removeEventListener(n, i, !1) } 14 15 function p(e) { return x + "[" + (n = "Host page: " + (e = e), n = window.top !== window.self ? window.parentIFrame && window.parentIFrame.getId ? window.parentIFrame.getId() + ": " + e : "Nested host page: " + e : n) + "]"; var n } 16 17 function t(e) { return k[e] ? k[e].log : u } 18 19 function O(e, n) { o("log", e, n, t(e)) } 20 21 function E(e, n) { o("info", e, n, t(e)) } 22 23 function R(e, n) { o("warn", e, n, !0) } 24 25 function o(e, n, i, t) {!0 === t && "object" == typeof window.console && console[e](p(n), i) } 26 27 function w(e) { 28 function i() { t("Height"), t("Width"), P(function() { H(w), C(b), l("onResized", w) }, w, "init") } 29 30 function n() { var e = p.slice(I).split(":"), 31 n = e[1] ? parseInt(e[1], 10) : 0, 32 i = k[e[0]] && k[e[0]].iframe, 33 t = getComputedStyle(i); return { iframe: i, id: e[0], height: n + function(e) { if ("border-box" !== e.boxSizing) return 0; var n = e.paddingTop ? parseInt(e.paddingTop, 10) : 0, 34 e = e.paddingBottom ? parseInt(e.paddingBottom, 10) : 0; return n + e }(t) + function(e) { if ("border-box" !== e.boxSizing) return 0; var n = e.borderTopWidth ? parseInt(e.borderTopWidth, 10) : 0, 35 e = e.borderBottomWidth ? parseInt(e.borderBottomWidth, 10) : 0; return n + e }(t), width: e[2], type: e[3] } } 36 37 function t(e) { var n = Number(k[b]["max" + e]), 38 i = Number(k[b]["min" + e]), 39 e = e.toLowerCase(), 40 t = Number(w[e]); 41 O(b, "Checking " + e + " is in range " + i + "-" + n), t < i && (t = i, O(b, "Set " + e + " to min value")), n < t && (t = n, O(b, "Set " + e + " to max value")), w[e] = "" + t } 42 43 function o() { var t = e.origin, 44 o = k[b] && k[b].checkOrigin; if (o && "" + t != "null" && ! function() { if (o.constructor !== Array) return e = k[b] && k[b].remoteHost, O(b, "Checking connection is from: " + e), t === e; var e, n = 0, 45 i = !1; for (O(b, "Checking connection is from allowed list of origins: " + o); n < o.length; n++) 46 if (o[n] === t) { i = !0; break } 47 return i }()) throw new Error("Unexpected message received from: " + t + " for " + w.iframe.id + ". Message was: " + e.data + ". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains."); return 1 } 48 49 function a(e) { return p.slice(p.indexOf(":") + v + e) } 50 51 function s(i, t) { var e, n, o; 52 e = function() { var e, n; 53 A("Send Page Info", "pageInfo:" + (e = document.body.getBoundingClientRect(), n = w.iframe.getBoundingClientRect(), JSON.stringify({ iframeHeight: n.height, iframeWidth: n.width, clientHeight: Math.max(document.documentElement.clientHeight, window.innerHeight || 0), clientWidth: Math.max(document.documentElement.clientWidth, window.innerWidth || 0), offsetTop: parseInt(n.top - e.top, 10), offsetLeft: parseInt(n.left - e.left, 10), scrollTop: window.pageYOffset, scrollLeft: window.pageXOffset, documentHeight: document.documentElement.clientHeight, documentWidth: document.documentElement.clientWidth, windowHeight: window.innerHeight, windowWidth: window.innerWidth })), i, t) }, n = 32, z[o = t] || (z[o] = setTimeout(function() { z[o] = null, e() }, n)) } 54 55 function r(e) { e = e.getBoundingClientRect(); return W(b), { x: Math.floor(Number(e.left) + Number(M.x)), y: Math.floor(Number(e.top) + Number(M.y)) } } 56 57 function d(e) { var n = e ? r(w.iframe) : { x: 0, y: 0 }, 58 i = { x: Number(w.width) + n.x, y: Number(w.height) + n.y }; 59 O(b, "Reposition requested from iFrame (offset x:" + n.x + " y:" + n.y + ")"), window.top === window.self ? (M = i, c(), O(b, "--")) : window.parentIFrame ? window.parentIFrame["scrollTo" + (e ? "Offset" : "")](i.x, i.y) : R(b, "Unable to scroll to requested position, window.parentIFrame not found") } 60 61 function c() {!1 === l("onScroll", M) ? S() : C(b) } 62 63 function u(e) { var e = e.split("#")[1] || "", 64 n = decodeURIComponent(e), 65 n = document.getElementById(n) || document.getElementsByName(n)[0]; 66 n ? (n = r(n), O(b, "Moving to in page link (#" + e + ") at x: " + n.x + " y: " + n.y), M = { x: n.x, y: n.y }, c(), O(b, "--")) : window.top === window.self ? O(b, "In page link #" + e + " not found") : window.parentIFrame ? window.parentIFrame.moveToAnchor(e) : O(b, "In page link #" + e + " not found and window.parentIFrame not found") } 67 68 function f(e) { var n, i = {}; 69 i = 0 === Number(w.width) && 0 === Number(w.height) ? { x: (n = a(9).split(":"))[1], y: n[0] } : { x: w.width, y: w.height }, l(e, { iframe: w.iframe, screenX: Number(i.x), screenY: Number(i.y), type: w.type }) } 70 71 function l(e, n) { return T(b, e, n) } 72 73 function m() { switch (k[b] && k[b].firstRun && k[b] && (k[b].firstRun = !1), w.type) { 74 case "close": 75 N(w.iframe); break; 76 case "message": 77 n = a(6), O(b, "onMessage passed: {iframe: " + w.iframe.id + ", message: " + n + "}"), l("onMessage", { iframe: w.iframe, message: JSON.parse(n) }), O(b, "--"); break; 78 case "mouseenter": 79 f("onMouseEnter"); break; 80 case "mouseleave": 81 f("onMouseLeave"); break; 82 case "autoResize": 83 k[b].autoResize = JSON.parse(a(9)); break; 84 case "scrollTo": 85 d(!1); break; 86 case "scrollToOffset": 87 d(!0); break; 88 case "pageInfo": 89 s(k[b] && k[b].iframe, b), r = b, e("Add ", F), k[r] && (k[r].stopPageInfo = o); break; 90 case "pageInfoStop": 91 k[b] && k[b].stopPageInfo && (k[b].stopPageInfo(), delete k[b].stopPageInfo); break; 92 case "inPageLink": 93 u(a(9)); break; 94 case "reset": 95 j(w); break; 96 case "init": 97 i(), l("onInit", w.iframe); break; 98 default: 99 0 === Number(w.width) && 0 === Number(w.height) ? R("Unsupported message received (" + w.type + "), this is likely due to the iframe containing a later version of iframe-resizer than the parent page") : i() } 100 101 function e(n, i) { 102 function t() { k[r] ? s(k[r].iframe, r) : o() }["scroll", "resize"].forEach(function(e) { O(r, n + e + " listener for sendPageInfo"), i(window, e, t) }) } 103 104 function o() { e("Remove ", B) } var r, n } var g, h, p = e.data, 105 w = {}, 106 b = null; if ("[iFrameResizerChild]Ready" === p) 107 for (var y in k) A("iFrame requested init", L(y), k[y].iframe, y); 108 else x === ("" + p).slice(0, I) && p.slice(I).split(":")[0] in k ? (w = n(), b = w.id, k[b] && (k[b].loaded = !0), (h = w.type in { true: 1, false: 1, undefined: 1 }) && O(b, "Ignoring init message from meta parent page"), !h && (h = !0, k[g = b] || (h = !1, R(w.type + " No settings for " + g + ". Message was: " + p)), h) && (O(b, "Received: " + p), g = !0, null === w.iframe && (R(b, "IFrame (" + w.id + ")
108not found"), g = !1), g && o() && m())) : E(b, "Ignored: " + p) } 109 110 function T(e, n, i) { var t = null, 111 o = null; if (k[e]) { if ("function" != typeof(t = k[e][n])) throw new TypeError(n + " on iFrame[" + e + "] is not a function"); 112 o = t(i) } return o } 113 114 function g(e) { e = e.id; 115 delete k[e] } 116 117 function N(e) { var n = e.id; if (!1 === T(n, "onClose", n)) O(n, "Close iframe cancelled by onClose event"); 118 else { O(n, "Removing iFrame: " + n); try { e.parentNode && e.parentNode.removeChild(e) } catch (e) { R(e) } 119 T(n, "onClosed", n), O(n, "--"), g(e) } } 120 121 function W(e) { null === M && O(e, "Get page position: " + (M = { x: window.pageXOffset === d ? document.documentElement.scrollLeft : window.pageXOffset, y: window.pageYOffset === d ? document.documentElement.scrollTop : window.pageYOffset }).x + "," + M.y) } 122 123 function C(e) { null !== M && (window.scrollTo(M.x, M.y), O(e, "Set page position: " + M.x + "," + M.y), S()) } 124 125 function S() { M = null } 126 127 function j(e) { O(e.id, "Size reset requested by " + ("init" === e.type ? "host page" : "iFrame")), W(e.id), P(function() { H(e), A("reset", "reset", e.iframe, e.id) }, e, "reset") } 128 129 function H(o) { 130 function i(e) { var n; 131 132 function i() { Object.keys(k).forEach(function(e) { 133 function n(e) { return "0px" === (k[i] && k[i].iframe.style[e]) } var i; 134 k[i = e] && null !== k[i].iframe.offsetParent && (n("height") || n("width")) && A("Visibility change", "resize", k[i].iframe, i) }) } 135 136 function t(e) { O("window", "Mutation observed: " + e[0].target + " " + e[0].type), h(i, 16) }!a && "0" === o[e] && (a = !0, O(r, "Hidden iFrame detected, creating visibility listener"), e = m()) && (n = document.querySelector("body"), new e(t).observe(n, { attributes: !0, attributeOldValue: !1, characterData: !0, characterDataOldValue: !1, childList: !0, subtree: !0 })) } 137 138 function e(e) { var n; 139 n = e, o.id ? (o.iframe.style[n] = o[n] + "px", O(o.id, "IFrame (" + r + ") " + n + " set to " + o[n] + "px")) : O("undefined", "messageData id not set"), i(e) } var r = o.iframe.id; 140 k[r] && (k[r].sizeHeight && e("height"), k[r].sizeWidth) && e("width") } 141 142 function P(e, n, i) { i !== n.type && r && !window.jasmine ? (O(n.id, "Requesting animation frame"), r(e)) : e() } 143 144 function A(n, i, t, o, e) { 145 function r() { var e; 146 t && "contentWindow" in t && null !== t.contentWindow ? (e = k[o] && k[o].targetOrigin, O(o, "[" + n + "] Sending msg to iframe[" + o + "] (" + i + ") targetOrigin: " + e), t.contentWindow.postMessage(x + i, e)) : R(o, "[" + n + "] IFrame(" + o + ") not found") } 147 148 function a() { e && k[o] && k[o].warningTimeout && (k[o].msgTimeout = setTimeout(function() {!k[o] || k[o].loaded || s || (s = !0, R(o, "IFrame has not responded within " + k[o].warningTimeout / 1e3 + " seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning.")) }, k[o].warningTimeout)) } var s = !1; 149 o = o || t.id, k[o] && (r(), a()) } 150 151 function L(e) { return e + ":" + k[e].bodyMarginV1 + ":" + k[e].sizeWidth + ":" + k[e].log + ":" + k[e].interval + ":" + k[e].enablePublicMethods + ":" + k[e].autoResize + ":" + k[e].bodyMargin + ":" + k[e].heightCalculationMethod + ":" + k[e].bodyBackground + ":" + k[e].bodyPadding + ":" + k[e].tolerance + ":" + k[e].inPageLinks + ":" + k[e].resizeFrom + ":" + k[e].widthCalculationMethod + ":" + k[e].mouseEvents } 152 153 function s(t, i) { 154 function e(i) { var e = m(); 155 e && (e = e, t.parentNode) && new e(function(e) { e.forEach(function(e) { Array.prototype.slice.call(e.removedNodes).forEach(function(e) { e === t && N(t) }) }) }).observe(t.parentNode, { childList: !0 }), F(t, "load", function() { var e, n; 156 A("iFrame.onload", i, t, d, !0), e = k[r] && k[r].firstRun, n = k[r] && k[r].heightCalculationMethod in f, !e && n && j({ iframe: t, height: 0, width: 0, type: "init" }) }), A("init", i, t, d, !0) } 157 158 function o(e) { var n = e.split("Callback"); 159 2 === n.length && (this[n = "on" + n[0].charAt(0).toUpperCase() + n[0].slice(1)] = this[e], delete this[e], R(r, "Deprecated: '" + e + "' has been renamed '" + n + "'. The old method will be removed in the next major version.")) } 160 161 function n(e) { if (e = e || {}, k[r] = Object.create(null), k[r].iframe = t, k[r].firstRun = !0, k[r].remoteHost = t.src && t.src.split("/").slice(0, 3).join("/"), "object" != typeof e) throw new TypeError("Options is not an object"); 162 Object.keys(e).forEach(o, e); var n, i = e; for (n in l) Object.prototype.hasOwnProperty.call(l, n) && (k[r][n] = (Object.prototype.hasOwnProperty.call(i, n) ? i : l)[n]); 163 k[r] && (k[r].targetOrigin = !0 !== k[r].checkOrigin || "" === (e = k[r].remoteHost) || null !== e.match(/^(about:blank|javascript:|file:\/\/)/) ? "*" : e) } var r = function(e) { if ("string" != typeof e) throw new TypeError("Invaild id for iFrame. Expected String"); var n; return "" === e && (t.id = (n = i && i.id || l.id + c++, null !== document.getElementById(n) && (n += c++), e = n), u = (i || {}).log, O(e, "Added missing iframe ID: " + e + " (" + t.src + ")")), e }(t.id); if (r in k && "iFrameResizer" in t) R(r, "Ignored iFrame, already setup."); 164 else { switch (n(i), O(r, "IFrame scrolling " + (k[r] && k[r].scrolling ? "enabled" : "disabled") + " for " + r), t.style.overflow = !1 === (k[r] && k[r].scrolling) ? "hidden" : "auto", k[r] && k[r].scrolling) { 165 case "omit": 166 break; 167 case !0: 168 t.scrolling = "yes"; break; 169 case !1: 170 t.scrolling = "no"; break; 171 default: 172 t.scrolling = k[r] ? k[r].scrolling : "no" } 173 s("Height"), s("Width"), a("maxHeight"), a("minHeight"), a("maxWidth"), a("minWidth"), "number" != typeof(k[r] && k[r].bodyMargin) && "0" !== (k[r] && k[r].bodyMargin) || (k[r].bodyMarginV1 = k[r].bodyMargin, k[r].bodyMargin = k[r].bodyMargin + "px"), e(L(r)), k[r] && (k[r].iframe.iFrameResizer = { close: N.bind(null, k[r].iframe), removeListeners: g.bind(null, k[r].iframe), resize: A.bind(null, "Window resize", "resize", k[r].iframe), moveToAnchor: function(e) { A("Move to anchor", "moveToAnchor:" + e, k[r].iframe, r) }, sendMessage: function(e) { A("Send Message", "message:" + (e = JSON.stringify(e)), k[r].iframe, r) } }) } 174 175 function a(e) { var n = k[r][e]; 176 1 / 0 !== n && 0 !== n && (t.style[e] = "number" == typeof n ? n + "px" : n, O(r, "Set " + e + " = " + t.style[e])) } 177 178 function s(e) { if (k[r]["min" + e] > k[r]["max" + e]) throw new Error("Value for min" + e + " can not be greater than max" + e) } } 179 180 function h(e, n) { null === i && (i = setTimeout(function() { i = null, e() }, n)) } 181 182 function e() { "hidden" !== document.visibilityState && (O("document", "Trigger event: Visibility change"), h(function() { b("Tab Visible", "resize") }, 16)) } 183
184 function b(i, t) { Object.keys(k).forEach(function(e) { var n; 185 k[n = e] && "parent" === k[n].resizeFrom && k[n].autoResize && !k[n].firstRun && A(i, t, k[e].iframe, e) }) } 186 187 function y() { F(window, "message", w), F(window, "resize", function() { var e; 188 O("window", "Trigger event: " + (e = "resize")), h(function() { b("Window " + e, "resize") }, 16) }), F(document, "visibilitychange", e), F(document, "-webkit-visibilitychange", e) } 189 190 function n() { 191 function t(e, n) { if (n) { if (!n.tagName) throw new TypeError("Object is not a valid DOM element"); if ("IFRAME" !== n.tagName.toUpperCase()) throw new TypeError("Expected <IFRAME> tag, found <" + n.tagName + ">"); 192 s(n, e), o.push(n) } } for (var o, e = ["moz", "webkit", "o", "ms"], n = 0; n < e.length && !r; n += 1) r = window[e[n] + "RequestAnimationFrame"]; return r ? r = r.bind(window) : O("setup", "RequestAnimationFrame not supported"), y(), 193 function(e, n) { var i; switch (o = [], (i = e) && i.enablePublicMethods && R("enablePublicMethods option has been removed, public methods are now always available in the iFrame"), typeof n) { 194 case "undefined": 195 case "string": 196 Array.prototype.forEach.call(document.querySelectorAll(n || "iframe"), t.bind(d, e)); break; 197 case "object": 198 t(e, n); break; 199 default: 200 throw new TypeError("Unexpected data type (" + typeof n + ")") } return o } } 201 202 function q(e) { e.fn ? e.fn.iFrameResize || (e.fn.iFrameResize = function(i) { return this.filter("iframe").each(function(e, n) { s(n, i) }).end() }) : E("", "Unable to bind to jQuery, it is not fully loaded.") } "undefined" != typeof window && (c = 0, a = u = !1, v = "message".length, I = (x = "[iFrameSizer]").length, M = null, r = window.requestAnimationFrame, f = Object.freeze({ max: 1, scroll: 1, bodyScroll: 1, documentElementScroll: 1 }), k = {}, i = null, l = Object.freeze({ 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, mouseEvents: !0, resizeFrom: "parent", scrolling: !1, sizeHeight: !0, sizeWidth: !1, warningTimeout: 5e3, tolerance: 0, widthCalculationMethod: "scroll", onClose: function() { return !0 }, onClosed: function() {}, onInit: function() {}, onMessage: function() { R("onMessage function not defined") }, onMouseEnter: function() {}, onMouseLeave: function() {}, onResized: function() {}, onScroll: function() { return !0 } }), z = {}, window.jQuery !== d && q(window.jQuery), "function" == typeof define && define.amd ? define([], n) : "object" == typeof module && "object" == typeof module.exports && (module.exports = n()), window.iFrameResize = window.iFrameResize || n()) }();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.