diff --git a/Gruntfile.js b/Gruntfile.js index b8dd5f8..29173b4 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -233,7 +233,8 @@ module.exports = function(grunt) { // Exceptions '!wp-includes/css/dashicons.css', - '!wp-includes/css/wp-oembed-embed.css' + '!wp-includes/css/wp-oembed-embed.css', + '!wp-includes/css/wp-oembed-embed-ie.css' ] }, colors: { diff --git a/src/wp-includes/css/wp-oembed-embed.css b/src/wp-includes/css/wp-oembed-embed.css index 9ea586b..0e85aae 100644 --- a/src/wp-includes/css/wp-oembed-embed.css +++ b/src/wp-includes/css/wp-oembed-embed.css @@ -19,6 +19,8 @@ body { /* Dashicons */ .dashicons { display: inline-block; + *display: inline; + *zoom: 1; width: 20px; height: 20px; background-color: transparent; @@ -48,6 +50,10 @@ body { background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.5%2012q1.24%200%202.12.88T17.5%2015t-.88%202.12-2.12.88-2.12-.88T11.5%2015q0-.34.09-.69l-4.38-2.3Q6.32%2013%205%2013q-1.24%200-2.12-.88T2%2010t.88-2.12T5%207q1.3%200%202.21.99l4.38-2.3q-.09-.35-.09-.69%200-1.24.88-2.12T14.5%202t2.12.88T17.5%205t-.88%202.12T14.5%208q-1.3%200-2.21-.99l-4.38%202.3Q8%209.66%208%2010t-.09.69l4.38%202.3q.89-.99%202.21-.99z%27%20fill%3D%27%2382878c%27%2F%3E%3C%2Fsvg%3E"); } +.no-js .dashicons-share { + display: none; +} + .wp-embed-share-dialog-open:hover .dashicons-share { background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.5%2012q1.24%200%202.12.88T17.5%2015t-.88%202.12-2.12.88-2.12-.88T11.5%2015q0-.34.09-.69l-4.38-2.3Q6.32%2013%205%2013q-1.24%200-2.12-.88T2%2010t.88-2.12T5%207q1.3%200%202.21.99l4.38-2.3q-.09-.35-.09-.69%200-1.24.88-2.12T14.5%202t2.12.88T17.5%205t-.88%202.12T14.5%208q-1.3%200-2.21-.99l-4.38%202.3Q8%209.66%208%2010t-.09.69l4.38%202.3q.89-.99%202.21-.99z%27%20fill%3D%27%230073aa%27%2F%3E%3C%2Fsvg%3E"); } @@ -139,12 +145,16 @@ p.wp-embed-heading { .wp-embed-site-title a { position: relative; display: inline-block; + *display: inline; + *zoom: 1; padding-left: 35px; } .wp-embed-site-title, .wp-embed-meta { display: table-cell; + *display: inline; + *zoom: 1; } .wp-embed-meta { @@ -156,6 +166,7 @@ p.wp-embed-heading { .wp-embed-comments, .wp-embed-share { display: inline; + *zoom: 1; } .wp-embed-meta a:hover { @@ -166,6 +177,8 @@ p.wp-embed-heading { .wp-embed-comments a { line-height: 25px; display: inline-block; + *display: inline; + *zoom: 1; } .wp-embed-comments + .wp-embed-share { @@ -178,6 +191,7 @@ p.wp-embed-heading { left: 0; right: 0; bottom: 0; + background-color: #222; background-color: rgba(10, 10, 10, 0.9); color: #fff; opacity: 1; @@ -254,7 +268,9 @@ p.wp-embed-heading { } .wp-embed-share-tab-button { - display: inline; + display: inline-block; + *display: inline; + *zoom: 1; } .wp-embed-share-tab-button button { @@ -355,4 +371,4 @@ html[dir="rtl"] .wp-embed-share-tab-button + .wp-embed-share-tab-button { padding: 0 11px 0 0; border-left: none; border-right: 1px solid #aaa; -} +} \ No newline at end of file diff --git a/src/wp-includes/default-filters.php b/src/wp-includes/default-filters.php index 75dadfc..42491f3 100644 --- a/src/wp-includes/default-filters.php +++ b/src/wp-includes/default-filters.php @@ -446,6 +446,7 @@ add_action( 'parse_query', 'wp_oembed_parse_query' ); add_action( 'wp_head', 'wp_oembed_add_discovery_links' ); add_action( 'wp_head', 'wp_oembed_add_host_js' ); +add_action( 'oembed_head', 'wp_oembed_enqueue_scripts', 1 ); add_action( 'oembed_head', 'print_emoji_detection_script' ); add_action( 'oembed_head', 'print_emoji_styles' ); add_action( 'oembed_head', 'print_oembed_embed_styles' ); diff --git a/src/wp-includes/embed-functions.php b/src/wp-includes/embed-functions.php index 094d8cd..70c8f0b 100644 --- a/src/wp-includes/embed-functions.php +++ b/src/wp-includes/embed-functions.php @@ -802,6 +802,26 @@ function wp_oembed_excerpt_attachment( $content ) { } /** + * Enqueue embed iframe default CSS and JS & fire do_action('wp_oembed_enqueue_scripts') + * + * Enqueue PNG fallback CSS for embed iframe for legacy versions of IE. + * + * Allows plugins to queue scripts for the embed iframe end using wp_enqueue_script(). + * Runs first in oembed_head(). + * + * @since 4.4.0 + */ +function wp_oembed_enqueue_scripts() { + wp_enqueue_style( 'wp-oembed-embed-ie' ); + /** + * Fires when scripts and styles are enqueued for the embed iframe. + * + * @since 4.4.0 + */ + do_action( 'wp_oembed_enqueue_scripts' ); +} + +/** * Prints the CSS in the embed iframe header. * * @since 4.4.0 diff --git a/src/wp-includes/embed-template.php b/src/wp-includes/embed-template.php index 9d5371c2..2cebdeb 100644 --- a/src/wp-includes/embed-template.php +++ b/src/wp-includes/embed-template.php @@ -18,7 +18,7 @@ wp_enqueue_style( 'open-sans' ); ?> -> + class="no-js"> <?php wp_title( '-', true, 'right' ); ?> diff --git a/src/wp-includes/js/wp-oembed-embed.js b/src/wp-includes/js/wp-oembed-embed.js index 847ebcf..114a9e4 100644 --- a/src/wp-includes/js/wp-oembed-embed.js +++ b/src/wp-includes/js/wp-oembed-embed.js @@ -2,6 +2,8 @@ 'use strict'; var secret = window.location.hash.replace( /.*secret=([\d\w]{10}).*/, '$1' ), + featuredBrowser = ( document.querySelector && window.addEventListener ), + loaded = false, resizing; function sendEmbedMessage( message, value ) { @@ -13,6 +15,11 @@ } function onLoad() { + if ( loaded ) { + return; + } + loaded = true; + var share_dialog = document.querySelector( '.wp-embed-share-dialog' ), share_dialog_open = document.querySelector( '.wp-embed-share-dialog-open' ), share_dialog_close = document.querySelector( '.wp-embed-share-dialog-close' ), @@ -141,8 +148,6 @@ } } - document.addEventListener( 'DOMContentLoaded', onLoad, false ); - /** * Iframe resize handler. */ @@ -158,5 +163,10 @@ }, 100 ); } - window.addEventListener( 'resize', onResize, false ); + if ( featuredBrowser ) { + document.documentElement.className = document.documentElement.className.replace( /\bno-js\b/, '' ) + ' js'; + document.addEventListener( 'DOMContentLoaded', onLoad, false ); + window.addEventListener( 'load', onLoad, false ); + window.addEventListener( 'resize', onResize, false ); + } })( window, document ); diff --git a/src/wp-includes/js/wp-oembed.js b/src/wp-includes/js/wp-oembed.js index dd03bc0..6e92082 100644 --- a/src/wp-includes/js/wp-oembed.js +++ b/src/wp-includes/js/wp-oembed.js @@ -1,6 +1,9 @@ (function ( window, document ) { 'use strict'; + var featuredBrowser = ( document.querySelector && window.addEventListener ), + loaded = false; + window.wp = window.wp || {}; if ( !! window.wp.receiveEmbedMessage ) { @@ -44,9 +47,12 @@ } }; - window.addEventListener( 'message', window.wp.receiveEmbedMessage, false ); - function onLoad() { + if ( loaded ) { + return; + } + loaded = true; + var isIE10 = -1 !== navigator.appVersion.indexOf( 'MSIE 10' ), isIE11 = !!navigator.userAgent.match( /Trident.*rv\:11\./ ); @@ -63,5 +69,9 @@ } } - document.addEventListener( 'DOMContentLoaded', onLoad, false ); + if ( featuredBrowser ) { + window.addEventListener( 'message', window.wp.receiveEmbedMessage, false ); + document.addEventListener( 'DOMContentLoaded', onLoad, false ); + window.addEventListener( 'load', onLoad, false ); + } })( window, document ); diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php index cb88adc..b5db5f2 100644 --- a/src/wp-includes/script-loader.php +++ b/src/wp-includes/script-loader.php @@ -728,12 +728,14 @@ function wp_default_styles( &$styles ) { $styles->add( 'open-sans', $open_sans_font_url ); // Includes CSS - $styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array( 'open-sans', 'dashicons' ) ); - $styles->add( 'wp-auth-check', "/wp-includes/css/wp-auth-check$suffix.css", array( 'dashicons' ) ); - $styles->add( 'editor-buttons', "/wp-includes/css/editor$suffix.css", array( 'dashicons' ) ); - $styles->add( 'media-views', "/wp-includes/css/media-views$suffix.css", array( 'buttons', 'dashicons', 'wp-mediaelement' ) ); - $styles->add( 'wp-pointer', "/wp-includes/css/wp-pointer$suffix.css", array( 'dashicons' ) ); - $styles->add( 'customize-preview', "/wp-includes/css/customize-preview$suffix.css" ); + $styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array( 'open-sans', 'dashicons' ) ); + $styles->add( 'wp-auth-check', "/wp-includes/css/wp-auth-check$suffix.css", array( 'dashicons' ) ); + $styles->add( 'editor-buttons', "/wp-includes/css/editor$suffix.css", array( 'dashicons' ) ); + $styles->add( 'media-views', "/wp-includes/css/media-views$suffix.css", array( 'buttons', 'dashicons', 'wp-mediaelement' ) ); + $styles->add( 'wp-pointer', "/wp-includes/css/wp-pointer$suffix.css", array( 'dashicons' ) ); + $styles->add( 'customize-preview', "/wp-includes/css/customize-preview$suffix.css" ); + $styles->add( 'wp-oembed-embed-ie', "/wp-includes/css/wp-oembed-embed-ie$suffix.css" ); + $styles->add_data( 'wp-oembed-embed-ie', 'conditional', 'lte IE 8' ); // External libraries and friends $styles->add( 'imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.8' );