Adding umbrellajs, an tiny jquery replacement. Switching theme js to umbrellajs.
This commit is contained in:
parent
6ef1e420e3
commit
d0a11e1ad4
1 changed files with 848 additions and 33 deletions
|
|
@ -8,41 +8,41 @@
|
|||
'use strict';
|
||||
|
||||
// Contact form.
|
||||
$('.contact-form').each(function () {
|
||||
var $contact_form = $(this);
|
||||
$('.contact-form').each(function (e) {
|
||||
var $contact_form = $(e);
|
||||
var $contact_button = $contact_form.find('.form-submit');
|
||||
var contact_action = '/php/contact.php';
|
||||
|
||||
// Display the hidden form.
|
||||
$contact_form.removeClass('hidden');
|
||||
// Remove the "no javascript" messages
|
||||
$('.contact-no-js').detach();
|
||||
$('.contact-no-js').remove();
|
||||
|
||||
// Wait for a mouse to move, indicating they are human.
|
||||
$('body').mousemove(function () {
|
||||
$('body').on('mousemove', function () {
|
||||
// Unlock the form.
|
||||
$contact_form.attr('action', contact_action);
|
||||
$contact_button.attr('disabled', false);
|
||||
$contact_button.first().removeAttribute('disabled');
|
||||
});
|
||||
|
||||
// Wait for a touch move event, indicating that they are human.
|
||||
$('body').on('touchmove', function () {
|
||||
// Unlock the form.
|
||||
$contact_form.attr('action', contact_action);
|
||||
$contact_button.attr('disabled', false);
|
||||
$contact_button.first().removeAttribute('disabled');
|
||||
});
|
||||
|
||||
// A tab or enter key pressed can also indicate they are human.
|
||||
$('body').keydown(function (e) {
|
||||
$('body').on('keydown', function (e) {
|
||||
if ((e.keyCode === 9) || (e.keyCode === 13)) {
|
||||
// Unlock the form.
|
||||
$contact_form.attr('action', contact_action);
|
||||
$contact_button.attr('disabled', false);
|
||||
$contact_button.first().removeAttribute('disabled');
|
||||
}
|
||||
});
|
||||
|
||||
// Mark the form as submitted.
|
||||
$contact_button.click(function () {
|
||||
$contact_button.on('click', function () {
|
||||
$contact_form.addClass('js-submitted');
|
||||
});
|
||||
|
||||
|
|
@ -60,4 +60,4 @@
|
|||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
})(u);
|
||||
|
|
|
|||
Loading…
Reference in a new issue