1/*! iFrame Resizer (iframeSizer.min.js ) - v4.3.2 - 2021-10-18 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) 2021 David J. Bradshaw - [email protected] 5 * License: MIT 6 */ 7 8! function (u) { 9 var f, l, a, x, M, I, k, r, m, F, i, g, z; 10 11 function h() { 12 return window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver 13 } 14 15 function O(e, n, i) { 16 e.addEventListener(n, i, !1) 17 } 18 19 function R(e, n, i) { 20 e.removeEventListener(n, i, !1) 21 } 22 23 function o(e) { 24 return M + "[" + (e = "Host page: " + (n = e), e = window.top !== window.self ? window.parentIFrame && window.parentIFrame.getId ? window.parentIFrame.getId() + ": " + n : "Nested host page: " + n : e) + "]"; 25 var n 26 } 27 28 function t(e) { 29 return F[e] ? F[e].log : l 30 } 31 32 function T(e, n) { 33 s("log", e, n, t(e)) 34 } 35 36 function E(e, n) { 37 s("info", e, n, t(e)) 38 } 39 40 function N(e, n) { 41 s("warn", e, n, !0) 42 } 43 44 function s(e, n, i, t) { 45 !0 === t && "object" == typeof window.console && console[e](o(n), i) 46 } 47 48 function e(n) { 49 function i() { 50 t("Height"), t("Width"), L(function () { 51 A(y), H(v), l("onResized", y) 52 }, y, "init") 53 } 54 55 function e() { 56 var e = b.substr(I).split(":"), 57 n = e[1] ? parseInt(e[1], 10) : 0, 58 i = F[e[0]] && F[e[0]].iframe, 59 t = getComputedStyle(i); 60 return { 61 iframe: i, 62 id: e[0], 63 height: n + function (e) { 64 if ("border-box" !== e.boxSizing) return 0; 65 var n = e.paddingTop ? parseInt(e.paddingTop, 10) : 0, 66 e = e.paddingBottom ? parseInt(e.paddingBottom, 10) : 0; 67 return n + e 68 }(t) + function (e) { 69 if ("border-box" !== e.boxSizing) return 0; 70 var n = e.borderTopWidth ? parseInt(e.borderTopWidth, 10) : 0, 71 e = e.borderBottomWidth ? parseInt(e.borderBottomWidth, 10) : 0; 72 return n + e 73 }(t), 74 width: e[2], 75 type: e[3] 76 } 77 } 78 79 function t(e) { 80 var n = Number(F[v]["max" + e]), 81 i = Number(F[v]["min" + e]), 82 t = e.toLowerCase(), 83 e = Number(y[t]); 84 T(v, "Checking " + t + " is in range " + i + "-" + n), e < i && (e = i, T(v, "Set " + t + " to min value")), n < e && (e = n, T(v, "Set " + t + " to max value")), y[t] = "" + e 85 } 86 87 function o() { 88 function e() { 89 return t.constructor === Array ? function () { 90 var e = 0, 91 n = !1; 92 for (T(v, "Checking connection is from allowed list of origins: " + t); e < t.length; e++) 93 if (t[e] === i) { 94 n = !0; 95 break 96 } return n 97 }() : (e = F[v] && F[v].remoteHost, T(v, "Checking connection is from: " + e), i === e); 98 var e 99 } 100 var i = n.origin, 101 t = F[v] && F[v].checkOrigin; 102 if (t && "" + i != "null" && !e()) throw new Error("Unexpected message received from: " + i + " for " + y.iframe.id + ". Message was: " + n.data + ". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains."); 103 return 1 104 } 105 106 function a(e) { 107 return b.substr(b.indexOf(":") + x + e) 108 } 109 110 function s(i, t) { 111 var e, n, o; 112 e = function () { 113 var e, n; 114 B("Send Page Info", "pageInfo:" + (e = document.body.getBoundingClientRect(), n = y.iframe.getBoundingClientRect(), JSON.stringify({ 115 iframeHeight: n.height, 116 iframeWidth: n.width, 117 clientHeight: Math.max(document.documentElement.clientHeight, window.innerHeight || 0), 118 clientWidth: Math.max(document.documentElement.clientWidth, window.innerWidth || 0), 119 offsetTop: parseInt(n.top - e.top, 10), 120 offsetLeft: parseInt(n.left - e.left, 10), 121 scrollTop: window.pageYOffset, 122 scrollLeft: window.pageXOffset, 123 documentHeight: document.documentElement.clientHeight, 124 documentWidth: document.documentElement.clientWidth, 125 windowHeight: window.innerHeight, 126 windowWidth: window.innerWidth 127 })), i, t) 128 }, n = 32, z[o = t] || (z[o] = setTimeout(function () { 129 z[o] = null, e() 130 }, n)) 131 } 132 133 function r(e) { 134 e = e.getBoundingClientRect(); 135 return S(v), { 136 x: Math.floor(Number(e.left) + Number(k.x)), 137 y: Math.floor(Number(e.top) + Number(k.y)) 138 } 139 } 140 141 function d(e) { 142 var n = e ? r(y.iframe) : { 143 x: 0, 144 y: 0 145 }, 146 i = { 147 x: Number(y.width) + n.x, 148 y: Number(y.height) + n.y 149 }; 150 T(v, "Reposition requested from iFrame (offset x:" + n.x + " y:" + n.y + ")"), window.top !== window.self ? window.parentIFrame ? window.parentIFrame["scrollTo" + (e ? "Offset" : "")](i.x, i.y) : N(v, "Unable to scroll to requested position, window.parentIFrame not found") : (k = i, c(), T(v, "--")) 151 } 152 153 function c() {
154 !1 !== l("onScroll", k) ? H(v) : j() 155 } 156 157 function u(e) { 158 var n, i = e.split("#")[1] || "", 159 e = decodeURIComponent(i), 160 t = document.getElementById(e) || document.getElementsByName(e)[0]; 161 t ? (n = r(t), T(v, "Moving to in page link (#" + i + ") at x: " + n.x + " y: " + n.y), k = { 162 x: n.x, 163 y: n.y 164 }, c(), T(v, "--")) : window.top !== window.self ? window.parentIFrame ? window.parentIFrame.moveToAnchor(i) : T(v, "In page link #" + i + " not found and window.parentIFrame not found") : T(v, "In page link #" + i + " not found") 165 } 166 167 function f(e) { 168 var n, i = {}; 169 i = 0 === Number(y.width) && 0 === Number(y.height) ? { 170 x: (n = a(9).split(":"))[1], 171 y: n[0] 172 } : { 173 x: y.width, 174 y: y.height 175 }, l(e, { 176 iframe: y.iframe, 177 screenX: Number(i.x), 178 screenY: Number(i.y), 179 type: y.type 180 }) 181 } 182 183 function l(e, n) { 184 return W(v, e, n) 185 } 186 187 function m() { 188 switch (F[v] && F[v].firstRun && F[v] && (F[v].firstRun = !1), y.type) { 189 case "close": 190 C(y.iframe); 191 break; 192 case "message": 193 n = a(6), T(v, "onMessage passed: {iframe: " + y.iframe.id + ", message: " + n + "}"), l("onMessage", { 194 iframe: y.iframe, 195 message: JSON.parse(n) 196 }), T(v, "--"); 197 break; 198 case "mouseenter": 199 f("onMouseEnter"); 200 break; 201 case "mouseleave": 202 f("onMouseLeave"); 203 break; 204 case "autoResize": 205 F[v].autoResize = JSON.parse(a(9)); 206 break; 207 case "scrollTo": 208 d(!1); 209 break; 210 case "scrollToOffset": 211 d(!0); 212 break; 213 case "pageInfo": 214 s(F[v] && F[v].iframe, v), r = v, e("Add ", O), F[r] && (F[r].stopPageInfo = o); 215 break; 216 case "pageInfoStop": 217 F[v] && F[v].stopPageInfo && (F[v].stopPageInfo(), delete F[v].stopPageInfo); 218 break; 219 case "inPageLink": 220 u(a(9)); 221 break; 222 case "reset": 223 P(y); 224 break; 225 case "init": 226 i(), l("onInit", y.iframe); 227 break; 228 default: 229 0 === Number(y.width) && 0 === Number(y.height) ? N("Unsupported message received (" + y.type + "), this is likely due to the iframe containing a later version of iframe-resizer than the parent page") : i() 230 } 231 232 function e(n, i) { 233 function t() { 234 F[r] ? s(F[r].iframe, r) : o() 235 } ["scroll", "resize"].forEach(function (e) { 236 T(r, n + e + " listener for sendPageInfo"), i(window, e, t) 237 }) 238 } 239 240 function o() { 241 e("Remove ", R) 242 } 243 var r, n 244 } 245 var g, h, p, w, b = n.data, 246 y = {}, 247 v = null; 248 "[iFrameResizerChild]Ready" === b ? function () { 249 for (var e in F) B("iFrame requested init", q(e), F[e].iframe, e) 250 }() : M === ("" + b).substr(0, I) && b.substr(I).split(":")[0] in F ? (y = e(), v = y.id, F[v] && (F[v].loaded = !0), (w = y.type in { 251 true: 1, 252 false: 1, 253 undefined: 1 254 }) && T(v, "Ignoring init message from meta parent page"), !w && (p = !0, F[h = v] || (p = !1, N(y.type + " No settings for " + h + ". Message was: " + b)), p) && (T(v, "Received: " + b), g = !0, null === y.iframe && (N(v, "IFrame (" + y.id + ") not found"), g = !1), g && o() && m())) : E(v, "Ignored: " + b) 255 } 256 257 function W(e, n, i) { 258 var t = null, 259 o = null; 260 if (F[e]) { 261 if ("function" != typeof (t = F[e][n])) throw new TypeError(n + " on iFrame[" + e + "] is not a function"); 262 o = t(i) 263 } 264 return o 265 } 266 267 function p(e) { 268 e = e.id; 269 delete F[e] 270 } 271 272 function C(e) { 273 var n = e.id; 274 if (!1 !== W(n, "onClose", n)) { 275 T(n, "Removing iFrame: " + n); 276 try { 277 e.parentNode && e.parentNode.removeChild(e) 278 } catch (e) { 279 N(e) 280 } 281 W(n, "onClosed", n), T(n, "--"), p(e) 282 } else T(n, "Close iframe cancelled by onClose event") 283 } 284 285 function S(e) {
286 null === k && T(e, "Get page position: " + (k = { 287 x: window.pageXOffset !== u ? window.pageXOffset : document.documentElement.scrollLeft, 288 y: window.pageYOffset !== u ? window.pageYOffset : document.documentElement.scrollTop 289 }).x + "," + k.y) 290 } 291 292 function H(e) { 293 null !== k && (window.scrollTo(k.x, k.y), T(e, "Set page position: " + k.x + "," + k.y), j()) 294 } 295 296 function j() { 297 k = null 298 } 299 300 function P(e) { 301 T(e.id, "Size reset requested by " + ("init" === e.type ? "host page" : "iFrame")), S(e.id), L(function () { 302 A(e), B("reset", "reset", e.iframe, e.id) 303 }, e, "reset") 304 } 305 306 function A(o) { 307 function i(e) { 308 function n() { 309 Object.keys(F).forEach(function (e) { 310 function n(e) { 311 return "0px" === (F[i] && F[i].iframe.style[e]) 312 } 313 var i; 314 F[i = e] && null !== F[i].iframe.offsetParent && (n("height") || n("width")) && B("Visibility change", "resize", F[i].iframe, i) 315 }) 316 } 317 318 function i(e) { 319 T("window", "Mutation observed: " + e[0].target + " " + e[0].type), c(n, 16) 320 } 321 var t; 322 a || "0" !== o[e] || (a = !0, T(r, "Hidden iFrame detected, creating visibility listener"), (t = h()) && function () { 323 var e = document.querySelector("body"); 324 new t(i).observe(e, { 325 attributes: !0, 326 attributeOldValue: !1, 327 characterData: !0, 328 characterDataOldValue: !1, 329 childList: !0, 330 subtree: !0 331 }) 332 }()) 333 } 334 335 function e(e) { 336 var n; 337 n = e, o.id ? (o.iframe.style[n] = o[n] + "px", T(o.id, "IFrame (" + r + ") " + n + " set to " + o[n] + "px")) : T("undefined", "messageData id not set"), i(e) 338 } 339 var r = o.iframe.id; 340 F[r] && (F[r].sizeHeight && e("height"), F[r].sizeWidth && e("width")) 341 } 342 343 function L(e, n, i) { 344 i !== n.type && r && !window.jasmine ? (T(n.id, "Requesting animation frame"), r(e)) : e() 345 } 346 347 function B(n, i, t, o, e) { 348 function r() { 349 var e; 350 t && "contentWindow" in t && null !== t.contentWindow ? (e = F[o] && F[o].targetOrigin, T(o, "[" + n + "] Sending msg to iframe[" + o + "] (" + i + ") targetOrigin: " + e), t.contentWindow.postMessage(M + i, e)) : N(o, "[" + n + "] IFrame(" + o + ") not found") 351 } 352 353 function a() { 354 e && F[o] && F[o].warningTimeout && (F[o].msgTimeout = setTimeout(function () { 355 !F[o] || F[o].loaded || s || (s = !0, N(o, "IFrame has not responded within " + F[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.")) 356 }, F[o].warningTimeout)) 357 } 358 var s = !1; 359 o = o || t.id, F[o] && (r(), a()) 360 } 361 362 function q(e) { 363 return e + ":" + F[e].bodyMarginV1 + ":" + F[e].sizeWidth + ":" + F[e].log + ":" + F[e].interval + ":" + F[e].enablePublicMethods + ":" + F[e].autoResize + ":" + F[e].bodyMargin + ":" + F[e].heightCalculationMethod + ":" + F[e].bodyBackground + ":" + F[e].bodyPadding + ":" + F[e].tolerance + ":" + F[e].inPageLinks + ":" + F[e].resizeFrom + ":" + F[e].widthCalculationMethod + ":" + F[e].mouseEvents 364 } 365 366 function d(t, e) { 367 function n(i) { 368 var e, n = h(); 369 n && (e = n, t.parentNode && new e(function (e) { 370 e.forEach(function (e) { 371 Array.prototype.slice.call(e.removedNodes).forEach(function (e) { 372 e === t && C(t) 373 }) 374 }) 375 }).observe(t.parentNode, { 376 childList: !0 377 })), O(t, "load", function () { 378 var e, n; 379 B("iFrame.onload", i, t, u, !0), e = F[s] && F[s].firstRun, n = F[s] && F[s].heightCalculationMethod in m, !e && n && P({ 380 iframe: t, 381 height: 0, 382 width: 0, 383 type: "init" 384 }) 385 }), B("init", i, t, u, !0) 386 } 387 388 function i(e) { 389 var n = e.split("Callback"); 390 2 === n.length && (this[n = "on" + n[0].charAt(0).toUpperCase() + n[0].slice(1)] = this[e], delete this[e], N(s, "Deprecated: '" + e + "' has been renamed '" + n + "'. The old method will be removed in the next major version.")) 391 } 392 393 function o(e) { 394 e = e || {}, F[s] = { 395 firstRun: !0, 396 iframe: t, 397 remoteHost: t.src && t.src.split("/").slice(0, 3).join("/") 398 }, 399 function (e) { 400 if ("object" != typeof e) throw new TypeError("Options is not an object") 401 }(e), Object.keys(e).forEach(i, e), 402 function (e) { 403 for (var n in g) Object.prototype.hasOwnProperty.call(g, n) && (F[s][n] = (Object.prototype.hasOwnProperty.call(e, n) ? e : g)[n]) 404 }(e), F[s] && (F[s].targetOrigin = !0 === F[s].checkOrigin ? "" === (e = F[s].remoteHost) || null !== e.match(/^(about:blank|javascript:|file:\/\/)/) ? "*" : e : "*") 405 } 406 var r, a, s = ("" === (r = t.id) && (t.id = (a = e && e.id || g.id + f++, null !== document.getElementById(a) && (a += f++), r = a), l = (e || {}).log, T(r, "Added missing iframe ID: " + r + " (" + t.src + ")")), r); 407 408 function d(e) { 409 var n = F[s][e]; 410 1 / 0 !== n && 0 !== n && (t.style[e] = "number" == typeof n ? n + "px" : n, T(s, "Set " + e + " = " + t.style[e])) 411 } 412 413 function c(e) { 414 if (F[s]["min" + e] > F[s]["max" + e]) throw new Error("Value for min" + e + " can not be greater than max" + e) 415 } 416 s in F && "iFrameResizer" in t ? N(s, "Ignored iFrame, already setup.") : (o(e), function () { 417 switch (T(s, "IFrame scrolling " + (F[s] && F[s].scrolling ? "enabled" : "disabled") + " for " + s), t.style.overflow = !1 === (F[s] && F[s].scrolling) ? "hidden" : "auto", F[s] && F[s].scrolling) { 418 case "omit": 419 break; 420 case !0: 421 t.scrolling = "yes"; 422 break; 423 case !1: 424 t.scrolling = "no"; 425 break; 426 default: 427 t.scrolling = F[s] ? F[s].scrolling : "no" 428 } 429 }(), c("Height"), c("Width"), d("maxHeight"), d("minHeight"), d("maxWidth"), d("minWidth"), "number" != typeof (F[s] && F[s].bodyMargin) && "0" !== (F[s] && F[s].bodyMargin) || (F[s].bodyMarginV1 = F[s].bodyMargin, F[s].bodyMargin = F[s].bodyMargin + "px"), n(q(s)), F[s] && (F[s].iframe.iFrameResizer = { 430 close: C.bind(null, F[s].iframe), 431 removeListeners: p.bind(null, F[s].iframe), 432 resize: B.bind(null, "Window resize", "resize", F[s].iframe), 433 moveToAnchor: function (e) { 434 B("Move to anchor", "moveToAnchor:" + e, F[s].iframe, s) 435 }, 436 sendMessage: function (e) { 437 B("Send Message", "message:" + (e = JSON.stringify(e)), F[s].iframe, s) 438 } 439 })) 440 } 441 442 function c(e, n) { 443 null === i && (i = setTimeout(function () { 444 i = null, e() 445 }, n)) 446 } 447 448 function n() { 449 "hidden" !== document.visibilityState && (T("document", "Trigger event: Visibility change"), c(function () { 450 w("Tab Visible", "resize") 451 }, 16)) 452 } 453 454 function w(i, t) {
455 Object.keys(F).forEach(function (e) { 456 var n; 457 F[n = e] && "parent" === F[n].resizeFrom && F[n].autoResize && !F[n].firstRun && B(i, t, F[e].iframe, e) 458 }) 459 } 460 461 function b() { 462 O(window, "message", e), O(window, "resize", function () { 463 var e; 464 T("window", "Trigger event: " + (e = "resize")), c(function () { 465 w("Window " + e, "resize") 466 }, 16) 467 }), O(document, "visibilitychange", n), O(document, "-webkit-visibilitychange", n) 468 } 469 470 function y() { 471 function t(e, n) { 472 n && (function () { 473 if (!n.tagName) throw new TypeError("Object is not a valid DOM element"); 474 if ("IFRAME" !== n.tagName.toUpperCase()) throw new TypeError("Expected <IFRAME> tag, found <" + n.tagName + ">") 475 }(), d(n, e), o.push(n)) 476 } 477 var o; 478 return function () { 479 for (var e = ["moz", "webkit", "o", "ms"], n = 0; n < e.length && !r; n += 1) r = window[e[n] + "RequestAnimationFrame"]; 480 r ? r = r.bind(window) : T("setup", "RequestAnimationFrame not supported") 481 }(), b(), 482 function (e, n) { 483 var i; 484 switch (o = [], (i = e) && i.enablePublicMethods && N("enablePublicMethods option has been removed, public methods are now always available in the iFrame"), typeof n) { 485 case "undefined": 486 case "string": 487 Array.prototype.forEach.call(document.querySelectorAll(n || "iframe"), t.bind(u, e)); 488 break; 489 case "object": 490 t(e, n); 491 break; 492 default: 493 throw new TypeError("Unexpected data type (" + typeof n + ")") 494 } 495 return o 496 } 497 } 498 499 function v(e) { 500 e.fn ? e.fn.iFrameResize || (e.fn.iFrameResize = function (i) { 501 return this.filter("iframe").each(function (e, n) { 502 d(n, i) 503 }).end() 504 }) : E("", "Unable to bind to jQuery, it is not fully loaded.") 505 } 506 "undefined" != typeof window && (x = "message".length, I = (M = "[iFrameSizer]").length, r = window.requestAnimationFrame, g = { 507 autoResize: true, 508 bodyBackground: null, 509 bodyMargin: null, 510 bodyMarginV1: 8, 511 bodyPadding: 10, 512 checkOrigin: !(a = l = !1), 513 inPageLinks: !(F = {}), 514 enablePublicMethods: !(f = 0), 515 heightCalculationMethod: "bodyOffset", 516 id: "iFrameResizer", 517 interval: 32, 518 log: !(m = { 519 max: 1, 520 scroll: 1, 521 bodyScroll: 1, 522 documentElementScroll: 1 523 }), 524 maxHeight: 1 / 0, 525 maxWidth: 1 / 0, 526 minHeight: 0, 527 minWidth: 0, 528 mouseEvents: !0, 529 resizeFrom: "parent", 530 scrolling: true, 531 sizeHeight: !0, 532 sizeWidth: !1, 533 warningTimeout: 5e3, 534 tolerance: 0, 535 widthCalculationMethod: "scroll", 536 onClose: function () { 537 return !0 538 }, 539 onClosed: function () {}, 540 onInit: function () {}, 541 onMessage: function () { 542 N("onMessage function not defined") 543 }, 544 onMouseEnter: function () {}, 545 onMouseLeave: function () {}, 546 onResized: function () {}, 547 onScroll: function () { 548 return !0 549 } 550 }, z = {}, window.jQuery && v(window.jQuery), "function" == typeof define && define.amd ? define([], y) : "object" == typeof module && "object" == typeof module.exports && (module.exports = y()), window.iFrameResize = window.iFrameResize || y()) 551}();
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.