<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[29179] trunk/src/wp-includes: Simplify creation of audio, video, and playlist MCE views by placing them in iframe sandboxes.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/29179">29179</a></dd>
<dt>Author</dt> <dd>wonderboymusic</dd>
<dt>Date</dt> <dd>2014-07-15 22:17:58 +0000 (Tue, 15 Jul 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Simplify creation of audio, video, and playlist MCE views by placing them in iframe sandboxes.

Wins:
* Eliminates duplication of code between PHP and JS
* Views can load JS without messing with TinyMCE and scope
* MEjs doesn't break when it loads a file plugin-mode. This allows any file type the MEjs supports to play in MCE views.
* YouTube now works as the source for video.
* Users can still style the views, editor stylesheets are included in these sandboxes.
* Audio and Video URLs and `[embed]`s are no longer broken.
* Remove the crazy compat code necessary to determine what file types play in what browser.
* Remove unneeded Underscore templates.
* Remove the compat code for playlists.

See <a href="http://core.trac.wordpress.org/ticket/28905">#28905</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesjsmceviewjs">trunk/src/wp-includes/js/mce-view.js</a></li>
<li><a href="#trunksrcwpincludesjsmediaaudiovideojs">trunk/src/wp-includes/js/media-audiovideo.js</a></li>
<li><a href="#trunksrcwpincludesjsmediaelementwpmediaelementcss">trunk/src/wp-includes/js/mediaelement/wp-mediaelement.css</a></li>
<li><a href="#trunksrcwpincludesjsmediaelementwpplaylistjs">trunk/src/wp-includes/js/mediaelement/wp-playlist.js</a></li>
<li><a href="#trunksrcwpincludesmediatemplatephp">trunk/src/wp-includes/media-template.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesjsmceviewjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/js/mce-view.js (29178 => 29179)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/js/mce-view.js     2014-07-15 22:07:16 UTC (rev 29178)
+++ trunk/src/wp-includes/js/mce-view.js        2014-07-15 22:17:58 UTC (rev 29179)
</span><span class="lines">@@ -104,6 +104,65 @@
</span><span class="cx">                          }
</span><span class="cx">                  }, this );
</span><span class="cx">          },
</span><ins>+
+               /* jshint scripturl: true */
+               createIframe: function ( content ) {
+                       var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver,
+                               iframe, iframeDoc, i, resize,
+                               dom = tinymce.DOM;
+
+                       if ( content.indexOf( '<script' ) !== -1 ) {
+                               iframe = dom.create( 'iframe', {
+                                       src: tinymce.Env.ie ? 'javascript:""' : '',
+                                       frameBorder: '0',
+                                       allowTransparency: 'true',
+                                       scrolling: 'no',
+                                       style: {
+                                               width: '100%',
+                                               display: 'block'
+                                       }
+                               } );
+
+                               this.setContent( iframe );
+                               iframeDoc = iframe.contentWindow.document;
+
+                               iframeDoc.open();
+                               iframeDoc.write(
+                                       '<!DOCTYPE html>' +
+                                       '<html>' +
+                                               '<head>' +
+                                                       '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />' +
+                                               '</head>' +
+                                               '<body style="padding: 0; margin: 0;" class="' + dom.doc.body.className + '">' +
+                                                       content +
+                                               '</body>' +
+                                       '</html>'
+                               );
+                               iframeDoc.close();
+
+                               resize = function() {
+                                       $( iframe ).height( $( iframeDoc.body ).height() );
+                               };
+
+                               if ( MutationObserver ) {
+                                       new MutationObserver( _.debounce( function() {
+                                               resize();
+                                       }, 100 ) )
+                                       .observe( iframeDoc.body, {
+                                               attributes: true,
+                                               childList: true,
+                                               subtree: true
+                                       } );
+                               } else {
+                                       for ( i = 1; i < 6; i++ ) {
+                                               setTimeout( resize, i * 700 );
+                                       }
+                               }
+                       } else {
+                               this.setContent( content );
+                       }
+               },
+
</ins><span class="cx">           setError: function( message, dashicon ) {
</span><span class="cx">                  this.setContent(
</span><span class="cx">                          '<div class="wpview-error">' +
</span><span class="lines">@@ -421,54 +480,60 @@
</span><span class="cx">  wp.mce.av = {
</span><span class="cx">          loaded: false,
</span><span class="cx"> 
</span><del>-               View: _.extend( {}, wp.media.mixin, {
</del><ins>+                View: {
</ins><span class="cx">                   overlay: true,
</span><span class="cx"> 
</span><ins>+                       action: 'parse-media-shortcode',
+
</ins><span class="cx">                   initialize: function( options ) {
</span><del>-                               this.players = [];
</del><span class="cx">                           this.shortcode = options.shortcode;
</span><del>-                               _.bindAll( this, 'setPlayer', 'pausePlayers' );
-                               $( this ).on( 'ready', this.setPlayer );
-                               $( this ).on( 'ready', function( event, editor ) {
-                                       editor.on( 'hide', this.pausePlayers );
-                               } );
-                               $( document ).on( 'media:edit', this.pausePlayers );
</del><ins>+                                this.fetching = false;
+
+                               _.bindAll( this, 'createIframe', 'setNode', 'fetch' );
+                               $( this ).on( 'ready', this.setNode );
</ins><span class="cx">                   },
</span><span class="cx"> 
</span><del>-                       /**
-                        * Creates the player instance for the current node
-                        *
-                        * @global MediaElementPlayer
-                        *
-                        * @param {Event} event
-                        * @param {Object} editor
-                        * @param {HTMLElement} node
-                        */
-                       setPlayer: function( event, editor, node ) {
-                               var self = this,
-                                       media;
</del><ins>+                        setNode: function () {
+                               if ( this.parsed ) {
+                                       this.createIframe( this.parsed );
+                               } else if ( ! this.fetching ) {
+                                       this.fetch();
+                               }
+                       },
</ins><span class="cx"> 
</span><del>-                               media = $( node ).find( '.wp-' +  this.shortcode.tag + '-shortcode' );
</del><ins>+                        fetch: function () {
+                               var self = this;
+                               this.fetching = true;
</ins><span class="cx"> 
</span><del>-                               if ( ! this.isCompatible( media ) ) {
-                                       media.closest( '.wpview-wrap' ).addClass( 'wont-play' );
-                                       media.replaceWith( '<p>' + media.find( 'source' ).eq(0).prop( 'src' ) + '</p>' );
-                                       return;
-                               } else {
-                                       media.closest( '.wpview-wrap' ).removeClass( 'wont-play' );
-                                       if ( this.ua.is( 'ff' ) ) {
-                                               media.prop( 'preload', 'metadata' );
-                                       } else {
-                                               media.prop( 'preload', 'none' );
</del><ins>+                                wp.ajax.send( this.action, {
+                                       data: {
+                                               post_ID: $( '#post_ID' ).val() || 0,
+                                               type: this.shortcode.tag,
+                                               shortcode: this.shortcode.string()
</ins><span class="cx">                                   }
</span><del>-                               }
</del><ins>+                                } )
+                               .always( function() {
+                                       self.fetching = false;
+                               } )
+                               .done( function( response ) {
+                                       if ( response ) {
+                                               self.parsed = response;
+                                               self.createIframe( response );
+                                       }
+                               } )
+                               .fail( function( response ) {
+                                       if ( response && response.message ) {
+                                               if ( ( response.type === 'not-embeddable' && self.type === 'embed' ) ||
+                                                       response.type === 'not-ssl' ) {
</ins><span class="cx"> 
</span><del>-                               media = wp.media.view.MediaDetails.prepareSrc( media.get(0) );
-
-                               setTimeout( function() {
-                                       wp.mce.av.loaded = true;
-                                       self.players.push( new MediaElementPlayer( media, self.mejsSettings ) );
-                               }, wp.mce.av.loaded ? 10 : 500 );
</del><ins>+                                                        self.setError( response.message, 'admin-media' );
+                                               } else {
+                                                       self.setContent( '<p>' + self.original + '</p>', null, 'replace' );
+                                               }
+                                       } else if ( response && response.statusText ) {
+                                               self.setError( response.statusText, 'admin-media' );
+                                       }
+                               } );
</ins><span class="cx">                   },
</span><span class="cx"> 
</span><span class="cx">                  /**
</span><span class="lines">@@ -477,19 +542,12 @@
</span><span class="cx">                   * @returns {string}
</span><span class="cx">                   */
</span><span class="cx">                  getHtml: function() {
</span><del>-                               var attrs = this.shortcode.attrs.named;
-                               attrs.content = this.shortcode.content;
-
-                               return this.template({ model: _.defaults(
-                                       attrs,
-                                       wp.media[ this.shortcode.tag ].defaults )
-                               });
-                       },
-
-                       unbind: function() {
-                               this.unsetPlayers();
</del><ins>+                                if ( ! this.parsed ) {
+                                       return '';
+                               }
+                               return this.parsed;
</ins><span class="cx">                   }
</span><del>-               } ),
</del><ins>+                },
</ins><span class="cx"> 
</span><span class="cx">          /**
</span><span class="cx">           * Called when a TinyMCE view is clicked for editing.
</span><span class="lines">@@ -537,10 +595,7 @@
</span><span class="cx">   * @mixes wp.mce.av
</span><span class="cx">   */
</span><span class="cx">  wp.mce.views.register( 'video', _.extend( {}, wp.mce.av, {
</span><del>-               state: 'video-details',
-               View: _.extend( {}, wp.mce.av.View, {
-                       template: media.template( 'editor-video' )
-               } )
</del><ins>+                state: 'video-details'
</ins><span class="cx">   } ) );
</span><span class="cx"> 
</span><span class="cx">  /**
</span><span class="lines">@@ -549,10 +604,7 @@
</span><span class="cx">   * @mixes wp.mce.av
</span><span class="cx">   */
</span><span class="cx">  wp.mce.views.register( 'audio', _.extend( {}, wp.mce.av, {
</span><del>-               state: 'audio-details',
-               View: _.extend( {}, wp.mce.av.View, {
-                       template: media.template( 'editor-audio' )
-               } )
</del><ins>+                state: 'audio-details'
</ins><span class="cx">   } ) );
</span><span class="cx"> 
</span><span class="cx">  /**
</span><span class="lines">@@ -561,274 +613,34 @@
</span><span class="cx">   * @mixes wp.mce.av
</span><span class="cx">   */
</span><span class="cx">  wp.mce.views.register( 'playlist', _.extend( {}, wp.mce.av, {
</span><del>-               state: ['playlist-edit', 'video-playlist-edit'],
-               View: _.extend( {}, wp.media.mixin, {
-                       template:  media.template( 'editor-playlist' ),
-                       overlay: true,
-
-                       initialize: function( options ) {
-                               this.players = [];
-                               this.data = {};
-                               this.attachments = [];
-                               this.shortcode = options.shortcode;
-
-                               $( this ).on( 'ready', function( event, editor ) {
-                                       editor.on( 'hide', this.pausePlayers );
-                               } );
-                               $( document ).on( 'media:edit', this.pausePlayers );
-
-                               this.fetch();
-
-                               $( this ).on( 'ready', this.setPlaylist );
-                       },
-
-                       /**
-                        * Asynchronously fetch the shortcode's attachments
-                        */
-                       fetch: function() {
-                               this.attachments = wp.media.playlist.attachments( this.shortcode );
-                               this.dfd = this.attachments.more().done( _.bind( this.render, this ) );
-                       },
-
-                       setPlaylist: function( event, editor, element ) {
-                               if ( ! this.data.tracks ) {
-                                       return;
-                               }
-
-                               this.players.push( new WPPlaylistView( {
-                                       el: $( element ).find( '.wp-playlist' ).get( 0 ),
-                                       metadata: this.data
-                               } ).player );
-                       },
-
-                       /**
-                        * Set the data that will be used to compile the Underscore template,
-                        *  compile the template, and then return it.
-                        *
-                        * @returns {string}
-                        */
-                       getHtml: function() {
-                               var data = this.shortcode.attrs.named,
-                                       model = wp.media.playlist,
-                                       options,
-                                       attachments,
-                                       tracks = [];
-
-                               // Don't render errors while still fetching attachments
-                               if ( this.dfd && 'pending' === this.dfd.state() && ! this.attachments.length ) {
-                                       return '';
-                               }
-
-                               _.each( model.defaults, function( value, key ) {
-                                       data[ key ] = model.coerce( data, key );
-                               });
-
-                               options = {
-                                       type: data.type,
-                                       style: data.style,
-                                       tracklist: data.tracklist,
-                                       tracknumbers: data.tracknumbers,
-                                       images: data.images,
-                                       artists: data.artists
-                               };
-
-                               if ( ! this.attachments.length ) {
-                                       return this.template( options );
-                               }
-
-                               attachments = this.attachments.toJSON();
-
-                               _.each( attachments, function( attachment ) {
-                                       var size = {}, resize = {}, track = {
-                                               src : attachment.url,
-                                               type : attachment.mime,
-                                               title : attachment.title,
-                                               caption : attachment.caption,
-                                               description : attachment.description,
-                                               meta : attachment.meta
-                                       };
-
-                                       if ( 'video' === data.type ) {
-                                               size.width = attachment.width;
-                                               size.height = attachment.height;
-                                               if ( media.view.settings.contentWidth ) {
-                                                       resize.width = media.view.settings.contentWidth - 22;
-                                                       resize.height = Math.ceil( ( size.height * resize.width ) / size.width );
-                                                       if ( ! options.width ) {
-                                                               options.width = resize.width;
-                                                               options.height = resize.height;
-                                                       }
-                                               } else {
-                                                       if ( ! options.width ) {
-                                                               options.width = attachment.width;
-                                                               options.height = attachment.height;
-                                                       }
-                                               }
-                                               track.dimensions = {
-                                                       original : size,
-                                                       resized : _.isEmpty( resize ) ? size : resize
-                                               };
-                                       } else {
-                                               options.width = 400;
-                                       }
-
-                                       track.image = attachment.image;
-                                       track.thumb = attachment.thumb;
-
-                                       tracks.push( track );
-                               } );
-
-                               options.tracks = tracks;
-                               this.data = options;
-
-                               return this.template( options );
-                       },
-
-                       unbind: function() {
-                               this.unsetPlayers();
-                       }
-               } )
</del><ins>+                state: [ 'playlist-edit', 'video-playlist-edit' ]
</ins><span class="cx">   } ) );
</span><span class="cx"> 
</span><span class="cx">  /**
</span><span class="cx">   * TinyMCE handler for the embed shortcode
</span><span class="cx">   */
</span><del>-       wp.mce.embedView = _.extend( {}, wp.media.mixin, {
-               overlay: true,
-               initialize: function( options ) {
-                       this.players = [];
-                       this.content = options.content;
-                       this.fetching = false;
-                       this.parsed = false;
-                       this.original = options.url || options.shortcode.string();
</del><ins>+        wp.mce.embedMixin = {
+               View: _.extend( {}, wp.mce.av.View, {
+                       overlay: true,
+                       action: 'parse-embed',
+                       initialize: function( options ) {
+                               this.content = options.content;
+                               this.fetching = false;
+                               this.parsed = false;
+                               this.original = options.url || options.shortcode.string();
</ins><span class="cx"> 
</span><del>-                       if ( options.url ) {
-                               this.shortcode = '[embed]' + options.url + '[/embed]';
-                       } else {
-                               this.shortcode = options.shortcode.string();
-                       }
-
-                       _.bindAll( this, 'setHtml', 'setNode', 'fetch' );
-                       $( this ).on( 'ready', this.setNode );
-               },
-               unbind: function() {
-                       var self = this;
-                       _.each( this.players, function ( player ) {
-                               player.pause();
-                               self.removePlayer( player );
-                       } );
-                       this.players = [];
-               },
-               setNode: function () {
-                       if ( this.parsed ) {
-                               this.setHtml( this.parsed );
-                               this.parseMediaShortcodes();
-                       } else if ( ! this.fetching ) {
-                               this.fetch();
-                       }
-               },
-               fetch: function () {
-                       var self = this;
-
-                       this.fetching = true;
-
-                       wp.ajax.send( 'parse-embed', {
-                               data: {
-                                       post_ID: $( '#post_ID' ).val() || 0,
-                                       shortcode: this.shortcode
-                               }
-                       } )
-                       .always( function() {
-                               self.fetching = false;
-                       } )
-                       .done( function( response ) {
-                               if ( response ) {
-                                       self.parsed = response;
-                                       self.setHtml( response );
-                               }
-                       } )
-                       .fail( function( response ) {
-                               if ( response && response.message ) {
-                                       if ( ( response.type === 'not-embeddable' && self.type === 'embed' ) ||
-                                               response.type === 'not-ssl' ) {
-
-                                               self.setError( response.message, 'admin-media' );
-                                       } else {
-                                               self.setContent( '<p>' + self.original + '</p>', null, 'replace' );
-                                       }
-                               } else if ( response && response.statusText ) {
-                                       self.setError( response.statusText, 'admin-media' );
-                               }
-                       } );
-               },
-               /* jshint scripturl: true */
-               setHtml: function ( content ) {
-                       var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver,
-                               iframe, iframeDoc, i, resize,
-                               dom = tinymce.DOM;
-
-                       if ( content.indexOf( '<script' ) !== -1 ) {
-                               iframe = dom.create( 'iframe', {
-                                       src: tinymce.Env.ie ? 'javascript:""' : '',
-                                       frameBorder: '0',
-                                       allowTransparency: 'true',
-                                       style: {
-                                               width: '100%',
-                                               display: 'block'
-                                       }
-                               } );
-
-                               this.setContent( iframe );
-                               iframeDoc = iframe.contentWindow.document;
-
-                               iframeDoc.open();
-                               iframeDoc.write(
-                                       '<!DOCTYPE html>' +
-                                       '<html>' +
-                                               '<head>' +
-                                                       '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />' +
-                                               '</head>' +
-                                               '<body>' +
-                                                       content +
-                                               '</body>' +
-                                       '</html>'
-                               );
-                               iframeDoc.close();
-
-                               resize = function() {
-                                       $( iframe ).height( $( iframeDoc ).height() );
-                               };
-
-                               if ( MutationObserver ) {
-                                       new MutationObserver( _.debounce( function() {
-                                               resize();
-                                       }, 100 ) )
-                                       .observe( iframeDoc.body, {
-                                               attributes: true,
-                                               childList: true,
-                                               subtree: true
</del><ins>+                                if ( options.url ) {
+                                       this.shortcode = media.embed.shortcode( {
+                                               url: options.url
</ins><span class="cx">                                   } );
</span><span class="cx">                          } else {
</span><del>-                                       for ( i = 1; i < 6; i++ ) {
-                                               setTimeout( resize, i * 700 );
-                                       }
</del><ins>+                                        this.shortcode = options.shortcode;
</ins><span class="cx">                           }
</span><del>-                       } else {
-                               this.setContent( content );
</del><ins>+
+                               _.bindAll( this, 'createIframe', 'setNode', 'fetch' );
+                               $( this ).on( 'ready', this.setNode );
</ins><span class="cx">                   }
</span><del>-
-                       this.parseMediaShortcodes();
-               },
-               parseMediaShortcodes: function () {
-                       var self = this;
-                       $( '.wp-audio-shortcode, .wp-video-shortcode', this.node ).each( function ( i, element ) {
-                               self.players.push( new MediaElementPlayer( element, self.mejsSettings ) );
-                       } );
-               }
-       } );
-
-       wp.mce.embedMixin = {
-               View: wp.mce.embedView,
</del><ins>+                } ),
</ins><span class="cx">           edit: function( node ) {
</span><span class="cx">                  var embed = media.embed,
</span><span class="cx">                          self = this,
</span></span></pre></div>
<a id="trunksrcwpincludesjsmediaaudiovideojs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/js/media-audiovideo.js (29178 => 29179)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/js/media-audiovideo.js     2014-07-15 22:07:16 UTC (rev 29178)
+++ trunk/src/wp-includes/js/media-audiovideo.js        2014-07-15 22:17:58 UTC (rev 29179)
</span><span class="lines">@@ -47,103 +47,6 @@
</span><span class="cx">          },
</span><span class="cx"> 
</span><span class="cx">          /**
</span><del>-                * Utility to identify the user's browser
-                */
-               ua: {
-                       is : function( browser ) {
-                               var passes = false, ua = window.navigator.userAgent;
-
-                               switch ( browser ) {
-                                       case 'oldie':
-                                               passes = ua.match(/MSIE [6-8]/gi) !== null;
-                                       break;
-                                       case 'ie':
-                                               passes = /MSIE /.test( ua ) || ( /Trident\//.test( ua ) && /rv:\d/.test( ua ) ); // IE11
-                                       break;
-                                       case 'ff':
-                                               passes = ua.match(/firefox/gi) !== null;
-                                       break;
-                                       case 'opera':
-                                               passes = ua.match(/OPR/) !== null;
-                                       break;
-                                       case 'safari':
-                                               passes = ua.match(/safari/gi) !== null && ua.match(/chrome/gi) === null;
-                                       break;
-                                       case 'chrome':
-                                               passes = ua.match(/safari/gi) !== null && ua.match(/chrome/gi) !== null;
-                                       break;
-                               }
-
-                               return passes;
-                       }
-               },
-
-               /**
-                * Specify compatibility for native playback by browser
-                */
-               compat :{
-                       'opera' : {
-                               audio: ['ogg', 'wav'],
-                               video: ['ogg', 'webm']
-                       },
-                       'chrome' : {
-                               audio: ['ogg', 'mpeg'],
-                               video: ['ogg', 'webm', 'mp4', 'm4v', 'mpeg']
-                       },
-                       'ff' : {
-                               audio: ['ogg', 'mpeg'],
-                               video: ['ogg', 'webm']
-                       },
-                       'safari' : {
-                               audio: ['mpeg', 'wav'],
-                               video: ['mp4', 'm4v', 'mpeg', 'x-ms-wmv', 'quicktime']
-                       },
-                       'ie' : {
-                               audio: ['mpeg'],
-                               video: ['mp4', 'm4v', 'mpeg']
-                       }
-               },
-
-               /**
-                * Determine if the passed media contains a <source> that provides
-                *  native playback in the user's browser
-                *
-                * @param {jQuery} media
-                * @returns {Boolean}
-                */
-               isCompatible: function( media ) {
-                       if ( ! media.find( 'source' ).length ) {
-                               return false;
-                       }
-
-                       var ua = this.ua, test = false, found = false, sources;
-
-                       if ( ua.is( 'oldIE' ) ) {
-                               return false;
-                       }
-
-                       sources = media.find( 'source' );
-
-                       _.find( this.compat, function( supports, browser ) {
-                               if ( ua.is( browser ) ) {
-                                       found = true;
-                                       _.each( sources, function( elem ) {
-                                               var audio = new RegExp( 'audio\/(' + supports.audio.join('|') + ')', 'gi' ),
-                                                       video = new RegExp( 'video\/(' + supports.video.join('|') + ')', 'gi' );
-
-                                               if ( elem.type.match( video ) !== null || elem.type.match( audio ) !== null ) {
-                                                       test = true;
-                                               }
-                                       } );
-                               }
-
-                               return test || found;
-                       } );
-
-                       return test;
-               },
-
-               /**
</del><span class="cx">            * Override the MediaElement method for removing a player.
</span><span class="cx">           *      MediaElement tries to pull the audio/video tag out of
</span><span class="cx">           *      its container and re-add it to the DOM.
</span></span></pre></div>
<a id="trunksrcwpincludesjsmediaelementwpmediaelementcss"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/js/mediaelement/wp-mediaelement.css (29178 => 29179)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/js/mediaelement/wp-mediaelement.css        2014-07-15 22:07:16 UTC (rev 29178)
+++ trunk/src/wp-includes/js/mediaelement/wp-mediaelement.css   2014-07-15 22:17:58 UTC (rev 29179)
</span><span class="lines">@@ -111,6 +111,10 @@
</span><span class="cx">  line-height: 1.5;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+.wp-admin .wp-playlist {
+       margin: 0 0 18px;
+}
+
</ins><span class="cx"> .wp-playlist video {
</span><span class="cx">  display: inline-block;
</span><span class="cx">  max-width: 100%;
</span></span></pre></div>
<a id="trunksrcwpincludesjsmediaelementwpplaylistjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/js/mediaelement/wp-playlist.js (29178 => 29179)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/js/mediaelement/wp-playlist.js     2014-07-15 22:07:16 UTC (rev 29178)
+++ trunk/src/wp-includes/js/mediaelement/wp-playlist.js        2014-07-15 22:17:58 UTC (rev 29179)
</span><span class="lines">@@ -7,7 +7,6 @@
</span><span class="cx">          initialize : function (options) {
</span><span class="cx">                  this.index = 0;
</span><span class="cx">                  this.settings = {};
</span><del>-                       this.compatMode = $( 'body' ).hasClass( 'wp-admin' ) && $( '#content_ifr' ).length;
</del><span class="cx">                   this.data = options.metadata || $.parseJSON( this.$('script').html() );
</span><span class="cx">                  this.playerNode = this.$( this.data.type );
</span><span class="cx"> 
</span><span class="lines">@@ -27,9 +26,7 @@
</span><span class="cx">                          this.renderTracks();
</span><span class="cx">                  }
</span><span class="cx"> 
</span><del>-                       if ( this.isCompatibleSrc() ) {
-                               this.playerNode.attr( 'src', this.current.get( 'src' ) );
-                       }
</del><ins>+                        this.playerNode.attr( 'src', this.current.get( 'src' ) );
</ins><span class="cx"> 
</span><span class="cx">                  _.bindAll( this, 'bindPlayer', 'bindResetPlayer', 'setPlayer', 'ended', 'clickTrack' );
</span><span class="cx"> 
</span><span class="lines">@@ -47,27 +44,9 @@
</span><span class="cx"> 
</span><span class="cx">          bindResetPlayer : function (mejs) {
</span><span class="cx">                  this.bindPlayer( mejs );
</span><del>-                       if ( this.isCompatibleSrc() ) {
-                               this.playCurrentSrc();
-                       }
</del><ins>+                        this.playCurrentSrc();
</ins><span class="cx">           },
</span><span class="cx"> 
</span><del>-               isCompatibleSrc: function () {
-                       var testNode;
-
-                       if ( this.compatMode ) {
-                               testNode = $( '<span><source type="' + this.current.get( 'type' ) + '" /></span>' );
-
-                               if ( ! wp.media.mixin.isCompatible( testNode ) ) {
-                                       this.playerNode.removeAttr( 'src' );
-                                       this.playerNode.removeAttr( 'poster' );
-                                       return;
-                               }
-                       }
-
-                       return true;
-               },
-
</del><span class="cx">           setPlayer: function (force) {
</span><span class="cx">                  if ( this.player ) {
</span><span class="cx">                          this.player.pause();
</span><span class="lines">@@ -76,9 +55,7 @@
</span><span class="cx">                  }
</span><span class="cx"> 
</span><span class="cx">                  if (force) {
</span><del>-                               if ( this.isCompatibleSrc() ) {
-                                       this.playerNode.attr( 'src', this.current.get( 'src' ) );
-                               }
</del><ins>+                                this.playerNode.attr( 'src', this.current.get( 'src' ) );
</ins><span class="cx">                           this.settings.success = this.bindResetPlayer;
</span><span class="cx">                  }
</span><span class="cx"> 
</span><span class="lines">@@ -188,11 +165,9 @@
</span><span class="cx">  });
</span><span class="cx"> 
</span><span class="cx">     $(document).ready(function () {
</span><del>-               if ( ! $( 'body' ).hasClass( 'wp-admin' ) || $( 'body' ).hasClass( 'about-php' ) ) {
-                       $('.wp-playlist').each(function () {
-                               return new WPPlaylistView({ el: this });
-                       });
-               }
</del><ins>+                $('.wp-playlist').each( function() {
+                       return new WPPlaylistView({ el: this });
+               } );
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">  window.WPPlaylistView = WPPlaylistView;
</span></span></pre></div>
<a id="trunksrcwpincludesmediatemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/media-template.php (29178 => 29179)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/media-template.php 2014-07-15 22:07:16 UTC (rev 29178)
+++ trunk/src/wp-includes/media-template.php    2014-07-15 22:17:58 UTC (rev 29179)
</span><span class="lines">@@ -1216,35 +1216,6 @@
</span><span class="cx">          <# } #>
</span><span class="cx">  </script>
</span><span class="cx"> 
</span><del>-       <script type="text/html" id="tmpl-editor-audio">
-               <?php wp_underscore_audio_template() ?>
-       </script>
-
-       <script type="text/html" id="tmpl-editor-video">
-               <?php wp_underscore_video_template() ?>
-       </script>
-
-       <?php wp_underscore_playlist_templates() ?>
-
-       <script type="text/html" id="tmpl-editor-playlist">
-               <# if ( data.tracks ) { #>
-                       <div class="wp-playlist wp-{{ data.type }}-playlist wp-playlist-{{ data.style }}">
-                               <# if ( 'audio' === data.type ){ #>
-                               <div class="wp-playlist-current-item"></div>
-                               <# } #>
-                               <{{ data.type }} controls="controls" preload="none" <#
-                                       if ( data.width ) { #> width="{{ data.width }}"<# }
-                                       #><# if ( data.height ) { #> height="{{ data.height }}"<# } #>></{{ data.type }}>
-                               <div class="wp-playlist-next"></div>
-                               <div class="wp-playlist-prev"></div>
-                       </div>
-               <# } else { #>
-                       <div class="wpview-error">
-                               <div class="dashicons dashicons-video-alt3"></div><p><?php _e( 'No items found.' ); ?></p>
-                       </div>
-               <# } #>
-       </script>
-
</del><span class="cx">   <script type="text/html" id="tmpl-crop-content">
</span><span class="cx">          <img class="crop-image" src="{{ data.url }}">
</span><span class="cx">          <div class="upload-errors"></div>
</span></span></pre>
</div>
</div>

</body>
</html>