PageSourceSearch

https://hannajsmith.com/wp-content/plugins/wp-subscribe-form/includes/js/sfba-form-ajax.js?ver=6.9

js hannajsmith.com collected 2026-10-08 09:45:55 UTC 4,004 bytes, 107 lines download raw bytes

1jQuery(document).ready( function($) {
2	/*Play button animation with duration */
3	$( '.sfba-main-form-container' ).on(
4		"animationend MSAnimationEnd webkitAnimationEnd oAnimationEnd",
5		function() {
6			$( this ).removeClass( 'animation-start' );
7		}
8	);
9	var set_animation = setInterval( function() {
10		$( '.sfba-main-form-container' ).addClass( 'animation-start' );
11	}, 3500 );
12	
13	$( ".sfba_subscribe_form" ).on('submit', function() {
14		var form_id 		= jQuery(this).attr('id');
15		var sfba_page_link	= jQuery( '#' + form_id + ' .sfba_page_link' ).val();
16		var post_id 		= jQuery( '#' + form_id + ' .sfba_post_type_id' ).val();
17		var name 			= jQuery( '#' + form_id + ' .sfba-form-name' ).val();
18  		var email 			= jQuery( '#' + form_id + ' .sfba-form-email' ).val();
19  		if(name == null){
20  			data = {
21				action : 'sfba_ajax', 'subscriberemail':email,'post_id':post_id,'sfba_page_link':sfba_page_link,"wpnonce":the_ajax_script.ajax_nonce
22			};
23		}else{
24			data = {
25				action : 'sfba_ajax', 'subscribername':name,'subscriberemail':email,'post_id':post_id,'sfba_page_link':sfba_page_link,"wpnonce":the_ajax_script.ajax_nonce
26				
27			};
28		}
29		$.post(the_ajax_script.ajaxurl , data , function (response){		
30			$( '#' + form_id + ' .sfba_thanks_container' ).css({
31				"opacity":"0",
32				"display":"flex",
33			}).show().animate({opacity:1})
34			clearInterval( set_animation );
35		});
36		return false;	
37	});
38	
39	jQuery( document ).on('click', ".sfba_delete_entry",  function(){
40		var deleterowid = $( this ).attr( "data-delete" );
41		var wpappp_confirm_delete = window.confirm("Are you sure you want to delete Record with ID# "+deleterowid);
42		var wpapp_redirect_refresh = window.location.href;
43		if (wpappp_confirm_delete == true) {
44			jQuery.ajax({
45				type: 'POST',
46				url: the_ajax_script.ajaxurl,
47				data: {"action": "sfba_delete_db_record","id":deleterowid, "wpnonce": the_ajax_script.ajax_nonce},
48				success: function(data){
49					location.href = wpapp_redirect_refresh;
50				},
51				error: function(XMLHttpRequest, textStatus, errorThrown) { 
52					alert("Status: " + textStatus); alert("Error: " + errorThrown); 
53				} 
54			});
55		} 
56		// Prevents default submission of the form after clicking on the submit button. 
57		return false;   
58	});
59	
60	jQuery( document ).on('click', "#sfba_delete_all_data",  function(){
61		var wpappp_confirm_delete = window.confirm("Are you sure you want to delete all subscribers from the database?");
62		var wpapp_redirect_refresh = window.location.href;
63		if (wpappp_confirm_delete == true) {
64			jQuery.ajax({
65				type: 'POST',
66				url: the_ajax_script.ajaxurl,
67				data: {"action": "sfba_delete_db_data", "wpnonce":the_ajax_script.ajax_nonce},
68				success: function(data){
69					location.href = wpapp_redirect_refresh;
70				},
71				error: function(XMLHttpRequest, textStatus, errorThrown) { 
72					alert("Status: " + textStatus); alert("Error: " + errorThrown); 
73				} 
74			});
75		} 
76		// Prevents default submission of the form after clicking on the submit button. 
77		return false;   
78	});
79
80	$('.sfba-form-submit-button').on( 'click', function (event){
81		var form_id = jQuery(this).data('form-id');		
82		if ( typeof $('#' + form_id + ' input[type=checkbox]').prop("checked") !== 'undefined' &&   $('#' + form_id + ' input[type=checkbox]').prop("checked") !== true){
83			$('#' + form_id + ' .sfba-conset-field-error').show();			 
84			event.preventDefault();
85			return false;
86		} else {
87			$('#' + form_id + ' .sfba-conset-field-error').hide();
88		}
89		
90		if ( $( 'form#' + form_id + ' .sfba-form-email' ).val() == '' ){
91			$( 'form#' + form_id + ' .sfba-email-field-error' ).show();
92			event.preventDefault();
93		} else {
94			$( 'form#' + form_id + ' .sfba-email-field-error' ).hide();
95		}
96	});
97	$( 'a.sfba-form-close' ).on( 'click', function( event ){		
98		$('#' + $(this).data('form-id') ).slideToggle();
99	});
100	
101	$("#sfba_subscription_selection_dd").select2({
102        closeOnSelect : false,
103        placeholder : "Integrations list",
104        allowHtml: false,
105        tags: false
106    });
107});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.