1/** 2 * Bypass Iframe Height Limit 3 * 4 * Adapted from /wp-includes/js/wp-embed.js 5 */ 6(function ( window, document ) { 7 'use strict'; 8 9 var supportedBrowser = false; 10 11 if ( document.querySelector ) { 12 if ( window.addEventListener ) { 13 supportedBrowser = true; 14 } 15 } 16 17 /** @namespace bihl */ 18 window.bihl = window.bihl || {}; 19 20 if ( !! window.bihl.BypassIframeHeightLimit ) { 21 return; 22 } 23 24 window.bihl.BypassIframeHeightLimit = function( e ) { 25 var data = e.data; 26 if ( ! ( data.secret || data.message || data.value ) ) { 27 return; 28 } 29 30 if ( /[^a-zA-Z0-9]/.test( data.secret ) ) { 31 return; 32 } 33 34 var iframes = document.querySelectorAll( 'iframe[data-secret="' + data.secret + '"]' ), 35 i, source, height, sourceURL, targetURL; 36 37 for ( i = 0; i < iframes.length; i++ ) { 38 source = iframes[ i ]; 39 40 if ( e.source !== source.contentWindow ) { 41 continue; 42 } 43 44 if ( 'height' === data.message ) { 45 // we need to create a style element rather than using inline styles, 46 // because wp-embed.js wipes out any inline styles 47 var styleElem = document.getElementById( 'bihl-style-' + source.getAttribute('data-secret') ); 48 var css = 'iframe.wp-embedded-content[data-secret="' + source.getAttribute('data-secret') 49 + '"] { height: ' + parseInt( data.value, 10 ) + 'px; }'; 50 51 if ( styleElem ) { 52 styleElem.innerHTML = css; 53 } else { 54 var head = document.head || document.getElementsByTagName('head')[0], 55 style = document.createElement('style'); 56 57 style.type = 'text/css'; 58 style.id = 'bihl-style-' + source.getAttribute('data-secret'); 59 style.appendChild( document.createTextNode(css) ); 60 61 head.appendChild( style ); 62 } 63 } 64 65 } 66 }; 67 68 if ( supportedBrowser ) { 69 window.addEventListener( 'message', window.bihl.BypassIframeHeightLimit, false ); 70 } 71})( window, document );
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.