PageSourceSearch

https://4free.de/wp-includes/js/wp-embed.js?ver=5.8.17

js 4free.de collected 2026-10-06 00:17:00 UTC 3,414 bytes, 134 lines download raw bytes

1/**
2 * WordPress inline HTML embed
3 *
4 * @since 4.4.0
5 * @output wp-includes/js/wp-embed.js
6 *
7 * This file cannot have ampersands in it. This is to ensure
8 * it can be embedded in older versions of WordPress.
9 * See https://core.trac.wordpress.org/changeset/35708.
10 */
11(function ( window, document ) {
12	'use strict';
13
14	var supportedBrowser = false,
15		loaded = false;
16
17		if ( document.querySelector ) {
18			if ( window.addEventListener ) {
19				supportedBrowser = true;
20			}
21		}
22
23	/** @namespace wp */
24	window.wp = window.wp || {};
25
26	if ( !! window.wp.receiveEmbedMessage ) {
27		return;
28	}
29
30	window.wp.receiveEmbedMessage = function( e ) {
31		var data = e.data;
32
33		if ( ! data ) {
34			return;
35		}
36
37		if ( ! ( data.secret || data.message || data.value ) ) {
38			return;
39		}
40
41		if ( /[^a-zA-Z0-9]/.test( data.secret ) ) {
42			return;
43		}
44
45		var iframes = document.querySelectorAll( 'iframe[data-secret="' + data.secret + '"]' ),
46			blockquotes = document.querySelectorAll( 'blockquote[data-secret="' + data.secret + '"]' ),
47			allowedProtocols = new RegExp( '^https?:$', 'i' ),
48			i, source, height, sourceURL, targetURL;
49
50		for ( i = 0; i < blockquotes.length; i++ ) {
51			blockquotes[ i ].style.display = 'none';
52		}
53
54		for ( i = 0; i < iframes.length; i++ ) {
55			source = iframes[ i ];
56
57			if ( e.source !== source.contentWindow ) {
58				continue;
59			}
60
61			source.removeAttribute( 'style' );
62
63			/* Resize the iframe on request. */
64			if ( 'height' === data.message ) {
65				height = parseInt( data.value, 10 );
66				if ( height > 1000 ) {
67					height = 1000;
68				} else if ( ~~height < 200 ) {
69					height = 200;
70				}
71
72				source.height = height;
73			}
74
75			/* Link to a specific URL on request. */
76			if ( 'link' === data.message ) {
77				sourceURL = document.createElement( 'a' );
78				targetURL = document.createElement( 'a' );
79
80				sourceURL.href = source.getAttribute( 'src' );
81				targetURL.href = data.value;
82
83				/* Only follow link if the protocol is in the allow list. */
84				if ( ! allowedProtocols.test( targetURL.protocol ) ) {
85					continue;
86				}
87
88				/* Only continue if link hostname matches iframe's hostname. */
89				if ( targetURL.host === sourceURL.host ) {
90					if ( document.activeElement === source ) {
91						window.top.location.href = data.value;
92					}
93				}
94			}
95		}
96	};
97
98	function onLoad() {
99		if ( loaded ) {
100			return;
101		}
102
103		loaded = true;
104
105		var isIE10 = -1 !== navigator.appVersion.indexOf( 'MSIE 10' ),
106			isIE11 = !!navigator.userAgent.match( /Trident.*rv:11\./ ),
107			iframes = document.querySelectorAll( 'iframe.wp-embedded-content' ),
108			iframeClone, i, source, secret;
109
110		for ( i = 0; i < iframes.length; i++ ) {
111			source = iframes[ i ];
112
113			if ( ! source.getAttribute( 'data-secret' ) ) {
114				/* Add secret to iframe */
115				secret = Math.random().toString( 36 ).substr( 2, 10 );
116				source.src += '#?secret=' + secret;
117				source.setAttribute( 'data-secret', secret );
118			}
119
120			/* Remove security attribute from iframes in IE10 and IE11. */
121			if ( ( isIE10 || isIE11 ) ) {
122				iframeClone = source.cloneNode( true );
123				iframeClone.removeAttribute( 'security' );
124				source.parentNode.replaceChild( iframeClone, source );
125			}
126		}
127	}
128
129	if ( supportedBrowser ) {
130		window.addEventListener( 'message', window.wp.receiveEmbedMessage, false );
131		document.addEventListener( 'DOMContentLoaded', onLoad, false );
132		window.addEventListener( 'load', onLoad, false );
133	}
134})( 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.