| 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 : /home/x9dppmxs4rgd/www/wp-content/themes/grace-church/fw/js/core.messages/ |
Upload File : |
// Popup messages
//-----------------------------------------------------------------
jQuery(document).ready(function(){
"use strict";
GRACE_CHURCH_GLOBALS['message_callback'] = null;
GRACE_CHURCH_GLOBALS['message_timeout'] = 5000;
jQuery('body').on('click', '#grace_church_modal_bg,.grace_church_message .grace_church_message_close', function (e) {
"use strict";
grace_church_message_destroy();
if (GRACE_CHURCH_GLOBALS['message_callback']) {
GRACE_CHURCH_GLOBALS['message_callback'](0);
GRACE_CHURCH_GLOBALS['message_callback'] = null;
}
e.preventDefault();
return false;
});
});
// Warning
function grace_church_message_warning(msg) {
"use strict";
var hdr = arguments[1] ? arguments[1] : '';
var icon = arguments[2] ? arguments[2] : 'cancel';
var delay = arguments[3] ? arguments[3] : GRACE_CHURCH_GLOBALS['message_timeout'];
return grace_church_message({
msg: msg,
hdr: hdr,
icon: icon,
type: 'warning',
delay: delay,
buttons: [],
callback: null
});
}
// Success
function grace_church_message_success(msg) {
"use strict";
var hdr = arguments[1] ? arguments[1] : '';
var icon = arguments[2] ? arguments[2] : 'check';
var delay = arguments[3] ? arguments[3] : GRACE_CHURCH_GLOBALS['message_timeout'];
return grace_church_message({
msg: msg,
hdr: hdr,
icon: icon,
type: 'success',
delay: delay,
buttons: [],
callback: null
});
}
// Info
function grace_church_message_info(msg) {
"use strict";
var hdr = arguments[1] ? arguments[1] : '';
var icon = arguments[2] ? arguments[2] : 'info';
var delay = arguments[3] ? arguments[3] : GRACE_CHURCH_GLOBALS['message_timeout'];
return grace_church_message({
msg: msg,
hdr: hdr,
icon: icon,
type: 'info',
delay: delay,
buttons: [],
callback: null
});
}
// Regular
function grace_church_message_regular(msg) {
"use strict";
var hdr = arguments[1] ? arguments[1] : '';
var icon = arguments[2] ? arguments[2] : 'quote';
var delay = arguments[3] ? arguments[3] : GRACE_CHURCH_GLOBALS['message_timeout'];
return grace_church_message({
msg: msg,
hdr: hdr,
icon: icon,
type: 'regular',
delay: delay,
buttons: [],
callback: null
});
}
// Confirm dialog
function grace_church_message_confirm(msg) {
"use strict";
var hdr = arguments[1] ? arguments[1] : '';
var callback = arguments[2] ? arguments[2] : null;
return grace_church_message({
msg: msg,
hdr: hdr,
icon: 'help',
type: 'regular',
delay: 0,
buttons: ['Yes', 'No'],
callback: callback
});
}
// Modal dialog
function grace_church_message_dialog(content) {
"use strict";
var hdr = arguments[1] ? arguments[1] : '';
var init = arguments[2] ? arguments[2] : null;
var callback = arguments[3] ? arguments[3] : null;
return grace_church_message({
msg: content,
hdr: hdr,
icon: '',
type: 'regular',
delay: 0,
buttons: ['Apply', 'Cancel'],
init: init,
callback: callback
});
}
// General message window
function grace_church_message(opt) {
"use strict";
var msg = opt.msg != undefined ? opt.msg : '';
var hdr = opt.hdr != undefined ? opt.hdr : '';
var icon = opt.icon != undefined ? opt.icon : '';
var type = opt.type != undefined ? opt.type : 'regular';
var delay = opt.delay != undefined ? opt.delay : GRACE_CHURCH_GLOBALS['message_timeout'];
var buttons = opt.buttons != undefined ? opt.buttons : [];
var init = opt.init != undefined ? opt.init : null;
var callback = opt.callback != undefined ? opt.callback : null;
// Modal bg
jQuery('#grace_church_modal_bg').remove();
jQuery('body').append('<div id="grace_church_modal_bg"></div>');
jQuery('#grace_church_modal_bg').fadeIn();
// Popup window
jQuery('.grace_church_message').remove();
var html = '<div class="grace_church_message grace_church_message_' + type + (buttons.length > 0 ? ' grace_church_message_dialog' : '') + '">'
+ '<span class="grace_church_message_close iconadmin-cancel icon-cancel"></span>'
+ (icon ? '<span class="grace_church_message_icon iconadmin-'+icon+' icon-'+icon+'"></span>' : '')
+ (hdr ? '<h2 class="grace_church_message_header">'+hdr+'</h2>' : '');
html += '<div class="grace_church_message_body">' + msg + '</div>';
if (buttons.length > 0) {
html += '<div class="grace_church_message_buttons">';
for (var i=0; i<buttons.length; i++) {
html += '<span class="grace_church_message_button">'+buttons[i]+'</span>';
}
html += '</div>';
}
html += '</div>';
// Add popup to body
jQuery('body').append(html);
var popup = jQuery('body .grace_church_message').eq(0);
// Prepare callback on buttons click
if (callback != null) {
GRACE_CHURCH_GLOBALS['message_callback'] = callback;
jQuery('.grace_church_message_button').click(function(e) {
"use strict";
var btn = jQuery(this).index();
callback(btn+1, popup);
GRACE_CHURCH_GLOBALS['message_callback'] = null;
grace_church_message_destroy();
});
}
// Call init function
if (init != null) init(popup);
// Show (animate) popup
var top = jQuery(window).scrollTop();
jQuery('body .grace_church_message').animate({top: top+Math.round((jQuery(window).height()-jQuery('.grace_church_message').height())/2), opacity: 1}, {complete: function () {
// Call init function
//if (init != null) init(popup);
}});
// Delayed destroy (if need)
if (delay > 0) {
setTimeout(function() { grace_church_message_destroy(); }, delay);
}
return popup;
}
// Destroy message window
function grace_church_message_destroy() {
"use strict";
var top = jQuery(window).scrollTop();
jQuery('#grace_church_modal_bg').fadeOut();
jQuery('.grace_church_message').animate({top: top-jQuery('.grace_church_message').height(), opacity: 0});
setTimeout(function() { jQuery('#grace_church_modal_bg').remove(); jQuery('.grace_church_message').remove(); }, 500);
}