1(function () { 2 'use strict'; 3 4 var FALLBACK_VERSION = 'legacy'; 5 var scriptTag = document.querySelector('script[data-iframe-resizer-license]'); 6 var LICENSE = scriptTag ? scriptTag.getAttribute('data-iframe-resizer-license') : ''; 7 8 var GLOBALS = { 9 legacy: ['iFrameResize'], 10 v5: ['iframeResize'] 11 }; 12 13 var pending = {}; 14 15 function loadScript(src) { 16 if (pending[src]) { 17 return pending[src]; 18 } 19 20 pending[src] = new Promise(function (resolve, reject) { 21 var script = document.createElement('script'); 22 script.src = src; 23 script.async = true; 24 script.onload = resolve; 25 script.onerror = function () { 26 reject(new Error('Konnte ' + src + ' nicht laden.')); 27 }; 28 document.head.appendChild(script); 29 }); 30 31 return pending[src]; 32 } 33 34 function resolveResizer(version) { 35 var names = GLOBALS[version] || GLOBALS[FALLBACK_VERSION]; 36 37 for (var i = 0; i < names.length; i++) { 38 if (typeof window[names[i]] === 'function') { 39 return window[names[i]]; 40 } 41 } 42 43 return null; 44 } 45 46 function init(wrapper) { 47 var id = wrapper.getAttribute('data-iframe-resizer-target'); 48 var version = wrapper.getAttribute('data-iframe-resizer-version'); 49 var license = wrapper.getAttribute('data-iframe-resizer-license'); 50 var src = wrapper.getAttribute('data-iframe-resizer-src'); 51 var iframe = wrapper.querySelector('iframe'); 52 53 if (!iframe || !src) { 54 return; 55 } 56 57 loadScript(src).then(function () { 58 var resize = resolveResizer(version); 59 60 if (!resize) { 61 console.error('[iframe-resizer] Keine Init-Funktion gefunden (' + version + ', #' + id + ').'); 62 return; 63 } 64 65 var options = { log: false }; 66 67 if (license) { 68 options.license = license; 69 } 70 71 resize(options, iframe); 72 }).catch(function (error) { 73 console.error('[iframe-resizer] ' + error.message); 74 }); 75 } 76 77 function boot() { 78 Array.prototype.forEach.call( 79 document.querySelectorAll('[data-iframe-resizer]'), 80 init 81 ); 82 } 83 84 if (document.readyState === 'loading') { 85 document.addEventListener('DOMContentLoaded', boot); 86 } else { 87 boot(); 88 } 89})();
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.