PageSourceSearch

https://understandquran.com/wp-content/plugins/ajax-sendy-newsletter/inc/js/sendy.js?ver=1.1

js understandquran.com collected 2026-10-01 11:39:30 UTC 3,501 bytes, 113 lines download raw bytes

1( function ( $ ) {
2	$( document ).on( 'submit', '.swp-form', function ( ev ) {
3		ev.preventDefault();
4		var form = $( this );
5
6		form.find( '.swp-error, .swp-success' ).hide();
7		form.find('#swp_email').removeClass('swp-email-valid-error');
8
9		// Name check
10		var subscribe_name = form.find( '.field-name' ).val();
11		if ( subscribe_name == '' ) {
12			form.find( '.swp-email-valid-error' ).show();
13			form.find('#swp_name').addClass('swp-email-valid-error');
14			return false;
15		} else {
16			form.find('#swp_name').removeClass('swp-email-valid-error');
17		}
18
19		// Email check
20		var subscribe_email = form.find( '.field-email' ).val();
21		var filter = /^\s*[\w\-\+_]+(\.[\w\-\+_]+)*\@[\w\-\+_]+\.[\w\-\+_]+(\.[\w\-\+_]+)*\s*$/;
22		valid = String( subscribe_email ).search( filter ) != -1;
23		if ( subscribe_email == '' || !valid ) {
24			form.find( '.swp-email-valid-error' ).show();
25			form.find('#swp_email').addClass('swp-email-valid-error');
26			return false;
27		} else {
28			form.find('#swp_email').removeClass('swp-email-valid-error');
29		}
30
31		// Validation
32		var validationFailed = false;
33		form.find( '.swp-field' ).each(function(){
34			var required =  $(this).data('required');
35			var value = $.trim($(this).val());
36			var fieldname = $(this).attr('name');
37			var type = $(this).attr('type');
38			if( ( type == 'checkbox' ||  type == 'radio') &&  required == '1'){
39
40				var fieldChecked = false;
41				form.find('input[name="'+fieldname+'"]').each(function(){
42					if( $(this).is(':checked') ){
43						fieldChecked = true;
44					}
45				})
46
47				validationFailed =  ! fieldChecked ? true : validationFailed;
48				if(validationFailed ){
49					$(this).parent().css('border', '1px solid red');
50				}
51			}
52			else if( required == '1' && ! value.length ) {
53				validationFailed = true;
54			}
55		});
56		if( validationFailed ){
57			return false;
58		}
59
60		//Terms Check
61		$terms = form.find( '.swp-terms' )
62		if ( $terms.length > 0 ) {
63			if ( !$terms.prop( 'checked' ) ) {
64				alert( 'Please check checkbox' );
65				return false;
66			}
67		}
68		// remove red validation borders
69		form.find( '.swp-field' ).each(function(){
70			var required =  $(this).data('required');
71			var fieldname = $(this).attr('name');
72			var type = $(this).attr('type');
73			if( type == 'checkbox' ||  type == 'radio'){
74				$(this).parent().css('border', '0px solid green');
75			}else if(required == '1'){
76				$(this).css('border-bottom-color', '#4e842a');
77			}
78		})
79
80		form.find( '.swp-spinner' ).fadeIn();
81
82		var form_data = form.serialize();
83
84		data = {
85			'action': 'swp_form_submit',
86			'swp_name' : $('#swp_name').val(),
87			'swp_email' : $('#swp_email').val(),
88		}
89
90		$.post( ajax_object.ajax_url, data, function ( result, textStatus, xhr ) {
91			form.find( '.swp-spinner' ).fadeOut();
92			response = $.trim( result );
93			if ( response == '1' ) {
94				form.find( '.swp-error' ).hide();
95				form.find( '.swp-success' ).show();
96				form.find( '.swp-success' ).html('Successfully Subscribed.');
97				form.find('#swp_email').removeClass('swp-email-valid-error');
98				form.find( '.field-name' ).val('');
99				form.find( '.field-email' ).val('');
100			} else if ( response == 'Already subscribed.' ) {
101				form.find( '.swp-success' ).hide();
102				form.find('#swp_email').addClass('swp-email-valid-error');
103				form.find( '.swp-error' ).show();
104				form.find( '.swp-error' ).html('Already Subscribed.');
105				form.find( '.field-email' ).val('');
106			} else {
107				form.find( '.swp-error' ).show();
108				form.find( '.swp-error' ).html(response);
109			}
110		} );
111
112	} );
113} )( jQuery )

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.