. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
| Server IP : 94.23.64.18 / Your IP :
216.73.216.185 [
Web Server : Apache System : Linux webm005.cluster107.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 : villadal ( 6036) PHP Version : 7.4.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl Domains : 2 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/villadal/www/wp-content/plugins/emme_gallery/gallery-metabox/js/ |
Upload File : |
jQuery(function($) {
var file_frame;
$(document).on('click', '#gallery-metabox a.gallery-add', function(e) {
e.preventDefault();
if (file_frame) file_frame.close();
file_frame = wp.media.frames.file_frame = wp.media({
title: $(this).data('uploader-title'),
button: {
text: $(this).data('uploader-button-text'),
},
multiple: true
});
file_frame.on('select', function() {
var listIndex = $('#gallery-metabox-list li').index($('#gallery-metabox-list li:last')),
selection = file_frame.state().get('selection');
selection.map(function(attachment, i) {
attachment = attachment.toJSON(),
index = listIndex + (i + 1);
$('#gallery-metabox-list').append('<li><input type="hidden" name="vdw_gallery_id[' + index + ']" value="' + attachment.id + '"><img class="image-preview" src="' + attachment.sizes.thumbnail.url + '"><a class="change-image button button-small" href="#" data-uploader-title="Change image" data-uploader-button-text="Change image">Change image</a><br><small><a class="remove-image" href="#">Remove image</a></small></li>');
});
});
makeSortable();
file_frame.open();
});
$(document).on('click', '#gallery-metabox a.change-image', function(e) {
e.preventDefault();
var that = $(this);
if (file_frame) file_frame.close();
file_frame = wp.media.frames.file_frame = wp.media({
title: $(this).data('uploader-title'),
button: {
text: $(this).data('uploader-button-text'),
},
multiple: false
});
file_frame.on( 'select', function() {
attachment = file_frame.state().get('selection').first().toJSON();
that.parent().find('input:hidden').attr('value', attachment.id);
that.parent().find('img.image-preview').attr('src', attachment.sizes.thumbnail.url);
});
file_frame.open();
});
function resetIndex() {
$('#gallery-metabox-list li').each(function(i) {
$(this).find('input:hidden').attr('name', 'vdw_gallery_id[' + i + ']');
});
}
function makeSortable() {
$('#gallery-metabox-list').sortable({
opacity: 0.6,
stop: function() {
resetIndex();
}
});
}
$(document).on('click', '#gallery-metabox a.remove-image', function(e) {
e.preventDefault();
$(this).parents('li').animate({ opacity: 0 }, 200, function() {
$(this).remove();
resetIndex();
});
});
makeSortable();
});
//*** Custom for view grid/list ***/
jQuery(document).ready(function(e){
jQuery(".switch input").change(function() {
if(jQuery(this).prop('checked')) {
jQuery('.form-table').removeClass('viewGrid');
jQuery('.form-table').addClass('viewList');
jQuery('.caption').show();
} else {
jQuery('.form-table').removeClass('viewList');
jQuery('.form-table').addClass('viewGrid');
jQuery('.caption').hide();
}
});
});