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