diff options
author | luxagraf <sng@luxagraf.net> | 2023-07-28 13:43:36 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2023-07-28 13:43:36 -0500 |
commit | a30c790edea652494e7481f6798047a3bc1fd4ea (patch) | |
tree | b0936860abd6767716f56c68e305d8f5e0e38bd4 /bak/oldluxpages/house-demo/www.bumfuzzle.com/wp-content/plugins/x-email-mailchimp/email-integration/js | |
parent | 9a620cf42bf1fe6977e378bd834b41ff4a593dde (diff) |
added a backup of old pages that are no longer live
Diffstat (limited to 'bak/oldluxpages/house-demo/www.bumfuzzle.com/wp-content/plugins/x-email-mailchimp/email-integration/js')
-rw-r--r-- | bak/oldluxpages/house-demo/www.bumfuzzle.com/wp-content/plugins/x-email-mailchimp/email-integration/js/site/main.js | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/bak/oldluxpages/house-demo/www.bumfuzzle.com/wp-content/plugins/x-email-mailchimp/email-integration/js/site/main.js b/bak/oldluxpages/house-demo/www.bumfuzzle.com/wp-content/plugins/x-email-mailchimp/email-integration/js/site/main.js new file mode 100644 index 0000000..9bf74c3 --- /dev/null +++ b/bak/oldluxpages/house-demo/www.bumfuzzle.com/wp-content/plugins/x-email-mailchimp/email-integration/js/site/main.js @@ -0,0 +1,99 @@ +// ============================================================================= +// JS/SITE/MAIN.JS +// ----------------------------------------------------------------------------- +// Plugin site scripts. +// ============================================================================= + +// ============================================================================= +// TABLE OF CONTENTS +// ----------------------------------------------------------------------------- +// 01. Handle Form Submissions +// ============================================================================= + +// Handle Form Submissions +// ============================================================================= + +jQuery(document).ready(function($) { + + function confirm_subscription( form ) { + + var confirm_type = form.data('x-email-confirm'); + + if ( confirm_type === 'Message' ) { + make_alert( form.data('x-email-message'), 'x-alert-success' ).appendTo(form); + } + + if ( confirm_type === 'Redirect' ) { + window.location.href = form.data('x-email-redirect'); + } + + } + + function make_alert( content, class_name ) { + + return $('<div class="x-subscribe-form-alert-wrap">' + + '<div class="x-alert ' + ( class_name || 'x-alert-danger' ) + ' fade in man">' + + '<button type="button" class="close" data-dismiss="alert">×</button>' + + content + + '</div>' + + '</div>').alert(); + + } + + $('.x-subscribe-form').submit(function(e) { + + // + // Prevent default behavior. + // + + e.preventDefault(); + + + // + // Make note of our form. + // + + $form = $(this); + + + // + // Prevent extra submissions. + // + + $form.find('input[type="submit"]').prop('disabled', true).addClass('btn-muted'); + + + // + // Craft data for AJAX request. + // + + postdata = { + action : 'x_subscribe', + data : { + form_id : $(this).find('input[name="x_subscribe_form[id]"]').val() || '', + first_name : $(this).find('input[name="x_subscribe_form[first-name]"]').val() || '', + last_name : $(this).find('input[name="x_subscribe_form[last-name]"]').val() || '', + full_name : $(this).find('input[name="x_subscribe_form[full-name]"]').val() || '', + email_address : $(this).find('input[name="x_subscribe_form[email]"]').val() || '', + } + }; + + + // + // Submit form. + // + + $.post(x_email_forms.ajaxurl, postdata, function(response) { + data = $.parseJSON(response); + if ( data.error ) { + console.log(data.log_message); + make_alert(data.message).appendTo($form); + } else { + console.log('subscribed'); + confirm_subscription($form); + } + }); + + }); + +});
\ No newline at end of file |