Edit File by line
/home/barbar84/public_h.../wp-inclu.../js/mediaele...
File: wp-mediaelement.js
/* global _wpmejsSettings, mejsL10n */
[0] Fix | Delete
(function( window, $ ) {
[1] Fix | Delete
[2] Fix | Delete
window.wp = window.wp || {};
[3] Fix | Delete
[4] Fix | Delete
function wpMediaElement() {
[5] Fix | Delete
var settings = {};
[6] Fix | Delete
[7] Fix | Delete
/**
[8] Fix | Delete
* Initialize media elements.
[9] Fix | Delete
*
[10] Fix | Delete
* Ensures media elements that have already been initialized won't be
[11] Fix | Delete
* processed again.
[12] Fix | Delete
*
[13] Fix | Delete
* @memberOf wp.mediaelement
[14] Fix | Delete
*
[15] Fix | Delete
* @since 4.4.0
[16] Fix | Delete
*
[17] Fix | Delete
* @return {void}
[18] Fix | Delete
*/
[19] Fix | Delete
function initialize() {
[20] Fix | Delete
if ( typeof _wpmejsSettings !== 'undefined' ) {
[21] Fix | Delete
settings = $.extend( true, {}, _wpmejsSettings );
[22] Fix | Delete
}
[23] Fix | Delete
settings.classPrefix = 'mejs-';
[24] Fix | Delete
settings.success = settings.success || function ( mejs ) {
[25] Fix | Delete
var autoplay, loop;
[26] Fix | Delete
[27] Fix | Delete
if ( mejs.rendererName && -1 !== mejs.rendererName.indexOf( 'flash' ) ) {
[28] Fix | Delete
autoplay = mejs.attributes.autoplay && 'false' !== mejs.attributes.autoplay;
[29] Fix | Delete
loop = mejs.attributes.loop && 'false' !== mejs.attributes.loop;
[30] Fix | Delete
[31] Fix | Delete
if ( autoplay ) {
[32] Fix | Delete
mejs.addEventListener( 'canplay', function() {
[33] Fix | Delete
mejs.play();
[34] Fix | Delete
}, false );
[35] Fix | Delete
}
[36] Fix | Delete
[37] Fix | Delete
if ( loop ) {
[38] Fix | Delete
mejs.addEventListener( 'ended', function() {
[39] Fix | Delete
mejs.play();
[40] Fix | Delete
}, false );
[41] Fix | Delete
}
[42] Fix | Delete
}
[43] Fix | Delete
};
[44] Fix | Delete
[45] Fix | Delete
/**
[46] Fix | Delete
* Custom error handler.
[47] Fix | Delete
*
[48] Fix | Delete
* Sets up a custom error handler in case a video render fails, and provides a download
[49] Fix | Delete
* link as the fallback.
[50] Fix | Delete
*
[51] Fix | Delete
* @since 4.9.3
[52] Fix | Delete
*
[53] Fix | Delete
* @param {object} media The wrapper that mimics all the native events/properties/methods for all renderers.
[54] Fix | Delete
* @param {object} node The original HTML video, audio, or iframe tag where the media was loaded.
[55] Fix | Delete
* @return {string}
[56] Fix | Delete
*/
[57] Fix | Delete
settings.customError = function ( media, node ) {
[58] Fix | Delete
// Make sure we only fall back to a download link for flash files.
[59] Fix | Delete
if ( -1 !== media.rendererName.indexOf( 'flash' ) || -1 !== media.rendererName.indexOf( 'flv' ) ) {
[60] Fix | Delete
return '<a href="' + node.src + '">' + mejsL10n.strings['mejs.download-file'] + '</a>';
[61] Fix | Delete
}
[62] Fix | Delete
};
[63] Fix | Delete
[64] Fix | Delete
// Only initialize new media elements.
[65] Fix | Delete
$( '.wp-audio-shortcode, .wp-video-shortcode' )
[66] Fix | Delete
.not( '.mejs-container' )
[67] Fix | Delete
.filter(function () {
[68] Fix | Delete
return ! $( this ).parent().hasClass( 'mejs-mediaelement' );
[69] Fix | Delete
})
[70] Fix | Delete
.mediaelementplayer( settings );
[71] Fix | Delete
}
[72] Fix | Delete
[73] Fix | Delete
return {
[74] Fix | Delete
initialize: initialize
[75] Fix | Delete
};
[76] Fix | Delete
}
[77] Fix | Delete
[78] Fix | Delete
/**
[79] Fix | Delete
* @namespace wp.mediaelement
[80] Fix | Delete
* @memberOf wp
[81] Fix | Delete
*/
[82] Fix | Delete
window.wp.mediaelement = new wpMediaElement();
[83] Fix | Delete
[84] Fix | Delete
$( window.wp.mediaelement.initialize );
[85] Fix | Delete
[86] Fix | Delete
})( window, jQuery );
[87] Fix | Delete
[88] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function