74 lines
2.0 KiB
JavaScript
74 lines
2.0 KiB
JavaScript
|
String.prototype.trim = function(){
|
||
|
return( this.replace(new RegExp("^([\\s]+)|([\\s]+)$", "gm"), "") );
|
||
|
}
|
||
|
|
||
|
$(document).ready(function() {
|
||
|
// if ($('#centerContent').length > 0 && $.support.opacity) $('#centerContent').jScrollPane();
|
||
|
$('#emailInput').initDefaults();
|
||
|
$('#submitText').click(function() {
|
||
|
var that = this;
|
||
|
$(this).fadeOut("fast");
|
||
|
$('#submitting').fadeIn("fast");
|
||
|
$('#emailInput').attr("disabled", "disabled");
|
||
|
var email = $('#emailInput').val();
|
||
|
$.get("/itf/save_email/", {
|
||
|
'email': email
|
||
|
}, function(res) {
|
||
|
if (res == '1') {
|
||
|
$('#emailSignup').hide();
|
||
|
$('#emailSignup').html("Thanks for signing up!");
|
||
|
$('#emailSignup').slideDown("slow");
|
||
|
} else {
|
||
|
$('#emailInput').removeAttr("disabled");
|
||
|
$('#welcomeText').hide();
|
||
|
$('#welcomeText').html("Please enter a valid email address: ");
|
||
|
$('#welcomeText').addClass("error");
|
||
|
$('#welcomeText').show();
|
||
|
$('#submitting').hide();
|
||
|
$('#submitText').fadeIn("fast");
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
$('#submitText').hover(function() {
|
||
|
$(this).css("color", "#f8c301");
|
||
|
}, function() {
|
||
|
$(this).css("color", "#fff");
|
||
|
});
|
||
|
});
|
||
|
|
||
|
function showNext() {
|
||
|
$('#right2').show("slow");
|
||
|
$('.rightMore').hide();
|
||
|
}
|
||
|
/*
|
||
|
$('#leftNav > li > a').mouseover(function() {
|
||
|
$(this).next().slideDown("fast");
|
||
|
});
|
||
|
$('#leftNav > li').mouseout(function() {
|
||
|
$(this).children('.helper').slideUp("fast");
|
||
|
});
|
||
|
|
||
|
});
|
||
|
*/
|
||
|
|
||
|
jQuery.fn.initDefaults = function() {
|
||
|
this.each(function() {
|
||
|
if ($(this).val().trim() == '') {
|
||
|
var val = $(this).attr("data-default");
|
||
|
$(this).val(val);
|
||
|
}
|
||
|
$(this).focus(function() {
|
||
|
if ($(this).val() === $(this).attr('data-default')) {
|
||
|
$(this).val('');
|
||
|
}
|
||
|
}).blur(function() {
|
||
|
var that = $(this);
|
||
|
if ($(this).val().trim() == '') {
|
||
|
$(this).val(that.attr("data-default"));
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
return this;
|
||
|
}
|
||
|
|