| Server IP : 68.178.247.200 / Your IP : 216.73.216.110 Web Server : Apache System : Linux p3plzcpnl489463.prod.phx3.secureserver.net 4.18.0-553.126.2.lve.el8.x86_64 #1 SMP Thu May 28 14:12:30 UTC 2026 x86_64 User : x9dppmxs4rgd ( 8559391) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /./proc/self/cwd/wp-content/plugins/youtube-showcase/assets/ext/emd-meta-box/js/ |
Upload File : |
jQuery( function( $ )
{
var template = $( '#tmpl-emd-mb-file-advanced' ).html();
$( 'body' ).on( 'click', '.emd-mb-file-advanced-upload', function( e )
{
e.preventDefault();
var $uploadButton = $( this ),
$fileList = $uploadButton.siblings( '.emd-mb-uploaded' ),
maxFileUploads = $fileList.data( 'max_file_uploads' ),
mimeType = $fileList.data( 'mime_type' ),
msg = maxFileUploads > 1 ? emdmbFile.maxFileUploadsPlural : emdmbFile.maxFileUploadsSingle,
frame,
frameOptions = {
className: 'media-frame emd-mb-file-frame',
multiple: true,
title: emdmbFileAdvanced.frameTitle
};
msg = msg.replace( '%d', maxFileUploads );
// Create a media frame
if ( mimeType )
{
frameOptions.library = {
type: mimeType
};
}
frame = wp.media( frameOptions );
// Open media uploader
frame.open();
// Remove all attached 'select' event
frame.off( 'select' );
// Handle selection
frame.on( 'select', function()
{
// Get selections
var selection = frame.state().get( 'selection' ).toJSON(),
uploaded = $fileList.children().length,
ids;
if ( maxFileUploads > 0 && ( uploaded + selection.length ) > maxFileUploads )
{
if ( uploaded < maxFileUploads )
selection = selection.slice( 0, maxFileUploads - uploaded );
alert( msg );
}
// Get only files that haven't been added to the list
// Also prevent duplication when send ajax request
selection = _.filter( selection, function( attachment )
{
return $fileList.children( 'li#item_' + attachment.id ).length == 0;
} );
ids = _.pluck( selection, 'id' );
if ( ids.length > 0 )
{
// Attach attachment to field and get HTML
var data = {
action: 'emd_mb_attach_file',
post_id: $( '#post_ID' ).val(),
field_id: $fileList.data( 'field_id' ),
attachment_ids: ids,
_ajax_nonce: $uploadButton.data( 'attach_file_nonce' )
};
$.post( ajaxurl, data, function( r )
{
if ( r.success )
{
$fileList
.append( _.template( template, { attachments: selection }, {
evaluate: /<#([\s\S]+?)#>/g,
interpolate: /\{\{\{([\s\S]+?)\}\}\}/g,
escape: /\{\{([^\}]+?)\}\}(?!\})/g
} ) )
.trigger( 'update.emdmbFile' );
}
}, 'json' );
}
} );
} );
} );