| Server IP : 68.178.247.200 / Your IP : 216.73.216.14 Web Server : Apache System : Linux p3plzcpnl489463.prod.phx3.secureserver.net 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64 User : x9dppmxs4rgd ( 8559391) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/thread-self/cwd/wp-content/themes/grace-church/fw/core/core.options/js/ |
Upload File : |
/* global jQuery:false */
jQuery(document).ready(function() {
GRACE_CHURCH_GLOBALS['media_frame'] = null;
GRACE_CHURCH_GLOBALS['media_link'] = '';
});
function grace_church_show_media_manager(el) {
"use strict";
GRACE_CHURCH_GLOBALS['media_link'] = jQuery(el);
// If the media frame already exists, reopen it.
if ( GRACE_CHURCH_GLOBALS['media_frame'] ) {
GRACE_CHURCH_GLOBALS['media_frame'].open();
return false;
}
// Create the media frame.
GRACE_CHURCH_GLOBALS['media_frame'] = wp.media({
// Set the title of the modal.
title: GRACE_CHURCH_GLOBALS['media_link'].data('choose'),
// Tell the modal to show only images.
library: {
type: 'image'
},
// Multiple choise
multiple: GRACE_CHURCH_GLOBALS['media_link'].data('multiple')===true ? 'add' : false,
// Customize the submit button.
button: {
// Set the text of the button.
text: GRACE_CHURCH_GLOBALS['media_link'].data('update'),
// Tell the button not to close the modal, since we're
// going to refresh the page when the image is selected.
close: true
}
});
// When an image is selected, run a callback.
GRACE_CHURCH_GLOBALS['media_frame'].on( 'select', function(selection) {
"use strict";
// Grab the selected attachment.
var field = jQuery("#"+GRACE_CHURCH_GLOBALS['media_link'].data('linked-field')).eq(0);
var attachment = '';
if (GRACE_CHURCH_GLOBALS['media_link'].data('multiple')===true) {
GRACE_CHURCH_GLOBALS['media_frame'].state().get('selection').map( function( att ) {
attachment += (attachment ? "\n" : "") + att.toJSON().url;
});
var val = field.val();
attachment = val + (val ? "\n" : '') + attachment;
} else {
attachment = GRACE_CHURCH_GLOBALS['media_frame'].state().get('selection').first().toJSON().url;
}
field.val(attachment);
field.trigger('change');
});
// Finally, open the modal.
GRACE_CHURCH_GLOBALS['media_frame'].open();
return false;
}