PageSourceSearch

https://www.dachshundclubofamerica.org/wp-content/plugins/sendpress/js/sendpress.signup.js?ver=1.26.1.20

js dachshundclubofamerica.org collected 2026-09-25 02:35:09 UTC 5,875 bytes, 175 lines download raw bytes

1;(function ( $, window, document, undefined ) {
2
3
4    $(document).ready(function($) {
5    	var $signups = $('.sendpress-signup');
6        
7        $signups.each(function(){
8            $form = $(this),
9            $error = $form.find('#error'),
10            $thanks = $form.find('#thanks'),
11            $exists = $form.find('#exists');
12
13            //$error.hide();
14            //$thanks.hide();
15        });
16
17    	$signups.submit(function(e){
18            e.preventDefault();
19
20            var signup = {},
21                $form = $(this),
22                $error = $form.find('#error'),
23                $thanks = $form.find('#thanks'),
24                $formwrap = $form.find('#form-wrap'),
25                $submit = $form.find('#submit'),
26                $ajaxInd = $form.find('.ajaxloader'),
27                submit_ok = true,
28                emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
29             
30            $error.hide();
31            $ajaxInd.show();
32
33            signup['first'] = $form.find('.sp_firstname').val();
34            signup['last'] = $form.find('.sp_lastname').val();
35            signup['email'] = $form.find('.sp_email').val();
36            signup['phonenumber'] = $form.find('.sp_phonenumber').val();
37            signup['salutation'] = $form.find('.sp_salutation').val();
38            signup['listid'] = "";//$form.find('.sp_list').val();
39            signup['formid'] = $form.data('form-id');
40            signup['sp_contact_me_by_fax_only'] = $form.find('.sp_contact_me_by_fax_only:checked').val();
41            $form.find("input:checkbox.sp_list:checked").each(function(){
42                signup['listid'] += $(this).val() +",";
43            });
44            if(signup['listid'] === ""){
45                signup['listid'] = $form.find('.sp_list').val();
46            }
47
48            $form.find('.sp_custom_field').each(function(){
49                var $obj = $(this);
50                signup[$obj.attr('id')] = $obj.val();
51            });
52
53            //adding this back in for post notifications
54            $form.find('.custom-field').each(function(){
55                var $obj = $(this);
56                signup[$obj.attr('id')] = $obj.val();
57            });
58
59            signup['action'] = 'sendpress_subscribe_to_list';
60
61            if( signup.email.length === 0 ){
62                $error.show();
63                $error.html('<div class="item">*'+sendpress.missingemail+'.</div>');
64                submit_ok = false;
65            }else if(!emailReg.test(signup.email)) {
66                $error.show();
67                $error.html('<div class="item">'+sendpress.invalidemail+'.</div>');
68                submit_ok = false;
69            }
70
71            $.each($form.find('.required'), function(index, value){
72                if($(value).val().length === 0 && submit_ok){
73                    $error.show();
74                    $error.html('<div class="item">'+sendpress.required+'</div>');
75                    submit_ok = false;
76                }
77            });
78
79            $form.find("input:checkbox#signup_approval").each(function(){
80                var $obj = $(this);
81
82                if($obj.is(':checked')){
83                    signup['signup_approval'] = "yes";
84                }else{
85                    $error.show();
86                    $error.html('<div class="item">'+sendpress.required+'</div>');
87                    submit_ok = false;
88                }
89
90                
91            });
92
93            if(submit_ok){
94                $submit.attr("disabled", "disabled");
95
96                // Add nonce for CSRF protection
97                signup['spnonce'] = sendpress.nonce;
98
99                jQuery.post(sendpress.ajaxurl, signup, function(response){
100                
101                    try {
102                        response = JSON.parse(response);
103                    } catch (err) {
104                        // Invalid JSON.
105                        $submit.removeAttr("disabled");
106                        if(!jQuery.trim(response).length) {
107                            response = { error: 'Server returned empty response during add attempt'};
108                        } else {
109                            response = {error: 'Server returned invali
109d response:<br /><br />' + response};
110                        }
111                    }
112
113                   if(response.success){
114                        $error.hide();
115                        $formwrap.hide();
116                        if(response.exists){
117                            $exists.show();
118                        }else{
119                            $thanks.show();
120                        }
121                        
122                    }else{
123                        //possibly display an error here
124                        
125                    }
126                });
127
128            }else{
129                $ajaxInd.hide();
130            }
131
132            return false;
133            
134        });
135        /*
136    	$('.sendpress-signup input').bind('focus blur',function(e){
137    		var $obj = $(this),
138    			$value = $obj.val(),
139    			$orig = $obj.attr('orig');
140
141    		if(e.type === "focus"){
142    			if($value === $orig){
143    				$obj.val('');
144    			}
145    		}else{
146    			if($value === ''){
147    				$obj.val($orig);
148    			}
149    		}
150
151    	});
152        */
153        $('.sendpress-signup .post-notifications-list').on('click', function(e){
154            var $obj = $(this),
155                $form = $obj.closest('form.sendpress-signup'),
156                type = $obj.data('type'),
157                hidden = "<input class='post-notifications custom-field' type='hidden' value='"+type+"' name='post_notifications' id='post_notifications'/>";
158
159            if($obj.is(':checked')){
160                $form.append(hidden);
161            }else{
162                $form.find('.post-notifications').remove();
163            }
164        });
165
166    });
167
168}).call( window.sendpress=window.sendpress || {}, jQuery, window, document );
169
170
171
172
173
174
175

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.