print_embed_scripts()
Prints the JavaScript in the embed iframe header.
Source
File: wp-includes/embed.php
function print_embed_scripts() {
?>
<script type="text/javascript">
<?php
if ( SCRIPT_DEBUG ) {
readfile( ABSPATH . WPINC . "/js/wp-embed-template.js" );
} else {
/*
* If you're looking at a src version of this file, you'll see an "include"
* statement below. This is used by the `grunt build` process to directly
* include a minified version of wp-embed-template.js, instead of using the
* readfile() method from above.
*
* If you're looking at a build version of this file, you'll see a string of
* minified JavaScript. If you need to debug it, please turn on SCRIPT_DEBUG
* and edit wp-embed-template.js directly.
*/
?>
!function(e,t){"use strict";var r,i,n,a=t.querySelector&&e.addEventListener,o=!1;function l(t,i){e.parent.postMessage({message:t,value:i,secret:r},"*")}function s(){if(!o){o=!0;var r,i=t.querySelector(".wp-embed-share-dialog"),n=t.querySelector(".wp-embed-share-dialog-open"),a=t.querySelector(".wp-embed-share-dialog-close"),s=t.querySelectorAll(".wp-embed-share-input"),d=t.querySelectorAll(".wp-embed-share-tab-button button"),u=t.querySelector(".wp-embed-featured-image img");if(s)for(r=0;r<s.length;r++)s[r].addEventListener("click",(function(e){e.target.select()}));if(n&&n.addEventListener("click",(function(){i.className=i.className.replace("hidden",""),t.querySelector('.wp-embed-share-tab-button [aria-selected="true"]').focus()})),a&&a.addEventListener("click",(function(){c()})),d)for(r=0;r<d.length;r++)d[r].addEventListener("click",b),d[r].addEventListener("keydown",f);t.addEventListener("keydown",(function(e){27===e.keyCode&&-1===i.className.indexOf("hidden")?c():9===e.keyCode&&function(e){var r=t.querySelector('.wp-embed-share-tab-button [aria-selected="true"]');a!==e.target||e.shiftKey?r===e.target&&e.shiftKey&&(a.focus(),e.preventDefault()):(r.focus(),e.preventDefault())}(e)}),!1),e.self!==e.top&&(l("height",Math.ceil(t.body.getBoundingClientRect().height)),u&&u.addEventListener("load",(function(){l("height",Math.ceil(t.body.getBoundingClientRect().height))})),t.addEventListener("click",(function(e){var t,r=e.target;(t=r.hasAttribute("href")?r.getAttribute("href"):r.parentElement.getAttribute("href"))&&(l("link",t),e.preventDefault())})))}function c(){i.className+=" hidden",t.querySelector(".wp-embed-share-dialog-open").focus()}function b(e){var r=t.querySelector('.wp-embed-share-tab-button [aria-selected="true"]');r.setAttribute("aria-selected","false"),t.querySelector("#"+r.getAttribute("aria-controls")).setAttribute("aria-hidden","true"),e.target.setAttribute("aria-selected","true"),t.querySelector("#"+e.target.getAttribute("aria-controls")).setAttribute("aria-hidden","false")}function f(e){var r,i,n=e.target,a=n.parentElement.previousElementSibling,o=n.parentElement.nextElementSibling;if(37===e.keyCode)r=a;else{if(39!==e.keyCode)return!1;r=o}"rtl"===t.documentElement.getAttribute("dir")&&(r=r===a?o:a),r&&(i=r.firstElementChild,n.setAttribute("tabindex","-1"),n.setAttribute("aria-selected",!1),t.querySelector("#"+n.getAttribute("aria-controls")).setAttribute("aria-hidden","true"),i.setAttribute("tabindex","0"),i.setAttribute("aria-selected","true"),i.focus(),t.querySelector("#"+i.getAttribute("aria-controls")).setAttribute("aria-hidden","false"))}}a&&(!function d(){e.self===e.top||r||(r=e.location.hash.replace(/.*secret=([\d\w]{10}).*/,"$1"),clearTimeout(i),i=setTimeout((function(){d()}),100))}(),t.documentElement.className=t.documentElement.className.replace(/\bno-js\b/,"")+" js",t.addEventListener("DOMContentLoaded",s,!1),e.addEventListener("load",s,!1),e.addEventListener("resize",(function(){e.self!==e.top&&(clearTimeout(n),n=setTimeout((function(){l("height",Math.ceil(t.body.getBoundingClientRect().height))}),100))}),!1))}(window,document);
<?php
}
?>
</script>
<?php
}
Changelog
Version | Description |
---|---|
WP-4.4.0 | Introduced. |