Subversion Repositories SmartDukaan

Rev

Rev 13213 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
13213 kshitij.so 1
 
2
$(document).ready(function(){
3
 
4
 
5
	/* ---- Countdown timer ---- */
6
 
7
	$('#counter').countdown({
13279 kshitij.so 8
		timestamp : (new Date(1418409000000)).getTime()
9
	});						
13213 kshitij.so 10
 
11
	/* ---- Animations ---- */
12
 
13
	$('#links a').hover(
14
		function(){ $(this).animate({ left: 3 }, 'fast'); },
15
		function(){ $(this).animate({ left: 0 }, 'fast'); }
16
	);
17
 
18
	$('footer a').hover(
19
		function(){ $(this).animate({ top: 3 }, 'fast'); },
20
		function(){ $(this).animate({ top: 0 }, 'fast'); }
21
	);
22
 
23
 
24
	/* ---- Using Modernizr to check if the "required" and "placeholder" attributes are supported ---- */
25
 
26
	if (!Modernizr.input.placeholder) {
27
		$('.email').val('Input your e-mail address here...');
28
		$('.email').focus(function() {
29
			if($(this).val() == 'Input your e-mail address here...') {
30
				$(this).val('');
31
			}
32
		});
33
	}
34
 
35
	// for detecting if the browser is Safari
36
	var browser = navigator.userAgent.toLowerCase();
37
	if(!Modernizr.input.required || (browser.indexOf("safari") != -1 && browser.indexOf("chrome") == -1)) {
38
		$('form').submit(function() {
39
			$('.popup').remove();
40
			if(!$('.email').val() || $('.email').val() == 'Input your e-mail address here...') {
41
				$('form').append('<p class="popup">Please fill out this field.</p>');
42
				$('.email').focus();
43
				return false;
44
			}
45
		});
46
		$('.email').keydown(function() {
47
			$('.popup').remove();
48
		});
49
		$('.email').blur(function() {
50
			$('.popup').remove();
51
		});
52
 
53
	}
54
 
55
	$("#gosf-form").live('submit', function(){
56
		var userEmail = $('.gosf-email').val();
57
		console.log(userEmail);
58
		jQuery.ajax({
59
	        url: "/gosf!notifyGosf?email="+userEmail,
60
	        type: 'POST',
61
	        async: false,
62
	        success: function (data) {
63
	        	showMsg(data);
64
	        },
65
			 error : function() {
66
				 showMsg("OOPS!!!Please try again.");
67
			 },
68
	        cache: false,
69
	        contentType: "application/x-www-form-urlencoded",
70
	        processData: false
71
	    });
72
    return false;
73
	});
74
 
75
	function showMsg(msg){
76
			$("#msg").html(msg);
77
			$("#msg").attr('style', 'color:green;border:1px solid red;box-shadow: red 0 0 30px 1px;');
78
			$("#msg").fadeIn(600, function() {
79
				window.setTimeout(function() {
80
					$("#msg").fadeOut(800, function() {
81
					$("#msg").removeAttr('style');
82
				});
83
			}, 3000);
84
		});
85
	}
86
});
87