PageSourceSearch

https://ayop.org/js/views/view.contact.js

js ayop.org collected 2026-09-29 05:14:02 UTC 2,396 bytes, 112 lines download raw bytes

1/*
2Name: 			View - Contact
3Written by: 	Okler Themes - (http://www.okler.net)
4Version: 		4.3.1
5*/
6
7(function($) {
8
9	'use strict';
10
11	/*
12	Contact Form: Basic
13	*/
14	$('#contactForm:not([data-type=advanced])').validate({
15		submitHandler: function(form) {
16
17			var $form = $(form),
18				$messageSuccess = $('#contactSuccess'),
19				$messageError = $('#contactError'),
20				$submitButton = $(this.submitButton);
21
22			$submitButton.button('loading');
23
24			// Ajax Submit
25			$.ajax({
26				type: 'POST',
27				url: $form.attr('action'),
28				data: {
29					name: $form.find('#name').val(),
30					email: $form.find('#email').val(),
31					subject: $form.find('#subject').val(),
32					message: $form.find('#message').val()
33				},
34				dataType: 'json',
35				complete: function(data) {
36				
37					if (typeof data.responseJSON === 'object') {
38						if (data.responseJSON.response == 'success') {
39
40							$messageSuccess.removeClass('hidden');
41							$messageError.addClass('hidden');
42
43							// Reset Form
44							$form.find('.form-control')
45								.val('')
46								.blur()
47								.parent()
48								.removeClass('has-success')
49								.removeClass('has-error')
50								.find('label.error')
51								.remove();
52
53							if (($messageSuccess.offset().top - 80) < $(window).scrollTop()) {
54								$('html, body').animate({
55									scrollTop: $messageSuccess.offset().top - 80
56								}, 300);
57							}
58
59							$submitButton.button('reset');
60							
61							return;
62
63						}
64					}
65
66					$messageError.removeClass('hidden');
67					$messageSuccess.addClass('hidden');
68
69					if (($messageError.offset().top - 80) < $(window).scrollTop()) {
70						$('html, body').animate({
71							scrollTop: $messageError.offset().top - 80
72						}, 300);
73					}
74
75					$form.find('.has-success')
76						.removeClass('has-success');
77						
78					$submitButton.button('reset');
79
80				}
81			});
82		}
83	});
84
85	/*
86	Contact Form: Advanced
87	*/
88	$('#contactFormAdvanced, #contactForm[data-type=advanced]').validate({
89		onkeyup: false,
90		onclick: false,
91		onfocusout: false,
92		rules: {
93			'captcha': {
94				captcha: true
95			},
96			'checkboxes[]': {
97				required: true
98			},
99			'radios': {
100				required: true
101			}
102		},
103		errorPlacement: function(error, element) {
104			if (element.attr('type') == 'radio' || element.attr('type') == 'checkbox') {
105				error.appendTo(element.parent().parent());
106			} else {
107				error.insertAfter(element);
108			}
109		}
110	});
111
112}).apply(this, [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.