| Server IP : 172.67.159.97 / Your IP : 216.73.217.154 Web Server : nginx/1.24.0 System : Linux wordpress-sites 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/rebeccaone.com/wp-content/plugins/envira-gallery/assets/js/ |
Upload File : |
/*jshint unused: false, node: true */
/**
* Handles retrieving and outputting images for the Gallery Preview metabox
*
* @since 1.5.0
*/ (function ($) {
$(function () {
// Setup vars
var envira_preview_updating = false;
// Show or hide the Preview metabox, depending on the Gallery Type
if ($('input[name="_envira_gallery[type]"]:checked').val() === 'default') {
$('#envira-gallery-preview').hide();
} else {
$('#envira-gallery-preview').show();
}
// Show or hide the Preview metabox, when the Gallery Type is changed, or the enviraGalleryPreview
// action is fired.
$(document).on('enviraGalleryType enviraGalleryPreview', function () {
// Setup some vars
var envira_gallery_type = $('input[name="_envira_gallery[type]"]:checked').val(),
envira_spinner = $('#envira-gallery-preview .spinner'),
envira_gallery_preview = $('#envira-gallery-preview-main');
// If the gallery type is default, hide the preview and return.
if (envira_gallery_type === 'default') {
$(envira_gallery_preview).hide();
return;
}
// If the preview is still updating from a previous AJAX call, don't do anything else.
if (envira_preview_updating) {
return;
}
// Update the flag to indicate we're running an AJAX request.
envira_preview_updating = true;
// Remove the content from the preview
$(envira_gallery_preview).html('');
// Make an AJAX call to get the content for the tab
$.ajax({
type: 'post',
url: envira_gallery_metabox.ajax,
dataType: 'json',
data: {
action: 'envira_gallery_change_preview',
post_id: envira_gallery_metabox.id,
type: envira_gallery_type,
data: $('form#post').serializeArray(),
nonce: envira_gallery_metabox.preview_nonce
},
success: function (response) {
// Inject the response into the preview area
$(envira_gallery_preview).html(response);
// Hide the spinner
$(envira_spinner).hide();
// We've finished updating the preview.
envira_preview_updating = false;
},
error: function (textStatus, errorThrown) {
// Inject the error message into the tab settings area
$(envira_gallery_preview).html(
'<div class="error"><p>' + textStatus.responseText + '</p></div>'
);
// Hide the spinner
$(envira_spinner).hide();
// We've finished updating the preview.
envira_preview_updating = false;
}
});
});
});
})(jQuery);