wp/wp-includes/js/media-audiovideo.js
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 18 be944660c56a
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
   148 
   148 
   149 		if ( ! t.options ) {
   149 		if ( ! t.options ) {
   150 			return;
   150 			return;
   151 		}
   151 		}
   152 
   152 
   153 		// invoke features cleanup
   153 		// Invoke features cleanup.
   154 		for ( featureIndex in t.options.features ) {
   154 		for ( featureIndex in t.options.features ) {
   155 			feature = t.options.features[featureIndex];
   155 			feature = t.options.features[featureIndex];
   156 			if ( t['clean' + feature] ) {
   156 			if ( t['clean' + feature] ) {
   157 				try {
   157 				try {
   158 					t['clean' + feature](t);
   158 					t['clean' + feature](t);
   244 	 * Instantiates a new media object with the next matching shortcode.
   244 	 * Instantiates a new media object with the next matching shortcode.
   245 	 *
   245 	 *
   246 	 * @since 4.2.0
   246 	 * @since 4.2.0
   247 	 *
   247 	 *
   248 	 * @param {string} data The text to apply the shortcode on.
   248 	 * @param {string} data The text to apply the shortcode on.
   249 	 * @returns {wp.media} The media object.
   249 	 * @return {wp.media} The media object.
   250 	 */
   250 	 */
   251 	edit : function( data ) {
   251 	edit : function( data ) {
   252 		var frame, shortcode = wp.shortcode.next( 'audio', data ).shortcode;
   252 		var frame, shortcode = wp.shortcode.next( 'audio', data ).shortcode;
   253 
   253 
   254 		frame = wp.media({
   254 		frame = wp.media({
   264 	 * Generates an audio shortcode.
   264 	 * Generates an audio shortcode.
   265 	 *
   265 	 *
   266 	 * @since 4.2.0
   266 	 * @since 4.2.0
   267 	 *
   267 	 *
   268 	 * @param {Array} model Array with attributes for the shortcode.
   268 	 * @param {Array} model Array with attributes for the shortcode.
   269 	 * @returns {wp.shortcode} The audio shortcode object.
   269 	 * @return {wp.shortcode} The audio shortcode object.
   270 	 */
   270 	 */
   271 	shortcode : function( model ) {
   271 	shortcode : function( model ) {
   272 		var content;
   272 		var content;
   273 
   273 
   274 		_.each( this.defaults, function( value, key ) {
   274 		_.each( this.defaults, function( value, key ) {
   319 	 * Instantiates a new media object with the next matching shortcode.
   319 	 * Instantiates a new media object with the next matching shortcode.
   320 	 *
   320 	 *
   321 	 * @since 4.2.0
   321 	 * @since 4.2.0
   322 	 *
   322 	 *
   323 	 * @param {string} data The text to apply the shortcode on.
   323 	 * @param {string} data The text to apply the shortcode on.
   324 	 * @returns {wp.media} The media object.
   324 	 * @return {wp.media} The media object.
   325 	 */
   325 	 */
   326 	edit : function( data ) {
   326 	edit : function( data ) {
   327 		var frame,
   327 		var frame,
   328 			shortcode = wp.shortcode.next( 'video', data ).shortcode,
   328 			shortcode = wp.shortcode.next( 'video', data ).shortcode,
   329 			attrs;
   329 			attrs;
   344 	 * Generates an video shortcode.
   344 	 * Generates an video shortcode.
   345 	 *
   345 	 *
   346 	 * @since 4.2.0
   346 	 * @since 4.2.0
   347 	 *
   347 	 *
   348 	 * @param {Array} model Array with attributes for the shortcode.
   348 	 * @param {Array} model Array with attributes for the shortcode.
   349 	 * @returns {wp.shortcode} The video shortcode object.
   349 	 * @return {wp.shortcode} The video shortcode object.
   350 	 */
   350 	 */
   351 	shortcode : function( model ) {
   351 	shortcode : function( model ) {
   352 		var content;
   352 		var content;
   353 
   353 
   354 		_.each( this.defaults, function( value, key ) {
   354 		_.each( this.defaults, function( value, key ) {
   889  */
   889  */
   890 MediaDetails = AttachmentDisplay.extend(/** @lends wp.media.view.MediaDetails.prototype */{
   890 MediaDetails = AttachmentDisplay.extend(/** @lends wp.media.view.MediaDetails.prototype */{
   891 	initialize: function() {
   891 	initialize: function() {
   892 		_.bindAll(this, 'success');
   892 		_.bindAll(this, 'success');
   893 		this.players = [];
   893 		this.players = [];
   894 		this.listenTo( this.controller, 'close', wp.media.mixin.unsetPlayers );
   894 		this.listenTo( this.controller.states, 'close', wp.media.mixin.unsetPlayers );
   895 		this.on( 'ready', this.setPlayer );
   895 		this.on( 'ready', this.setPlayer );
   896 		this.on( 'media:setting:remove', wp.media.mixin.unsetPlayers, this );
   896 		this.on( 'media:setting:remove', wp.media.mixin.unsetPlayers, this );
   897 		this.on( 'media:setting:remove', this.render );
   897 		this.on( 'media:setting:remove', this.render );
   898 		this.on( 'media:setting:remove', this.setPlayer );
   898 		this.on( 'media:setting:remove', this.setPlayer );
   899 
   899 
   993 
   993 
   994 		this.mejs = mejs;
   994 		this.mejs = mejs;
   995 	},
   995 	},
   996 
   996 
   997 	/**
   997 	/**
   998 	 * @returns {media.view.MediaDetails} Returns itself to allow chaining
   998 	 * @return {media.view.MediaDetails} Returns itself to allow chaining.
   999 	 */
   999 	 */
  1000 	render: function() {
  1000 	render: function() {
  1001 		AttachmentDisplay.prototype.render.apply( this, arguments );
  1001 		AttachmentDisplay.prototype.render.apply( this, arguments );
  1002 
  1002 
  1003 		setTimeout( _.bind( function() {
  1003 		setTimeout( _.bind( function() {
  1004 			this.resetFocus();
  1004 			this.scrollToTop();
  1005 		}, this ), 10 );
  1005 		}, this ), 10 );
  1006 
  1006 
  1007 		this.settings = _.defaults( {
  1007 		this.settings = _.defaults( {
  1008 			success : this.success
  1008 			success : this.success
  1009 		}, wp.media.mixin.mejsSettings );
  1009 		}, wp.media.mixin.mejsSettings );
  1010 
  1010 
  1011 		return this.setMedia();
  1011 		return this.setMedia();
  1012 	},
  1012 	},
  1013 
  1013 
  1014 	resetFocus: function() {
  1014 	scrollToTop: function() {
  1015 		this.$( '.embed-media-settings' ).scrollTop( 0 );
  1015 		this.$( '.embed-media-settings' ).scrollTop( 0 );
  1016 	}
  1016 	}
  1017 },/** @lends wp.media.view.MediaDetails */{
  1017 },/** @lends wp.media.view.MediaDetails */{
  1018 	instances : 0,
  1018 	instances : 0,
  1019 	/**
  1019 	/**
  1020 	 * When multiple players in the DOM contain the same src, things get weird.
  1020 	 * When multiple players in the DOM contain the same src, things get weird.
  1021 	 *
  1021 	 *
  1022 	 * @param {HTMLElement} elem
  1022 	 * @param {HTMLElement} elem
  1023 	 * @returns {HTMLElement}
  1023 	 * @return {HTMLElement}
  1024 	 */
  1024 	 */
  1025 	prepareSrc : function( elem ) {
  1025 	prepareSrc : function( elem ) {
  1026 		var i = MediaDetails.instances++;
  1026 		var i = MediaDetails.instances++;
  1027 		_.each( $( elem ).find( 'source' ), function( source ) {
  1027 		_.each( $( elem ).find( 'source' ), function( source ) {
  1028 			source.src = [
  1028 			source.src = [