PageSourceSearch

https://nektarsmusic.com/wp-content/plugins/slide-music-core/js/lc_swp_contact_form.js?ver=6.7.9

js nektarsmusic.com collected 2026-10-02 05:10:01 UTC 3,606 bytes, 130 lines download raw bytes

1
2jQuery(document).ready(function($) {
3	'use strict';
4
5	ajaxCF($);
6	handleMCSubscription($);
7});
8
9var ajaxCF = function($) {
10	if (!$('form.swp_contactform').length) {
11		return;
12	}
13
14	$("form.swp_contactform").submit(function(event) {
15		event.preventDefault();
16
17		$("form.swp_contactform").find(".form_result_error").val('');
18		$("form.swp_contactform").find(".form_result_error").hide();
19		
20		var name = $.trim($(this).find("input#contactName").val());
21		var email = $.trim($(this).find("input#contactemail").val());
22		var message = $.trim($(this).find("textarea#commentsText").val());
23		var required_is_empty = false;
24
25		if ('' == name) {
26			required_is_empty = true;
27			$(this).find('.comment-form-author').find('.swp_cf_error').show('slow');
28		}
29
30		if ('' == email) {
31			required_is_empty = true;
32			$(this).find('.comment-form-email').find('.swp_cf_error').show('slow');
33		}
34
35		if ('' == message) {
36			required_is_empty = true;
37			$(this).find('.comment-form-comment').find('.swp_cf_error').show('slow');
38		}
39
40		if (required_is_empty) {
41			return;
42		}
43
44		var data = {
45			action: 'swpcontactform_action',
46			data: $(this).find(":input").serialize()
47		};
48
49		var $button = $(this).find(".lc_button.contact_button");
50		var old_button_val = $button.val();
51		$button.val($button.data('loadingmsg'));
52
53		$.post(DATAVALUES.ajaxurl, data, function(response) {
54			var obj;
55			
56			try {
57				obj = $.parseJSON(response);
58			}
59			catch(e) {
60				$button.val(old_button_val);
61				$("form.swp_contactform").find(".form_result_error").append(obj.error);
62				$("form.swp_contactform").find(".form_result_error").show('slow');
63				return;
64			}
65
66			if(obj.success === true) {
67				$("form.swp_contactform").find(".formResultOK").find(".swp_cf_error").show("slow");
68
69				$("form.swp_contactform").find("input#contactName").val('');
70				$("form.swp_contactform").find("input#contactemail").val('');
71				$("form.swp_contactform").find("textarea#commentsText").val('');
72			} else {
73
74				if (obj.error === 'wp_mail_failed') {
75					$("form.swp_contactform").find(".wp_mail_error").find(".swp_cf_error").show("slow");
76				} else {
77					$("form.swp_contactform").find(".form_result_error").append(obj.error);
78					$("form.swp_contactform").find(".form_result_error").show('slow');
79				}
80			}
81			$button.val(old_button_val);
82		});		
83
84	});
85}
86
87function handleMCSubscription($) {
88	$('.swp_mc_subscr_container').each(function(){
89		var $container = $(this);
90		var $button = $(this).find('.at_news_button_entry');
91
92		$(this).find('form.swp_mc_subscr_form').submit(function(event) {
93			event.preventDefault();
94			$button.val($button.data('loadingmsg'));
95			$container.find('.swp_mc_form_error').empty();
96			$container.find('.swp_mc_form_error').hide();
97
98			var data = {
99				action: 'swpmcform_action',
100				data: $(this).find(":input").serialize()
101			};
102
103			$.post(DATAVALUES.ajaxurl, data, function(response) {
104				var obj;
105				
106				try {
107					obj = $.parseJSON(response);
108				}
109				catch(e) {
110					$container.find('.swp_mc_form_error').append(DATAVALUES.generalErrorText);
111					$button.val($button.data('btnval'));
112					return;
113				}
114
115				if(obj.success === true) {
116					$container.find('.swp_mc_form_success').show('slow');
117					$container.find('input').each(function(){
118						$(this).val('');
119					})
120				} else {
121					$container.find('.swp_mc_form_error').append(obj.error);
122					$container.find('.swp_mc_form_error').show('slow');
123					
124				}
125				$button.val($button.data('btnval'));
126			});			
127
128		});
129	});
130}

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.