| Server IP : 145.239.37.162 / Your IP : 216.73.217.126 Web Server : Apache System : Linux webm003.cluster130.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64 User : verseaa ( 38250) PHP Version : 7.4.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/verseaa/www_old/wp-content/themes/betheme/muffin-options/fields/upload/ |
Upload File : |
(function($) {
/* globals jQuery, wp */
"use strict";
function mfnFieldUpload() {
$('body').on('click', '.mfn-opts-upload', function(e) {
e.preventDefault();
var activeFileUploadContext = $(this).parent();
var type = $('input', activeFileUploadContext).attr('class');
// Create the media frame
var customFileFrame = wp.media.frames.customHeader = wp.media({
title: $(this).data('choose'),
library: {
type: type
},
button: {
text: $(this).data('update')
}
});
customFileFrame.on('select', function() {
var attachment = customFileFrame.state().get("selection").first();
// Update value of the targetfield input with the attachment url
$('.mfn-opts-screenshot', activeFileUploadContext).attr('src', attachment.attributes.url);
$('input', activeFileUploadContext)
.val(attachment.attributes.url)
.trigger('change');
$('.mfn-opts-upload', activeFileUploadContext).hide();
$('.mfn-opts-screenshot', activeFileUploadContext).show();
$('.mfn-opts-upload-remove', activeFileUploadContext).show();
});
customFileFrame.open();
});
$('body').on('click', '.mfn-opts-upload-remove', function(e) {
e.preventDefault();
var activeFileUploadContext = $(this).parent();
$('input', activeFileUploadContext).val('');
$(this).prev().fadeIn('slow');
$('.mfn-opts-screenshot', activeFileUploadContext).fadeOut('slow');
$(this).fadeOut('slow');
});
}
/**
* $(document).ready
* Specify a function to execute when the DOM is fully loaded.
*/
$(function() {
mfnFieldUpload();
});
})(jQuery);