| 7272 |
amit.gupta |
1 |
$(function(){
|
|
|
2 |
$("#userSelector .default").truncate({addtitle: true});
|
|
|
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 |
/** 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(){
|
|
|
24 |
submitSeachForm();
|
|
|
25 |
});
|
|
|
26 |
|
|
|
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 |
currenturl = (currenturl) + this.value;
|
|
|
35 |
} else {
|
|
|
36 |
currenturl = (currenturl).replace(this.value, "");
|
|
|
37 |
}
|
|
|
38 |
window.location = currenturl.replace(/&page=./,"");
|
|
|
39 |
});
|
|
|
40 |
$('a.mk_filter').click(function(){
|
|
|
41 |
//first remove all fqs except category and sub category when
|
|
|
42 |
//any of the category links are clicked
|
|
|
43 |
var search = window.location.search;
|
|
|
44 |
if(window.location.search=="") {
|
|
|
45 |
search = "?";
|
|
|
46 |
}
|
|
|
47 |
var currenturl = window.location.pathname + search;
|
|
|
48 |
classNames = $(this).attr("class");
|
|
|
49 |
if(classNames.indexOf("mk_bold") >= 0) {
|
|
|
50 |
//if this is selected category filter, remove subcategory filter from url
|
|
|
51 |
currenturl = currenturl.replace($(this).closest('ul').find('.mk_bold.mk_subcategory').attr("value"), "");
|
|
|
52 |
}else {
|
|
|
53 |
//check if sub-category is changed, if yes then remove the previous sub-category and add this sub-category
|
|
|
54 |
if(classNames.indexOf("mk_subcategory") >= 0) {
|
|
|
55 |
currenturl = currenturl.replace($(this).closest('ul').find('.mk_bold.mk_subcategory').attr("value"), "") + $(this).attr("value");
|
|
|
56 |
}else {
|
|
|
57 |
currenturl = (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");
|
|
|
58 |
}
|
|
|
59 |
}
|
|
|
60 |
window.location = currenturl.replace(/&page=./,"");
|
|
|
61 |
});
|
|
|
62 |
|
|
|
63 |
//also now remove unwanted filters
|
|
|
64 |
$('a.mk_filter_close').click(function(){
|
|
|
65 |
var rootFacets = ["F_50010","F_50011","F_50002", "F_50001", "F_50028"];
|
|
|
66 |
var search = window.location.search;
|
|
|
67 |
if(window.location.search=="") {
|
|
|
68 |
search = "?";
|
|
|
69 |
}
|
|
|
70 |
var newurl = window.location.pathname + search;
|
|
|
71 |
var filterValue = $(this).attr("value");
|
|
|
72 |
if(filterValue.indexOf("F_50010")>-1){
|
|
|
73 |
$(this).closest('div').find('.mk_filter_close').each(function(index,value){
|
|
|
74 |
newurl = newurl.replace($(value).attr("value"), "");
|
|
|
75 |
});
|
|
|
76 |
} else if(filterValue.indexOf("F_50011")>-1){
|
|
|
77 |
$(this).closest('#currentFilters').find('.mk_filter_close').each(function(index,value){
|
|
|
78 |
var regexS = "fq=(.*)%3A";
|
|
|
79 |
var regex = new RegExp(regexS);
|
|
|
80 |
var results = regex.exec($(value).attr("value"));
|
|
|
81 |
if(rootFacets.indexOf(results[1]) == -1){
|
|
|
82 |
newurl = newurl.replace($(value).attr("value"), "");
|
|
|
83 |
}
|
|
|
84 |
});
|
|
|
85 |
newurl = newurl.replace($(this).attr("value"), "");
|
|
|
86 |
} else {
|
|
|
87 |
newurl = newurl.replace($(this).attr("value"), "");
|
|
|
88 |
}
|
|
|
89 |
window.location = newurl.replace(/&page=./,"");
|
|
|
90 |
});
|
|
|
91 |
|
|
|
92 |
$('body').mouseup(function(){
|
|
|
93 |
var userSelector = $('#userSelector');
|
|
|
94 |
var isMouseOnUserSelector = $(userSelector).data('is_mouse_on_user_selector');
|
|
|
95 |
|
|
|
96 |
if (typeof(isMouseOnUserSelector) == 'boolean' && !isMouseOnUserSelector) {
|
|
|
97 |
$(userSelector).children('ul').hide();
|
|
|
98 |
$(userSelector).data('usermenustate', false);
|
|
|
99 |
$(userSelector).removeClass('active');
|
|
|
100 |
}
|
|
|
101 |
});
|
|
|
102 |
|
|
|
103 |
$('#userSelector').click(function(){
|
|
|
104 |
|
|
|
105 |
var userMenuState = $(this).data('usermenustate');
|
|
|
106 |
|
|
|
107 |
if (typeof(userMenuState) == 'undefined' || !userMenuState) {
|
|
|
108 |
$(this).addClass('active');
|
|
|
109 |
$(this).children('ul').show();
|
|
|
110 |
$(this).data('usermenustate', true);
|
|
|
111 |
} else {
|
|
|
112 |
$(this).removeClass('active');
|
|
|
113 |
$(this).children('ul').hide();
|
|
|
114 |
$(this).data('usermenustate', false);
|
|
|
115 |
}
|
|
|
116 |
}).hover(function(){
|
|
|
117 |
$(this).data('is_mouse_on_user_selector', true);
|
|
|
118 |
}, function(){
|
|
|
119 |
$(this).data('is_mouse_on_user_selector', false);
|
|
|
120 |
});
|
|
|
121 |
|
|
|
122 |
/** Press Coverage Section **/
|
|
|
123 |
$('#asSeenOnBS').click(function(){
|
|
|
124 |
window.open('http://www.business-standard.com/article/companies/saholic-com-offering-theft-insurance-for-mobile-handsets-113031100002_1.html', '_blank');
|
|
|
125 |
trackEventWithGA('Press Coverage', 'Logo Click', 'Business Standard');
|
|
|
126 |
});
|
|
|
127 |
|
|
|
128 |
$('#asSeenOnBT').click(function(){
|
|
|
129 |
window.open('http://businesstoday.intoday.in/story/saholic.com-to-compensate-customers-for-late-deliveries/1/191649.html', '_blank');
|
|
|
130 |
trackEventWithGA('Press Coverage', 'Logo Click', 'Business Today');
|
|
|
131 |
});
|
|
|
132 |
|
|
|
133 |
$('#asSeenOnTOI').click(function(){
|
|
|
134 |
window.open("http://articles.timesofindia.indiatimes.com/2012-01-25/telecom/30662542_1_nokia-s-windows-phone-nokia-lumia-smartphone", '_blank');
|
|
|
135 |
trackEventWithGA('Press Coverage', 'Logo Click', 'The Times of India');
|
|
|
136 |
});
|
|
|
137 |
|
|
|
138 |
$('#asSeenOnWSJ').click(function(){
|
|
|
139 |
window.open('http://online.wsj.com/article/SB10001424052702304447804576412930555639142.html', '_blank');
|
|
|
140 |
trackEventWithGA('Press Coverage', 'Logo Click', 'The Wall Street Journal');
|
|
|
141 |
});
|
|
|
142 |
|
|
|
143 |
$('#asSeenOnMC').click(function(){
|
|
|
144 |
window.open("http://www.moneycontrol.com/news/technology/nokia-lumia-710-available-for-approximately-rs15700_655601.html", '_blank');
|
|
|
145 |
trackEventWithGA('Press Coverage', 'Logo Click', 'Money Control');
|
|
|
146 |
});
|
|
|
147 |
});
|