|
Server IP : 10.106.20.8 / Your IP : 216.73.216.148 Web Server : Apache System : Linux webm008.cluster106.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64 User : sixiemesrc ( 611999) PHP Version : 8.0.30 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/sixiemesrc/new/wp-content/plugins/maintenance/js/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
function uploads_multimedia_init (title, btnName, editing, multiple) {
var outArray = [];
var file_frame;
if (file_frame) {
file_frame.open();
return;
}
file_frame = wp.media.editor.send.attachment = wp.media({
title: title,
button: {
text: btnName
},
editing: editing,
multiple: multiple,
});
return file_frame;
}
jQuery(document).ready(function() {
jQuery('.upload_btn').on('click', function( event ) {
event.preventDefault();
var vLinkElem = jQuery(this);
var customData = vLinkElem.data('imagetype');
var customClass = '';
var file_frame = uploads_multimedia_init('Upload Image', 'Select Image', true, false);
file_frame.on( 'select', function() {
var selection = file_frame.state().get('selection');
selection.map( function( attachment ) {
attachment = attachment.toJSON();
var image_url = attachment.url,
image_id = attachment.id;
vLinkElem.parent().find('.boxes').css('background-image', 'url(' + image_url + ')');
vLinkElem.parent().find('.boxes').append('<input class="button delete-img remove" type="submit" name="remove_bg" value="x" />');
vLinkElem.parent().parent().find('input[type="hidden"]').val(image_id);
});
});
file_frame.open();
return false;
});
jQuery('.delete-img').on('click', function( event ) {
event.preventDefault();
var vLinkElem = jQuery(this);
vLinkElem.parent().css('background-image', 'none');
vLinkElem.parent().parent().parent().find('input[type="hidden"]').val('');
vLinkElem.remove();
return false;
});
});