Skip to content

Commit db2817c

Browse files
authored
Add files via upload
1 parent 18f3dc9 commit db2817c

14 files changed

+6491
-0
lines changed

Diff for: contact.js

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
$(document).ready(function(){
2+
3+
(function($) {
4+
"use strict";
5+
6+
7+
jQuery.validator.addMethod('answercheck', function (value, element) {
8+
return this.optional(element) || /^\bcat\b$/.test(value)
9+
}, "type the correct answer -_-");
10+
11+
// validate contactForm form
12+
$(function() {
13+
$('#contactForm').validate({
14+
rules: {
15+
name: {
16+
required: true,
17+
minlength: 2
18+
},
19+
subject: {
20+
required: true,
21+
minlength: 4
22+
},
23+
number: {
24+
required: true,
25+
minlength: 5
26+
},
27+
email: {
28+
required: true,
29+
email: true
30+
},
31+
message: {
32+
required: true,
33+
minlength: 20
34+
}
35+
},
36+
messages: {
37+
name: {
38+
required: "come on, you have a name, don't you?",
39+
minlength: "your name must consist of at least 2 characters"
40+
},
41+
subject: {
42+
required: "come on, you have a subject, don't you?",
43+
minlength: "your subject must consist of at least 4 characters"
44+
},
45+
number: {
46+
required: "come on, you have a number, don't you?",
47+
minlength: "your Number must consist of at least 5 characters"
48+
},
49+
email: {
50+
required: "no email, no message"
51+
},
52+
message: {
53+
required: "um...yea, you have to write something to send this form.",
54+
minlength: "thats all? really?"
55+
}
56+
},
57+
submitHandler: function(form) {
58+
$(form).ajaxSubmit({
59+
type:"POST",
60+
data: $(form).serialize(),
61+
url:"contact_process.php",
62+
success: function() {
63+
$('#contactForm :input').attr('disabled', 'disabled');
64+
$('#contactForm').fadeTo( "slow", 1, function() {
65+
$(this).find(':input').attr('disabled', 'disabled');
66+
$(this).find('label').css('cursor','default');
67+
$('#success').fadeIn()
68+
$('.modal').modal('hide');
69+
$('#success').modal('show');
70+
})
71+
},
72+
error: function() {
73+
$('#contactForm').fadeTo( "slow", 1, function() {
74+
$('#error').fadeIn()
75+
$('.modal').modal('hide');
76+
$('#error').modal('show');
77+
})
78+
}
79+
})
80+
}
81+
})
82+
})
83+
84+
})(jQuery)
85+
})

Diff for: gmaps.min.js

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: jquery-1.12.1.min.js

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: jquery.ajaxchimp.min.js

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
(function ($) {
2+
'use strict';
3+
4+
$.ajaxChimp = {
5+
responses: {
6+
'We have sent you a confirmation email' : 0,
7+
'Please enter a valid email' : 1,
8+
'An email address must contain a single @' : 2,
9+
'The domain portion of the email address is invalid (the portion after the @: )' : 3,
10+
'The username portion of the email address is invalid (the portion before the @: )' : 4,
11+
'This email address looks fake or invalid. Please enter a real email address' : 5
12+
},
13+
translations: {
14+
'en': null
15+
},
16+
init: function (selector, options) {
17+
$(selector).ajaxChimp(options);
18+
}
19+
};
20+
21+
$.fn.ajaxChimp = function (options) {
22+
$(this).each(function(i, elem) {
23+
var form = $(elem);
24+
var email = form.find('input[type=email]');
25+
var label = form.find('.info');
26+
27+
var settings = $.extend({
28+
'url': form.attr('action'),
29+
'language': 'en'
30+
}, options);
31+
32+
var url = settings.url.replace('/post?', '/post-json?').concat('&c=?');
33+
34+
form.attr('novalidate', 'true');
35+
email.attr('name', 'EMAIL');
36+
37+
form.submit(function () {
38+
var msg;
39+
function successCallback(resp) {
40+
if (resp.result === 'success') {
41+
msg = 'We have sent you a confirmation email';
42+
label.removeClass('error').addClass('valid');
43+
email.removeClass('error').addClass('valid');
44+
} else {
45+
email.removeClass('valid').addClass('error');
46+
label.removeClass('valid').addClass('error');
47+
var index = -1;
48+
try {
49+
var parts = resp.msg.split(' - ', 2);
50+
if (parts[1] === undefined) {
51+
msg = resp.msg;
52+
} else {
53+
var i = parseInt(parts[0], 10);
54+
if (i.toString() === parts[0]) {
55+
index = parts[0];
56+
msg = parts[1];
57+
} else {
58+
index = -1;
59+
msg = resp.msg;
60+
}
61+
}
62+
}
63+
catch (e) {
64+
index = -1;
65+
msg = resp.msg;
66+
}
67+
}
68+
69+
// Translate and display message
70+
if (
71+
settings.language !== 'en'
72+
&& $.ajaxChimp.responses[msg] !== undefined
73+
&& $.ajaxChimp.translations
74+
&& $.ajaxChimp.translations[settings.language]
75+
&& $.ajaxChimp.translations[settings.language][$.ajaxChimp.responses[msg]]
76+
) {
77+
msg = $.ajaxChimp.translations[settings.language][$.ajaxChimp.responses[msg]];
78+
}
79+
label.html(msg);
80+
81+
label.show(2000);
82+
if (settings.callback) {
83+
settings.callback(resp);
84+
}
85+
}
86+
87+
var data = {};
88+
var dataArray = form.serializeArray();
89+
$.each(dataArray, function (index, item) {
90+
data[item.name] = item.value;
91+
});
92+
93+
$.ajax({
94+
url: url,
95+
data: data,
96+
success: successCallback,
97+
dataType: 'jsonp',
98+
error: function (resp, text) {
99+
console.log('mailchimp ajax submit error: ' + text);
100+
}
101+
});
102+
103+
// Translate and display submit message
104+
var submitMsg = 'Submitting...';
105+
if(
106+
settings.language !== 'en'
107+
&& $.ajaxChimp.translations
108+
&& $.ajaxChimp.translations[settings.language]
109+
&& $.ajaxChimp.translations[settings.language]['submit']
110+
) {
111+
submitMsg = $.ajaxChimp.translations[settings.language]['submit'];
112+
}
113+
label.html(submitMsg).show(2000);
114+
115+
return false;
116+
});
117+
});
118+
return this;
119+
};
120+
})(jQuery);

Diff for: jquery.easing.min.js

+44
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)