Subversion Repositories SmartDukaan

Rev

Rev 5038 | Rev 6881 | 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
 
3830 chandransh 14
	/** Search in Header **/
15
	$('#query').val('Search for more items...')
16
		.focus(function(){
17
			$(this).val('');
18
		})
19
		.blur(function(){
20
			if ($(this).val() == '')	$(this).val('Search for more items...');
21
		});
22
 
23
	$('#searchButton').click(function(){
3966 varun.gupt 24
		submitSeachForm();
3830 chandransh 25
	});
26
 
6866 amit.gupta 27
	$('input.mk_filter').change(function(){
28
		var search = window.location.search;
29
		if(window.location.search=="") {
30
			search = "?";
31
		}
32
		var currenturl = window.location.pathname + search;
33
		if(this.checked) {
34
			window.location = (currenturl) + this.value;
35
		} else {
36
			window.location = (currenturl).replace(this.value, "");
37
		}
38
	});
39
	$('a.mk_filter').click(function(){
40
		//first remove all fqs except category and sub category when 
41
		//any of the category links are clicked
42
		var search = window.location.search;
43
		if(window.location.search=="") {
44
			search = "?";
45
		}
46
		var currenturl = window.location.pathname + search;
47
		classNames = $(this).attr("class");
48
		if(classNames.indexOf("mk_bold") >= 0) {
49
			//if this is selected category filter, remove subcategory filter from url
50
			window.location = currenturl.replace($(this).closest('ul').find('.mk_bold.mk_subcategory').attr("value"), "");
51
		}else {
52
			//check if sub-category is changed, if yes then remove the previous sub-category and add this sub-category
53
			if(classNames.indexOf("mk_subcategory") >= 0) {
54
				window.location = currenturl.replace($(this).closest('ul').find('.mk_bold.mk_subcategory').attr("value"), "") + $(this).attr("value");
55
			}else {
56
				window.location = (currenturl).replace($(this).closest('ul').find('.mk_bold.mk_category').attr("value"), "").replace($(this).closest('ul').find('.mk_bold.mk_subcategory').attr("value"),"") + $(this).attr("value");
57
			} 
58
		}
59
	});
60
 
61
 
62
	$('a.mk_filter_close').click(function(){
63
		var search = window.location.search;
64
		if(window.location.search=="") {
65
			search = "?";
66
		}
67
		var currenturl = window.location.pathname + search;
68
		var newurl = currenturl;
69
		var filterValue = $(this).attr("value");
70
		if(filterValue.indexOf("F_50010")>-1){
71
			$(this).closest('div').find('.mk_filter_close').each(function(index,value){
72
				newurl = newurl.replace($(value).attr("value"), "");
73
			});
74
		} else {
75
			newurl = newurl.replace($(this).attr("value"), "");
76
		}
77
		window.location = newurl;
78
	});
79
 
4180 rajveer 80
	$('body').mouseup(function(){
81
		var userSelector = $('#userSelector');
82
		var isMouseOnUserSelector = $(userSelector).data('is_mouse_on_user_selector');
83
 
84
		if (typeof(isMouseOnUserSelector) == 'boolean'  && !isMouseOnUserSelector)	{
85
			$(userSelector).children('ul').hide();
86
			$(userSelector).data('usermenustate', false);
87
			$(userSelector).removeClass('active');
88
		}
89
	});
90
 
91
	$('#userSelector').click(function(){
92
 
93
		var userMenuState = $(this).data('usermenustate');
94
 
95
		if (typeof(userMenuState) == 'undefined' || !userMenuState)	{
96
			$(this).addClass('active');
97
			$(this).children('ul').show();
98
			$(this).data('usermenustate', true);
99
		} else	{
100
			$(this).removeClass('active');
101
			$(this).children('ul').hide();
102
			$(this).data('usermenustate', false);
103
		}
104
	}).hover(function(){
105
		$(this).data('is_mouse_on_user_selector', true);
106
	}, function(){
107
		$(this).data('is_mouse_on_user_selector', false);
108
	});
109
 
4810 varun.gupt 110
	/** Press Coverage Section **/
111
	$('#asSeenOnBS').click(function(){
112
		window.open('http://www.business-standard.com/india/news/spice-launches-online-shopping-portal-saholiccom/434451/', '_blank');
113
		trackEventWithGA('Press Coverage', 'Logo Click', 'Business Standard');
114
	});
115
 
116
	$('#asSeenOnTOI').click(function(){
117
		window.open("http://articles.timesofindia.indiatimes.com/2012-01-25/telecom/30662542_1_nokia-s-windows-phone-nokia-lumia-smartphone", '_blank');
118
		trackEventWithGA('Press Coverage', 'Logo Click', 'The Times of India');
119
	});
120
 
121
	$('#asSeenOnWSJ').click(function(){
122
		window.open('http://online.wsj.com/article/SB10001424052702304447804576412930555639142.html', '_blank');
123
		trackEventWithGA('Press Coverage', 'Logo Click', 'The Wall Street Journal');
124
	});
125
 
126
	$('#asSeenOnMC').click(function(){
127
		window.open("http://www.moneycontrol.com/news/technology/nokia-lumia-710-available-for-approximately-rs15700_655601.html", '_blank');
128
		trackEventWithGA('Press Coverage', 'Logo Click', 'Money Control');
129
	});
3830 chandransh 130
});