mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-19 09:05:22 +01:00
1f707de9dd
JSDoc takes it structural data from `@namespace`, `@lends` and `@memberOf`. This change fixes these tags for all JavaScript files in the wp-admin folder. * Add jsdoc configuration to parse wp-admin/js files. Use `jsdoc -c jsdoc.conf.json` to generate JSDoc. * Define all used namespaces using `@namespace`. * Define each usage of the extend function as a prototype assignment using `@lends`. * Add `@alias` if JSDoc cannot detect the correct name automatically. This has previously been corrected for all `wp-includes` JavaScript files: [41351]. Props herregroen. Fixes #42485. Built from https://develop.svn.wordpress.org/trunk@42403 git-svn-id: http://core.svn.wordpress.org/trunk@42232 1a063a9b-81f0-0310-95a4-ce76da25c4cd
70 lines
1.5 KiB
JavaScript
70 lines
1.5 KiB
JavaScript
/* global _wpmejsSettings */
|
|
(function( window, $ ) {
|
|
|
|
window.wp = window.wp || {};
|
|
|
|
function wpMediaElement() {
|
|
var settings = {};
|
|
|
|
/**
|
|
* Initialize media elements.
|
|
*
|
|
* Ensures media elements that have already been initialized won't be
|
|
* processed again.
|
|
*
|
|
* @memberOf wp.mediaelement
|
|
*
|
|
* @since 4.4.0
|
|
*
|
|
* @returns {void}
|
|
*/
|
|
function initialize() {
|
|
if ( typeof _wpmejsSettings !== 'undefined' ) {
|
|
settings = $.extend( true, {}, _wpmejsSettings );
|
|
}
|
|
settings.classPrefix = 'mejs-';
|
|
settings.success = settings.success || function ( mejs ) {
|
|
var autoplay, loop;
|
|
|
|
if ( mejs.rendererName && -1 !== mejs.rendererName.indexOf( 'flash' ) ) {
|
|
autoplay = mejs.attributes.autoplay && 'false' !== mejs.attributes.autoplay;
|
|
loop = mejs.attributes.loop && 'false' !== mejs.attributes.loop;
|
|
|
|
if ( autoplay ) {
|
|
mejs.addEventListener( 'canplay', function() {
|
|
mejs.play();
|
|
}, false );
|
|
}
|
|
|
|
if ( loop ) {
|
|
mejs.addEventListener( 'ended', function() {
|
|
mejs.play();
|
|
}, false );
|
|
}
|
|
}
|
|
};
|
|
|
|
// Only initialize new media elements.
|
|
$( '.wp-audio-shortcode, .wp-video-shortcode' )
|
|
.not( '.mejs-container' )
|
|
.filter(function () {
|
|
return ! $( this ).parent().hasClass( 'mejs-mediaelement' );
|
|
})
|
|
.mediaelementplayer( settings );
|
|
}
|
|
|
|
return {
|
|
initialize: initialize
|
|
};
|
|
}
|
|
|
|
/**
|
|
* @namespace wp.mediaelement
|
|
* @memberOf wp
|
|
*/
|
|
window.wp.mediaelement = new wpMediaElement();
|
|
|
|
$( window.wp.mediaelement.initialize );
|
|
|
|
})( window, jQuery );
|