Subversion Repositories SmartDukaan

Rev

Rev 4180 | Rev 5038 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3830 chandransh 1
$(function(){
4180 rajveer 2
	$("#userSelector .default").truncate({addtitle: true});
3966 varun.gupt 3
 
4
	function submitSeachForm()	{
5
		var query = $.trim($('#query').val());
6
 
7
		if(query != '' && query != 'Search for more items...')	{
8
			$('#formSearch').submit();	
9
		} else	{
10
			$('#query').focus();
11
		}
12
	}
13
 
14
	$('body').mouseup(function(){
15
		var categorySelector = $('#categorySelector');
16
		var isMouseOnCategorySelector = $(categorySelector).data('is_mouse_on_category_selector');
17
 
18
		if (typeof(isMouseOnCategorySelector) == 'boolean'  && !isMouseOnCategorySelector)	{
19
			$(categorySelector).children('ul').hide();
20
			$(categorySelector).data('menustate', false);
21
		}
22
	});
23
 
3830 chandransh 24
	/** Search in Header **/
25
	$('#query').val('Search for more items...')
26
		.focus(function(){
27
			$(this).val('');
28
		})
29
		.blur(function(){
30
			if ($(this).val() == '')	$(this).val('Search for more items...');
31
		});
32
 
33
	$('#searchButton').click(function(){
3966 varun.gupt 34
		submitSeachForm();
3830 chandransh 35
	});
36
 
3966 varun.gupt 37
	$('#categorySelector').click(function(){
38
 
39
		var menuState = $(this).data('menustate');
40
 
41
		if (typeof(menuState) == 'undefined' || !menuState)	{
42
			$(this).children('ul').show();
43
			$(this).data('menustate', true);
44
		} else	{
45
			$(this).children('ul').hide();
46
			$(this).data('menustate', false);
47
		}
48
	}).hover(function(){
49
		$(this).data('is_mouse_on_category_selector', true);
50
	}, function(){
51
		$(this).data('is_mouse_on_category_selector', false);
3830 chandransh 52
	});
3966 varun.gupt 53
 
54
	$('.search-in-dropdown-options li').click(function(){
55
		var category = $(this).attr('id').split('_')[2];
56
		$('input[name="category"]').val(category);
57
		submitSeachForm();
58
	});
4180 rajveer 59
 
60
	$('body').mouseup(function(){
61
		var userSelector = $('#userSelector');
62
		var isMouseOnUserSelector = $(userSelector).data('is_mouse_on_user_selector');
63
 
64
		if (typeof(isMouseOnUserSelector) == 'boolean'  && !isMouseOnUserSelector)	{
65
			$(userSelector).children('ul').hide();
66
			$(userSelector).data('usermenustate', false);
67
			$(userSelector).removeClass('active');
68
		}
69
	});
70
 
71
	$('#userSelector').click(function(){
72
 
73
		var userMenuState = $(this).data('usermenustate');
74
 
75
		if (typeof(userMenuState) == 'undefined' || !userMenuState)	{
76
			$(this).addClass('active');
77
			$(this).children('ul').show();
78
			$(this).data('usermenustate', true);
79
		} else	{
80
			$(this).removeClass('active');
81
			$(this).children('ul').hide();
82
			$(this).data('usermenustate', false);
83
		}
84
	}).hover(function(){
85
		$(this).data('is_mouse_on_user_selector', true);
86
	}, function(){
87
		$(this).data('is_mouse_on_user_selector', false);
88
	});
89
 
4810 varun.gupt 90
	/** Press Coverage Section **/
91
	$('#asSeenOnBS').click(function(){
92
		window.open('http://www.business-standard.com/india/news/spice-launches-online-shopping-portal-saholiccom/434451/', '_blank');
93
		trackEventWithGA('Press Coverage', 'Logo Click', 'Business Standard');
94
	});
95
 
96
	$('#asSeenOnTOI').click(function(){
97
		window.open("http://articles.timesofindia.indiatimes.com/2012-01-25/telecom/30662542_1_nokia-s-windows-phone-nokia-lumia-smartphone", '_blank');
98
		trackEventWithGA('Press Coverage', 'Logo Click', 'The Times of India');
99
	});
100
 
101
	$('#asSeenOnWSJ').click(function(){
102
		window.open('http://online.wsj.com/article/SB10001424052702304447804576412930555639142.html', '_blank');
103
		trackEventWithGA('Press Coverage', 'Logo Click', 'The Wall Street Journal');
104
	});
105
 
106
	$('#asSeenOnMC').click(function(){
107
		window.open("http://www.moneycontrol.com/news/technology/nokia-lumia-710-available-for-approximately-rs15700_655601.html", '_blank');
108
		trackEventWithGA('Press Coverage', 'Logo Click', 'Money Control');
109
	});
3830 chandransh 110
});